Skip to content

Instantly share code, notes, and snippets.

View bastih's full-sized avatar
🏠
Working from home

Sebastian Hillig bastih

🏠
Working from home
View GitHub Profile
module ListPoint = struct
type point = int list
let make x y = [x; y]
let getX p = List.nth p 0
let getY p = List.nth p 1
let origin = [0; 0]
let print p = print_int (getX p); print_string " "; print_int (getY p); print_endline ""
end;;
module Square = struct
@bastih
bastih / test.bash
Created September 11, 2012 23:25
Slightly scary
#!/bin/bash
set +H
path=`find src/ -type f`
ssed -i "s/using namespace std;//" $path;
ssed -i "s/using std::.*//" $path;
# std-ize templates
for symbol in stack map list vector queue set pair priority_queue make_shared dynamic_pointer_cast numeric_limits back_insert_iterator
inline uint64_t rdtsc() {
uint32_t lo, hi;
__asm__ __volatile__ (
"xorl %%eax, %%eax\n"
"cpuid\n"
"rdtsc\n"
: "=a" (lo), "=d" (hi)
:
: "%ebx", "%ecx");
return (uint64_t)hi << 32 | lo;
@bastih
bastih / ScanBenchmark.cpp
Created February 23, 2012 13:32 — forked from tinnefeld/ScanBenchmark.cpp
ScanBenchmark // g++ -O2 Scanbenchmark.cc Timer.h
#include <iostream>
#include <stdlib.h>
#include "scans.h"
#include "Timer.h"
using namespace std;
const long long size = 1024*1024*128; // 1GB
int main()
#include <iostream>
using namespace std;
class A
{
protected:
public:
int count;
A() : count(1) { };
#include <iostream>
using namespace std;
class A
{
protected:
public:
int count;
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.