Skip to content

Instantly share code, notes, and snippets.

View elee's full-sized avatar

Eric Lee elee

View GitHub Profile
@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 / 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 / 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: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:4544817
Last active December 11, 2015 04:28
var sinon = require('sinon');
var hottap = require('hotttap');
var foo = function(url) {
var resp = hottap.hottap(url);
return resp;
};
foo('http://somewhere/over/the/rainbow');
@elee
elee / gist:6320905
Created August 23, 2013 15:53
Steve Ballmer's Resignation Letter (full)
I am writing to let you know that I will retire as CEO of Microsoft within the next 12 months, after a successor is chosen. There is never a perfect time for this type of transition, but now is the right time. My original thoughts on timing would have had my retirement happen in the middle of our transformation to a devices and services company focused on empowering customers in the activities they value most. We need a CEO who will be here longer term for this new direction. You can read the press release on Microsoft News Center.
This is a time of important transformation for Microsoft. Our new Senior Leadership team is amazing. The strategy we have generated is first class. Our new organization, which is centered on functions and engineering areas, is right for the opportunities and challenges ahead.
Microsoft is an amazing place. I love this company. I love the way we helped invent and popularize computing and the PC. I love the bigness and boldness of our bets. I love our people and their talent and our
@elee
elee / gist:7341776
Created November 6, 2013 18:41
perl spiral quine from perlmonks
#!/usr/bin/perl
$_='
$q ="\ 47"; wh
ile ($ ;=
$z += .5 ){
%c= $r=0;$/ ="";whi le(2
0+ $z>($;+=.05)){$c{int$ _+ 2
6+ 2*($ r+= .0 2) *
s in$ ;}{1 -$_
+1 0+ int $r*c o s
@elee
elee / gist:7851416
Created December 7, 2013 23:41
NextBus API Hilarity
$ curl "http://webservices.nextbus.com/service/publicXMLFeed?command=predictions&a=emery&stopId=5300&routeTag=Hollis"
<?xml version="1.0" encoding="utf-8" ?>
<body copyright="All data copyright Emery-Go-Round 2013.">
<predictions agencyTitle="Emery-Go-Round" routeTitle="Hollis" routeTag="Hollis" stopTitle="MacArthur BART Station" stopTag="bart_o" dirTitleBecauseNoPredictions="to Emeryville">
<message text="Nextbus time will not be accurate due to new vehicles on the road with out the Nextbus equipment. Feel free to call the office at 510-451-3862"/>
</predictions>
</body>
$ : I mean, who doesn't want to make an api call that gives you a phone number to call in an attribute called "text" of a message element
sudo apt-get install openjdk-7-jdk ; sudo update-alternatives --config java ; ps ax | grep backtype.storm | grep -v grep | awk '{print $1}' | xargs kill -9 ; java -version
@elee
elee / wipeout.py
Last active August 29, 2015 14:06
wipe out Zk data
from kazoo.client import KazooClient
zk = KazooClient('mmaster-0:2181,mmaster-1:2181,mmaster-2:2181')
zk.start()
@zk.ChildrenWatch('/')
def watch_children(children):
print('new state: {}'.format('\n'.join(children)))
zk.delete('/marathon', recursive=True)
zk.stop()