Skip to content

Instantly share code, notes, and snippets.

View taicki's full-sized avatar

Taek Joo Kim taicki

View GitHub Profile
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
sudo apt-get install zlib1g-dev #ubuntu
git clone git://git.kernel.org/pub/scm/git/git.git
cd git
NO_EXPAT=yes NO_OPENSSL=yes NO_CURL=yes make -j4 prefix=~
NO_EXPAT=yes NO_OPENSSL=yes NO_CURL=yes make -j4 prefix=~ install
import SocketServer
class Handler(SocketServer.BaseRequestHandler):
def handle(self):
data = self.request[0].strip()
print self.client_address[0], data
server = SocketServer.UDPServer(("0.0.0.0", 5140), Handler)
@taicki
taicki / installerlang.sh
Created July 8, 2011 20:54
install Erlang on CentOS 5
#!/bin/sh
sudo yum install -y gcc glibc-devel make ncurses-devel openssl-devel autoconf
curl -O https://raw.github.com/dreverri/kerl/master/kerl
chmod a+x kerl
KERL_CONFIGURE_OPTIONS="--enable-dynamic-ssl-libs" ./kerl build R13B04 r13b04
./kerl install r13b04
@taicki
taicki / childmgr.py
Created July 9, 2011 22:20
try to manage child processes in python
import os
import signal
import time
def main():
commands = [
("python", "sample.py"),
("python", "sample.py"),
]
@taicki
taicki / playsound.m
Created July 9, 2011 23:17
copied from somewhere
#import <Cocoa/Cocoa.h>
@interface Delegate : NSObject { }
@end
@implementation Delegate
- (void) sound: (NSSound *) sound didFinishPlaying: (BOOL) aBool
{
[[NSApplication sharedApplication] terminate: nil];
}
import sys
rl = lambda: sys.stdin.readline().strip()
def perm(strl):
if len(strl) == 1:
return [strl]
perms = []
for i in strl:
copied = strl[:]
upstream streamer {
server 192.168.1.139:443;
}
# HTTPS server
#
server {
listen 443;
server_name woodstock;
def paren(n):
if n == 1:
return ['()']
results = paren(n-1)
coms = set()
for i in results:
coms.add('()'+i)
coms.add('('+i+')')
coms.add(i+'()')
return coms
import time
import signal
def main():
d = {}
d["stop"] = False
def sighandler(signum, frame):
print signum, frame
d["stop"] = True