This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
gcc -std=c99 -O1 main.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdint.h> | |
inline uint64_t rdtsc() { | |
uint32_t low, high; | |
__asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high)); | |
return (uint64_t)low | ((uint64_t)high << 32); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS=-g | |
LDFLAGS=-lunwind -lunwind-x86_64 | |
all: stacktrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
nasm boot.asm -f bin -o boot.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _PROB_BENCHMARK_H_ | |
#define _PROB_BENCHMARK_H_ | |
#define _GNU_SOURCE | |
#include <stdio.h> | |
#include <time.h> | |
#define KNRM "\x1B[0m" // normal console color | |
#define KRED "\x1B[31m" | |
#define KGRN "\x1B[32m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LDFLAGS=-lunwind -lunwind-x86_64 | |
all: asc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.NoSuchElementException; | |
import java.util.Scanner; | |
import javax.script.ScriptEngine; | |
import javax.script.ScriptEngineManager; | |
import javax.script.ScriptException; | |
public class JS { | |
public static void main(String[] args) { | |
ScriptEngine se = new ScriptEngineManager().getEngineByName("nashorn"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.xml.XML | |
object Main extends App { | |
def getType(w: String) = w dropWhile ( _ != ':' ) drop(1) capitalize | |
val xml = XML.loadFile("Sample.wsdl") | |
val types = (xml \ "types" \ "schema" \ "complexType") | |
types map { complextype => | |
println("case class %s(".format(complextype.attribute("name").get)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
section .data | |
msg db "hello world", 0x0 | |
section .text | |
extern gtk_init | |
extern gtk_widget_show_all | |
extern gtk_window_new | |
extern gtk_window_resize | |
extern gtk_container_add | |
extern gtk_label_new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.util.function.Function; | |
public class Memoize { | |
static interface F<T,R> extends Function<T,R> {} | |
// not thread safe | |
static <T,R> F<T, R> memoize(F<T, R> f) { | |
Map<T, R> cache = new HashMap<>(); | |
return (x) -> { |