Skip to content

Instantly share code, notes, and snippets.

View elee's full-sized avatar

Eric Lee elee

View GitHub Profile
@elee
elee / gist:3842533
Created October 5, 2012 21:29
node-jscoverage configure error
$ echo $USER
eric.lee
$ uname -a
Darwin sf4229.et.local 11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64
sf4229:node-jscoverage eric.lee$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ ./configure
@elee
elee / gist:3715649
Created September 13, 2012 16:40
after installing from postgresql-9.1.5-1-osx.dmg
$ psql
dyld: Library not loaded: @loader_path/../lib/libssl.dylib
Referenced from: /usr/lib/libpq.5.dylib
Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later, but libssl.0.9.8.dylib provides version 0.9.8
Trace/BPT trap: 5
$ uname -a
Darwin sf4229.et.local 11.4.2 Darwin Kernel Version 11.4.2: Wed May 30 20:13:51 PDT 2012; root:xnu-1699.31.2~1/RELEASE_X86_64 x86_64
$
@elee
elee / gist:3708107
Created September 12, 2012 16:58
kafka-server-start.sh classpath issue
$ bin/kafka-server-start.sh config/server.properties
Exception in thread "main" java.lang.NoClassDefFoundError: scala/ScalaObject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
@elee
elee / example_json_call.py
Created February 11, 2012 00:01
MetroTransit API example
import urllib2
import json
from pprint import pprint
stop_id = 1200
pprint(json.load(urllib2.urlopen('http://svc.metrotransit.org/NexTrip/%s?format=json' % stop_id)))
@elee
elee / foo.pl
Created December 8, 2011 04:55
fixed
use strict;
use warnings;
use diagnostics;
use feature qw(say);
my @arr = grep { $_ % 2 == 0 } 1..10;
my $name = 'slim shady';
bar(\@arr,$name);
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Didea.launcher.port=7532 -Didea.launcher.bin.path=/Applications/IntelliJ IDEA 10 CE.app/bin -Dfile.encoding=UTF-8 -classpath /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/alt-string.jar:/
function [vega] = calculate_vega(S,K,r,T,sigma,N,q,option_parity,option_type)
vol_change = 0.01;
% change constantly volatility inputs, recalculate option prices
price_difference = priceit_(S,K,r,T,sigma+vol_change,N,q,option_parity,option_type) ...
- priceit_(S,K,r,T,sigma-vol_change,N,q,option_parity,option_type);
% take changes in option prices and divide by twice volatility difference
vega = price_difference / (2 * vol_change);
end
GIRUGAMESH:~ $ python -c 'import sys; print "\n".join(["%s %s" % (i, v) for i, v in enumerate(sys.path)])'
import fnmatch
import os
coredir = "/Users/cwj/Dropbox/Needle/corecheck/test"
histfile = "/Users/cwj/Dropbox/Needle/corecheck/corehist.txt"
cores = [file for file in os.listdir(coredir) if fnmatch.fnmatch(file, 'core.*')]
if os.path.exists(histfile):
with open(histfile, 'w') as f:
import os
import fnmatch
import re
coredir = '/etc/sv/core'
# with fnmatch
cores = [file for file in os.listdir(coredir) if fnmatch.fnmatch(file, 'core.*')]
# with re.compile