Skip to content

Instantly share code, notes, and snippets.

View taicki's full-sized avatar

Taek Joo Kim taicki

View GitHub Profile
from itertools import islice
import os
import sys
import subprocess
CMD = "sudo -u hdfs /usr/lib/hadoop/bin/hadoop dfsadmin -report"
def parse(resultstr):
dic = {}
for line in islice(resultstr, 0, 8):
@taicki
taicki / trash
Created December 29, 2011 19:18
Move files to trash in Terminal
#!/usr/bin/env macruby
framework 'Cocoa'
urls = ARGV.map {|a| NSURL.fileURLWithPath(a) }
run = true
complete = lambda {|n, e| run = false }
NSWorkspace.sharedWorkspace.recycleURLs(urls, completionHandler: complete)
rl = NSRunLoop.currentRunLoop
@taicki
taicki / Gemfile
Created December 11, 2011 07:52
a simple script to fix mp3 tags which have euc-kr encoding issues
source "http://rubygems.org"
gem "ruby-mp3info"
gem "taglib-ruby"
((nil . ((ffip-patterns . ("*.scala" "*.py"))) ))
import time
import signal
def main():
d = {}
d["stop"] = False
def sighandler(signum, frame):
print signum, frame
d["stop"] = True
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
upstream streamer {
server 192.168.1.139:443;
}
# HTTPS server
#
server {
listen 443;
server_name woodstock;
import sys
rl = lambda: sys.stdin.readline().strip()
def perm(strl):
if len(strl) == 1:
return [strl]
perms = []
for i in strl:
copied = strl[:]
@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];
}
@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"),
]