Skip to content

Instantly share code, notes, and snippets.

@davidad
davidad / blog
Created February 13, 2014 19:22
#!/bin/bash
ORIGDIR=`pwd | sed 's/\ /\\ /g'`
cd ~/octopress
URL="http://davidad.github.io/"
function wrs() {
if [[ $2 = "y" ]]; then
L1="set theWindow's active tab index to theTabIndex"
@davidad
davidad / keybase.md
Created March 21, 2014 21:38
My Keybase.io public key.

Keybase proof

I hereby claim:

  • I am davidad on github.
  • I am davidad (https://keybase.io/davidad) on keybase.
  • I have a public key whose fingerprint is 7B5E C0A3 23AB 67CA E75E 9BF6 8FCE 72CF 5859 88D7

To claim this, I am signing this object:

@davidad
davidad / mkOpenResty
Created April 7, 2014 20:18
OpenResty configuration/build on `heroku run bash`
curl -O -L http://downloads.sourceforge.net/sourceforge/pcre/pcre-8.34.tar.gz
curl -O -L http://openresty.org/download/ngx_openresty-1.5.11.1.tar.gz
tar xzf pcre-8.34.tar.gz
tar xzf ngx_openresty-1.5.11.1.tar.gz
cd ngx_openresty-1.5.11.1
export PATH=/sbin:$PATH
./configure --prefix=/app/openresty --with-pcre=/app/pcre-8.34 --with-luajit --with-http_postgres_module --with-file-aio --with-ipv6 --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-pcre-jit --with-http_iconv_module -j2
make
make install
tar czf openresty_build-1.5.11.1-1.tar.gz openresty
%include "os_dependent_stuff.asm"
global fib
global _fib
fib:
_fib:
cmp rdi, 1
jle return_one; if the relationship is "less than or equal", goto return_one
push rdi ; save n
mov rsi, rdi
inc rsi ; rsi now contains n+1
global fib
global _fib
fib:
_fib:
cmp rdi, 1 ; set flags according to value of rdi minus one, i.e., relationship of rdi to 1
jle return_one; if the relationship is "less than or equal", goto return_one
dec rdi ; rdi = rdi - 1
push rdi ; ^ this guy is going to decrement it again, save "n-1" on the stack
call fib ; do call
pop rdi ; restore "n-1" to rdi
#include <stdlib.h>
#include <stdio.h>
extern unsigned long fib(unsigned long);
int main(int argc, char* argv[]) {
if(argc<2) printf("usage: fib_test <integer>\n"), exit(1);
unsigned long input = strtoul(argv[1],NULL,10); // string to unsigned long
printf("fib(%lu) = %lu\n",input,fib(input));
return 0;
Apparently, git + pastebin = gist.github.com...
#!/bin/bash
# Install dependencies
sudo apt-get install ghc6 ghc6-prof ghc6-doc haddock libglut-dev happy alex \
libedit-dev zlib1g-dev checkinstall libghc6-mtl-prof
# Get haskell-platform
wget http://hackage.haskell.org/platform/2009.2.0.2/haskell-platform-2009.2.0.2.tar.gz
tar -xzf haskell-platform-2009.2.0.2.tar.gz
cd haskell-platform-2009.2.0.2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Homoiconic Propagator Networks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
An MMP Mini-Proposal by David Dalrymple
=======================================
============
Who are you?
============
@davidad
davidad / merging.hs
Created November 17, 2009 04:55 — forked from anonymous/merging.hs
{-# LANGUAGE UndecidableInstances, FlexibleInstances #-}
module Main where
import IO
import Control.Concurrent
import Control.Exception
import System.IO.Unsafe
import Data.Ord
class JoinLattice a where