Skip to content

Instantly share code, notes, and snippets.

@ludwig
ludwig / lisp.c
Created April 5, 2014 21:47 — forked from sanxiyn/lisp.c
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
M[16],X=16,W,k;main(){T(system("stty cbreak")
);puts(W&1?"WIN":"LOSE");}K[]={2,3,1};s(f,d,i
,j,l,P){for(i=4;i--;)for(j=k=l=0;k<4;)j<4?P=M
[w(d,i,j++)],W|=P>>11,l*P&&(f?M[w(d,i,k)]=l<<
(l==P):0,k++),l=l?P?l-P?P:0:l:P:(f?M[w(d,i,k)
]=l:0,++k,W|=2*!l,l=0);}w(d,i,j){return d?w(d
-1,j,3-i):4*i+j;}T(i){for(i=X+rand()%X;M[i%X]
*i;i--);i?M[i%X]=2<<rand()%2:0;for(W=i=0;i<4;
)s(0,i++);for(i=X,puts("\e[2J\e[H");i--;i%4||
puts(""))printf(M[i]?"%4d|":" |",M[i]);W-2
@ludwig
ludwig / foo.log
Created April 11, 2014 17:42 — forked from ibeex/foo.log
A warning occurred (42 apples)
An error occurred
@ludwig
ludwig / httpd.conf
Last active August 29, 2015 14:00
Flask app on WebFaction
# File /home/ludwig/webapps/flask/apache2/conf/httpd.conf
ServerRoot "/home/ludwig/webapps/flask/apache2"
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule wsgi_module modules/mod_wsgi.so
import wave, struct, sys
from math import pow, sin
samples = 100000
terms = 50
normalizer = 32768/1.5
weier = wave.open('weierstrass.wav', 'w')
weier.setparams((1, 2, 44100, 0, 'NONE', 'not compressed'))
print "Progress (%):",
for i in range(samples):
x = float(1000*i)/samples
# A guide to prevent pain and suffering while upgrading to OS X Mavericks
# This will vary greatly depending on system set up, so read the instructions carefully
# Back up Virtulenvs
####################
# Very important!
# For each virtualenv you have, run "pip freeze > requirements.txt" while in the activated virtualenv
# in order to prevent loss of dependencies during the upgrade.
from flask import Flask, request, session
from sqlalchemy import create_engine, Table, MetaData
from sqlalchemy.orm import mapper, relationship, sessionmaker, scoped_session
from sqlalchemy.sql import select
app = Flask(__name__)
engine = create_engine('postgresql+psycopg2://kamal@localhost/clinic_dev')
metadata = MetaData(bind=engine)
DBSession = scoped_session(sessionmaker(bind=engine))
# Python OAuth example
import evernote.edam.userstore.constants as UserStoreConstants
import evernote.edam.type.ttypes as Types
from evernote.api.client import EvernoteClient
##
# Helper function to turn query string parameters into a
# Python dictionary
##

Keybase proof

I hereby claim:

  • I am ludwig on github.
  • I am ludwig1024 (https://keybase.io/ludwig1024) on keybase.
  • I have a public key whose fingerprint is 4D40 1C62 1AB8 C1D7 5C93 F20D 62F5 EA1C BD5C 7771

To claim this, I am signing this object:

# Inser this snippet into your ~/.bash_profile
# Set up the GPG Agent
# http://fvue.nl/wiki/Debian_4.0:_Installing_gpg-agent
if [ -f ${HOME}/.gpg-agent-info ] && \
kill -0 $(cut -d: -f 2 ${HOME}/.gpg-agent-info)
then
# Yes, '.gpg-agent-info' points to valid gpg-agent process;
# Indicate gpg-agent process
GPG_AGENT_INFO=$(cat ${HOME}/.gpg-agent-info | cut -c 16-)