Skip to content

Instantly share code, notes, and snippets.

View tbodt's full-sized avatar

tbodt tbodt

View GitHub Profile
@ErikAugust
ErikAugust / spectre.c
Last active August 2, 2024 01:59
Spectre example code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@romainl
romainl / Vim_pushing_built-in_features_beyond_their_limits.markdown
Last active September 19, 2023 08:16
Vim: pushing built-in features beyond their limits

Vim: pushing built-in features beyond their limits

The situation

Searching can be an efficient way to navigate the current buffer.

The first search commands we learn are usually / and ?. These are seriously cool, especially with the incsearch option enabled which lets us keep typing to refine our search pattern. / and ? really shine when all we want is to jump to something we already have our eyeballs on but they are not fit for every situation:

  • when we want to search something that's not directly there, those two commands can make us lose context very quickly,
  • when we need to compare the matches.
@tbodt
tbodt / Anagrams.java
Created July 23, 2014 00:21
Print all anagrams
public class Anagrams {
public static void main(String[] args) {
String start = args[0];
String anagram = start;
do {
System.out.println(anagram);
anagram = nextAnagram(anangram);
} while (!start.equals(anagram))
}
public static String nextAnagram(String word) {