Skip to content

Instantly share code, notes, and snippets.

Ming Han Teh minghan

Block or report user

Report or block minghan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3244710
-- Per partition info --
Partition Row count Commit count Frag fixed memory Frag varsized memory Extent_space Free extent_space Nodes
0 25 25 32768 32768 0 0 11,12
2 25 25 32768 32768 0 0 12,11
1 26 26 32768 32768 0 0 21,22
3 24 26 32768 32768 0 0 22,21
View gist:3244683
-- Per partition info --
Partition Row count Commit count Frag fixed memory Frag varsized memory Extent_space Free extent_space Nodes
0 17 41 32768 32768 0 0 11,12
2 15 45 32768 32768 0 0 12,11
4 18 18 32768 32768 0 0 31,32
1 18 42 32768 32768 0 0 21,22
3 14 44 32768 32768 0 0 22,21
5 18 18 32768 32768 0 0 32,3
View EMStart.sh
#!/bin/sh
rmiregistry &
java EventManager &
echo "Started EM"
clean_up()
{
pkill rmiregistry
View gist:1277101
# Tips from http://t2.unl.edu/documentation/graphtool/new-install
mkdir ~/eggs
export PYTHONPATH=$PYTHONPATH:~/eggs
export PATH=$PATH:~/eggs
# echo "export PYTHONPATH=$PYTHONPATH:~/eggs" >> ~/.bashrc
# echo "export PATH=$PATH:~/eggs" >> ~/.bashrc
curl -O http://peak.telecommunity.com/dist/ez_setup.py
@minghan
minghan / multiproc.py
Created Jul 27, 2011
Multiprocessing example
View multiproc.py
from multiprocessing import Pool, JoinableQueue, Manager
# Note that jqueue.task_done() must be called to decrement the count if jqueue.join() is to be used correctly.
import time, os, signal
def handler(signum, frame):
print "signal caught in %d" % os.getpid()
signal.signal(signal.SIGTERM, handler)
View microbookmarklet.js
javascript: var script = document.createElement("script"); script.src="http://www.example.com/random.js"; document.body.appendChild(script); void(0);
@minghan
minghan / underscore.py
Created Jul 13, 2011
Camecase to Underscore lowercase
View underscore.py
import re
def underscore(text):
def repl(m):
return "_" + m.group(0).lower()
return re.sub(r"([A-Z])", repl, text)
print underscore("helloWorld")
View property.py
# Using @property
class Pakrox(object):
def __init__(self):
self._pak = 10
@property
def pak(self):
return self._pak
@minghan
minghan / compile_exec.py
Created Jul 8, 2011
Python Compile and Exec test
View compile_exec.py
# Compile and Exec test
# Just making sure that exec deals with scoping correctly
#
# Note that the compile statement compiles code into bytecode, but does not execute it
# Reference: http://lucumr.pocoo.org/2011/2/1/exec-in-python/
def pakrox2():
print "pakrox2 external"
code = ""
You can’t perform that action at this time.