Skip to content

Instantly share code, notes, and snippets.

@leegao
leegao / Rationale.md
Created July 9, 2011 02:30
JIT for dummies: JIT compiling RPN in python

If you don't care about the explanation, scroll down to find the code, it's 50 some odd lines and written by someone who doesn't know any better. You have been warned.

What it does

This is a very simple proof of concept jitting RPN calculator implemented in python. Basically, it takes the source code, tokenizes it via whitespace, and asks itself one simple question: am I looking at a number or not?

First, let's talk about the underlying program flow. Pretend that you are a shoe connoisseur with a tiny desk. You may only have two individual shoes on that desk at any one time, but should you ever purchase a new one or get harassed by an unruly shoe salesman without realizing that you have the power to say no (or even maybe?), you can always sweep aside one of the two shoes on the desk (the one on the right, because you're a lefty and you feel that the left side is always superior) onto the messy floor, put the other shoe on the right hand side, and then place your newly acquired shoe in

@wardbekker
wardbekker / .erlang
Created August 8, 2011 06:41
Autoloading of modules
%% autoload all modules that are in the code:path() and reside in the user directory
%% put in ~/.erlang
[code:ensure_loaded(list_to_atom(filename:rootname(filename:basename(F))))
|| P <- lists:filter(fun(Path) -> string:str(Path, os:getenv("USER")) > 0 end, code:get_path()), F <- filelib:wildcard(P ++ "/*.beam")].
@codeforkjeff
codeforkjeff / solarize.sh
Created November 27, 2011 06:43
shell script for setting gnome-terminal color palette to use Solarized theme
#!/bin/sh
#
# Shell script that configures gnome-terminal to use solarized theme
# colors. Written for Ubuntu 11.10, untested on anything else.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Adapted from these sources:
# https://gist.github.com/1280177
# http://xorcode.com/guides/solarized-vim-eclipse-ubuntu/
@paraboul
paraboul / command line
Created March 14, 2012 16:03
JavaScript + C Preprocessor
/usr/bin/cpp -P -undef -Wundef -std=c99 -nostdinc -Wtrigraphs -fdollars-in-identifiers -C < foo.js
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ashleyw
ashleyw / gist:2471449
Created April 23, 2012 14:56
Building mruby w/ Emscripten
make -C mrblib --no-print-directory CC=/Users/ashley/Developer/emscripten/emcc LL=/Users/ashley/Developer/emscripten/emcc
make -C ../tools/mrbc --no-print-directory CC=/Users/ashley/Developer/emscripten/emcc LL=/Users/ashley/Developer/emscripten/emcc
/Users/ashley/Developer/emscripten/emcc -Wall -Werror-implicit-function-declaration -g -MMD -I../../src -I../../src/../include -c ../../src/../tools/mrbc/mrbc.c -o ../../src/../tools/mrbc/mrbc.o
clang: warning: argument unused during compilation: '-nostdinc++'
/Users/ashley/Developer/emscripten/emcc -Wall -Werror-implicit-function-declaration -g -MMD -I../../src -I../../src/../include -c ../../src/array.c -o ../../src/array.o
clang: warning: argument unused during compilation: '-nostdinc++'
../../src/array.c:922:9: warning: variable 'times' is uninitialized when used here [-Wuninitialized]
while(times--) {
^~~~~
../../src/array.c:916:16: note: initialize the variable 'times' to silence this warning
@danparsons
danparsons / gist:3195652
Created July 29, 2012 01:46
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet
@jordanwade90
jordanwade90 / Slide
Created April 28, 2014 22:43
Use acme to switch between “slides” (actually just text files) in a directory. Blatantly stolen from Russ Cox (http://research.swtch.com/acme).
#!/usr/local/plan9/bin/rc
. /usr/local/plan9/lib/acme.rc
winname `{pwd}^/$1
winctl clean
winctl get