Skip to content

Instantly share code, notes, and snippets.

@desertmonad
desertmonad / 32.asm
Last active November 26, 2018 13:00 — forked from FiloSottile/32.asm
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The .data section is for storing and naming constants.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
section .data
msg: db "Hello world!", 10
.len: equ $ - msg
@desertmonad
desertmonad / load_store_funcs
Created August 17, 2013 19:45
Some helper functions to save a pwd and load it back later. It assumes you have a directory called .dirs in your home directory.
function store {
echo $PWD > ~/.dirs/$1
}
function load {
if [ -f ~/.dirs/$1 ]
then
cd `cat ~/.dirs/$1`
else
echo "$1 not found"
@desertmonad
desertmonad / gahelloworld.py
Created April 4, 2012 06:35
helloworld genetic algorithm in python
from collections import namedtuple
from operator import itemgetter
import string
import random
GA_POPSIZE = 1024 #ga population size
GA_MAXITER = 200 #maximum iterations
GA_ELITRATE = 0.2 #elitism rate (varname [sic])
GA_MUTATIONRATE = 0.25
@desertmonad
desertmonad / gahelloworld.cpp
Created April 2, 2012 23:40
helloworld genetic algorithm in cpp
//taken verbatim (exluding the first four lines ) from
// http://www.generation5.org/content/2003/data/gahelloworld.cpp
// see http://www.generation5.org/content/2003/gahelloworld.asp
//
#pragma warning(disable:4786) // disable debug warning
#include <iostream> // for cout etc.
#include <vector> // for vector class
#include <string> // for string class
#include <algorithm> // for sort algorithm
@desertmonad
desertmonad / hack.sh
Created April 2, 2012 16:05 — forked from erikh/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/2284668/hack.sh | sh