Skip to content

Instantly share code, notes, and snippets.

View cfstras's full-sized avatar

Claus F. Strasburger cfstras

  • Düsseldorf, Germany
  • 18:25 (UTC +02:00)
View GitHub Profile
@cfstras
cfstras / Makefile
Last active August 29, 2015 13:55
Hash Join with linear probing -- For details, go to http://codematch.muehe.org/challenges/29 -- For big.txt, go to http://www-db.in.tum.de/~muehe/exampleinput.txt
CXX := clang++
CXXFLAGS := -std=c++0x -xc++ -march=native -O3 -Wall -g
DPROFILE := -DPROFILE
CXXVERBOSE := -ftree-vectorizer-verbose=0
LIBS := -lprofiler
TIME := time
export CPUPROFILE=join.prof
export CPUPROFILE_FREQUENCY=10000000000
export CPUPROFILE_REALTIME=0
@cfstras
cfstras / gist:be3cfa95b2e2637577a4
Last active August 29, 2015 14:00
git tips for big repos on windows

Git tips for big repositories on Windows

Performance

core.fscache

core.fscache = true

to enable uber-speed git status.

pack.*

@cfstras
cfstras / panic-recover.go
Created September 12, 2014 09:45
Panic & Recover for long fail-fast methods
package main
import (
"errors"
"fmt"
"math/rand"
"runtime"
"time"
)
@cfstras
cfstras / script.go
Last active August 29, 2015 14:08
Go working shebang (go needs to be in $PATH, File needs to be named *.go)
//usr/bin/env go run $0 $@ ; exit
package main
import "fmt"
func main() {
fmt.Println("Hello, Go!")
}
@cfstras
cfstras / keybase.md
Created January 2, 2015 13:55
keybase.md

Keybase proof

I hereby claim:

  • I am cfstras on github.
  • I am cfstras (https://keybase.io/cfstras) on keybase.
  • I have a public key whose fingerprint is 1C43 852F 3C54 BD01 AACA E525 AA4D 0EE5 B048 00CE

To claim this, I am signing this object:

@cfstras
cfstras / Tree.java
Created April 17, 2015 11:55
Simple Tree-View with toString()
/**
* Assuming two methods are present:
* - List<SomeType> getChildren();
* - String() getName();
* Works for every tree structure.
*
* @return an ASCII-Tree of children
*/
@cfstras
cfstras / background
Last active October 3, 2015 01:08
Background-changer script for GNOME 3
#!/bin/bash
# background-changer
# 2012-04-06
# use to switch gnome background to a random one
# uses every file in bg_path and follows the first symlinks in that directory
# outputs the selected file
# author: cfstras <c@cfs.im>
# license: beerware
#
# use for example in a crontab:
@cfstras
cfstras / tcp-chat.js
Last active December 18, 2015 01:39
Chatserver
// Bib's
var net = require('net');
// Fettes Array
var clients = [];
// create teh server!
var srv = net.createServer();
// connection handler, das Argument ist ein Socket mit der neuen Verbindung
@cfstras
cfstras / sekanten.coffee
Created January 22, 2014 13:22
Demonstration of the Secant method (Sekantenmethode) with an initial Newton step.
# functions
f = (x) ->
2 - x*x - Math.exp(x)
fd = (x) ->
-2*x - Math.exp(x)
newt = (x) ->
x - f x / fd x
@cfstras
cfstras / toLower.bat
Last active January 4, 2016 19:19
The reason why nobody should use batch files. Found in an old batch file.
:toLower str -- converts uppercase character to lowercase
:: -- str [in,out] - valref of string variable to be converted
if not defined %~1 EXIT /b
for %%a in ("A=a" "B=b" "C=c" "D=d" "E=e" "F=f" "G=g" "H=h" "I=i"
"J=j" "K=k" "L=l" "M=m" "N=n" "O=o" "P=p" "Q=q" "R=r"
"S=s" "T=t" "U=u" "V=v" "W=w" "X=x" "Y=y" "Z=z" "Ä=ä"
"Ö=ö" "Ü=ü") do (
call set %~1=%%%~1:%%~a%%
:: it's nice how this line manages to represent the horrors of syntax in under 30 characters.
)