Skip to content

Instantly share code, notes, and snippets.

View MartinNowak's full-sized avatar
🎯
Focusing

dawg MartinNowak

🎯
Focusing
View GitHub Profile
@MartinNowak
MartinNowak / keybase.md
Created August 11, 2016 10:32
keybase.md

Keybase proof

I hereby claim:

  • I am MartinNowak on github.
  • I am dawg (https://keybase.io/dawg) on keybase.
  • I have a public key whose fingerprint is AFC7 DB45 693D 62BB 472B F27B AB8F E924 C2F7 E724

To claim this, I am signing this object:

@MartinNowak
MartinNowak / acyclic_visitor.d
Last active December 24, 2015 02:19
Implementation of the acyclic visitor pattern using mixed C++/D interfaces and a custom dynamic cast.
import std.stdio, std.typetuple;
version = OurDynamicCast;
interface Visitor
{
version (OurDynamicCast)
{
size_t visitorOffset(); // offset to Visitor 'this' from the Object 'this'
object.Interface[] interfaces(); // metadata about the interfaces the Object implements
#!/usr/bin/env bash
function killPIDAfter #(pid, duration)
{
sleep $2
kill -0 $1 &>/dev/null
if [ $? -eq 0 ]; then
kill -TERM $1 &>/dev/null
if [ $? -ne 0 ]; then
kill -KILL $1 &>/dev/null
@MartinNowak
MartinNowak / .gitignore
Last active December 20, 2015 01:29
serve
serve
module cluster;
import std.algorithm, std.array, std.exception, std.file, std.path, std.process, std.regex, std.stdio, std.string;
// debug = PRINTF;
__gshared string dmd = "dmd";
void getImports(string src, in size_t[string] indices, float[] impVec)
{
enum importRE = ctRegex!(`^import[ ]+(.*)\t\(.*\)$`, "mg");
# CONFIGURE
github_user = 'GITHUB_USER'
github_pass = 'GITHUB_PASS'
# INSTALL www.python-requests.org
import requests
def isMerged(pull):
sc = requests.head(
"https://api.github.com/repos/D-Programming-Language/dmd/pulls/"+str(pull)+"/merge",
@MartinNowak
MartinNowak / rpn.d
Created April 10, 2013 20:46
A scalar version of arrayOp that uses [RPN](http://en.wikipedia.org/wiki/Reverse_Polish_notation) to encode the expression.
string toString(size_t val)
{
import std.conv : to;
return to!string(val);
}
string expr(T, Args...)()
{
size_t tidx;
string[] stack;
pure:
nothrow:
// T[] = T[] op T[]
void arrayOp(string op, T)(T[] res, in T[] a, in T[] b)
in
{
assert(res.length == a.length);
assert(res.length == b.length);
}
@MartinNowak
MartinNowak / dmd.conf
Created February 27, 2013 06:32
dmd.conf
[Environment32]
DFLAGS=-I%@P%/Code/D/DPL/druntime/import -I%@P%/Code/D/DPL/phobos -L-L%@P%/.local/D/lib32
# -L-ldruntime-linux32
[Environment64]
DFLAGS=-I%@P%/Code/D/DPL/druntime/import -I%@P%/Code/D/DPL/phobos -L-L%@P%/.local/D/lib64
# -L-ldruntime-linux64
[dpk]
PREFIX = "~/.local/D"
DEFAULTARGS = "-debug -g -w"
@MartinNowak
MartinNowak / rebuild.sh
Last active December 11, 2015 21:29
DPL rebuild.sh
#!/usr/bin/env zsh
set -e
doclean=1
local makecmd=make
build_repo()
{
if [ $doclean -ne 0 ]; then