Skip to content

Instantly share code, notes, and snippets.

View lefant's full-sized avatar

Fabian Linzberger lefant

View GitHub Profile
-module(ls).
-compile(export_all).
start() ->
code:add_patha(".."),
Params = [{name_split, ["foo", "bar", "baz"]}],
Ctx = prepare_ctx(Params),
Output = mustache:render(ls, "ls.mustache", Ctx),
io:format(Output, []).
@lefant
lefant / pretty_config.erl
Last active June 22, 2020 08:49
a little escript snippet to pretty print erlang config, using the erl_syntax module
#!/usr/bin/env escript
%% -*- erlang -*-
%% * slurp in terms using inlined version of kernels file:consult/1
%% * convert to abstract syntax tree
%% * annotate all tuples
%% * pretty print using a hook to prefix the annotated nodes with newline
main([]) ->
io:format("%% -*-erlang-*-~n"),
%%% ch2
%%%
%%% consistent hashing of static partitions of keys onto a dynamic
%%% list of members with weights
-module(ch2).
%% api
-export([partition_ring/1,
select/2
]).
#!/bin/sh
. /etc/rc.conf
# leshaper, based on the fabulous wondershaper:
# Set the following values to somewhat less than your actual download
# and uplink speed. In kilobits. Also set the device that is to be shaped.
@lefant
lefant / eapplication.erl
Created July 30, 2013 14:41
sort erlang/otp applications into an order suitable for starting while keeping dependencies satisfied
-module(eapplication).
-export([deps_order/1]).
deps_order(App) ->
G = digraph:new(),
add_app_and_deps(G, [App], []),
L = lists:reverse(digraph_utils:topsort(G)),
digraph:delete(G),
L.
@lefant
lefant / gist:685e187725bb6753921a
Created November 26, 2014 14:04
keybase.io proof of identity for https://keybase.io/lefant
### Keybase proof
I hereby claim:
* I am lefant on github.
* I am lefant (https://keybase.io/lefant) on keybase.
* I have a public key whose fingerprint is F91F 8B6E 45C8 FB52 460E 94D2 1E9F 45FB 5319 2932
To claim this, I am signing this object:
@lefant
lefant / gist:48f322e3b106e90ce507
Last active August 29, 2015 14:17
patch Mocha.jl mnist.jl example to use cpu backend
index dd2a40f..98458e3 100644
--- a/examples/mnist/mnist.jl
+++ b/examples/mnist/mnist.jl
@@ -1,7 +1,7 @@
#ENV["MOCHA_USE_NATIVE_EXT"] = "true"
#ENV["OMP_NUM_THREADS"] = 1
#blas_set_num_threads(1)
-ENV["MOCHA_USE_CUDA"] = "true"
+#ENV["MOCHA_USE_CUDA"] = "true"
@lefant
lefant / gist:0b6d504813eadee74ade
Created September 29, 2015 11:40
./node_modules/.bin/electron-rebuild failing...
(distcache)fabian@wai:~/git/boxenite/menubar-app-osx/ (master) $ ./node_modules/.bin/electron-rebuild
> fsevents@1.0.0 install /Users/fabian/git/boxenite/menubar-app-osx/node_modules/chokidar/node_modules/fsevents
> node-pre-gyp install --fallback-to-build
Unsupported target version: 0.28.3
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: Unsupported target version: 0.28.3
node-pre-gyp ERR! stack at get_runtime_abi (/Users/fabian/git/boxenite/menubar-app-osx/node_modules/chokidar/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/ver
#put in ~/.unison/boxenite.prf
root = /Users/fabian/boxenite
root = ssh://lefant@boxenite.lefant.net//home/lefant/boxenite
logfile = /Users/fabian/.unison/unison.log
auto = true
batch = true
#debug = all