Skip to content

Instantly share code, notes, and snippets.

@jeeyoungk
jeeyoungk / gist:1032899
Created June 18, 2011 07:39
Convoluted way to check for balanced parenthesis.
# Author : Jeeyoung Kim
# Convoluted way to check for balanced parenthesis.
L = lambda f: lambda x : f(x + 1)
R = lambda f: lambda x : not x or f(x - 1)
D = {'(':'L', ')':'R'}
while True:
print 'please input sequence of parenthesises, like ()()((, or ((())())'
input = raw_input()
@jeeyoungk
jeeyoungk / venn.html
Created March 19, 2012 16:15
Venn Diagram Experiment
<!doctype html>
<html>
<head>
<title>Venn diagram of order 4</title>
</head>
<body>
<div>Venn Diagram Experiment</div>
<div>Use the controls on the bottom left.</div>
<div id='canvas'></div>
<script src='https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael.js'></script>
#!/usr/bin/env python
# pam_notify.py
# Author : Jeeyoung Kim
# Python script to notify user on login
FROM_ADDRESS = 'admin@example.com'
TO_ADDRESS = 'you@example.com'
def pam_sm_open_session(pamh, flags, args):
try:
from email.mime.text import MIMEText
alert('foo')
hello, world
mysql> CREATE TABLE temp (col1 INT, col2 INT, col3 INT);
Query OK, 0 rows affected (0.02 sec)
mysql>
mysql> INSERT INTO temp (col1, col2, col3) values (1,2,3);
Query OK, 1 row affected (0.01 sec)
mysql> INSERT INTO temp (col1, col2, col3) values (1,3,4);
Query OK, 1 row affected (0.00 sec)
public class Test {
public static void main(String ... args) {
System\u002eout\u002eprintln("hello, world");
}
}
/**
* Permute the given input array, calling callback for each of the
* permutation.
*/
function permute(input, callback) {
var contains = []; // boolean flags.
var permutation = [];
var N = input.length;
for (var i = 0; i < N; i++) {
contains.push(false);
/*bin/mkdir /tmp/crazy 2> /dev/null
javac -d /tmp/crazy $0 `dirname $0`/Main.java
java -cp /tmp/crazy Main "$@"
exit
*/
import java.util.Calendar;
public class Main {
public static void main(String... args) {
System.out.println(Calendar.getInstance().get(Calendar.YEAR));
Last login: Sun Jul 27 01:44:08 on ttys001
jeeyoungk@kundera:~$ /Users/jeeyoungk/Desktop/mathworks_downloads/R2011a_Student_Version/install ; exit;
Preparing installation files ...
Installing ...
Exception in thread "main" com.google.inject.ProvisionException: Guice provision errors:
1) Error in custom provider, java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.mathworks.wizard.WizardModule.provideDisplayProperties(WizardModule.java:61)
while locating com.mathworks.instutil.DisplayProperties
at com.mathworks.wizard.ui.components.ComponentsModule.providePaintStrategy(ComponentsModule.java:72)