Skip to content

Instantly share code, notes, and snippets.

Avatar

Dustin Norlander dustismo

View GitHub Profile
@dustismo
dustismo / gist:6203329
Last active Jul 5, 2020
How to install leveldb on ubuntu
View gist:6203329
sudo apt-get install libsnappy-dev
wget https://leveldb.googlecode.com/files/leveldb-1.9.0.tar.gz
tar -xzf leveldb-1.9.0.tar.gz
cd leveldb-1.9.0
make
sudo mv libleveldb.* /usr/local/lib
cd include
sudo cp -R leveldb /usr/local/include
@dustismo
dustismo / gist:5986631
Created Jul 12, 2013
How to have a clean exit from golang
View gist:5986631
killchan := make(chan os.Signal, 2)
signal.Notify(killchan, os.Interrupt, syscall.SIGTERM)
// wait for kill signal
<- killchan
log.Println("Kill sig!")
//do clean up
//now exit
os.Exit(0)
@dustismo
dustismo / gist:2891354
Created Jun 7, 2012
Install ZeroMQ java on ubuntu
View gist:2891354
sudo add-apt-repository ppa:chris-lea/zeromq
sudo add-apt-repository ppa:chris-lea/libpgm
sudo apt-get update
sudo apt-get install libzmq-dev libtool autoconf automake dpkg-dev debhelper libpgm-dev
sudo wget https://github.com/zeromq/jzmq/tarball/master
sudo tar -xzf master
sudo rm master
sudo cd zeromq*
sudo automake --add-missing
sudo autoreconf
@dustismo
dustismo / gist:1215167
Created Sep 13, 2011
Convert Scribe oauth request to a HttpUriRequest
View gist:1215167
OAuthRequest oauthrequest = new OAuthRequest(Verb.GET, "https://api.twitter.com/1/account/verify_credentials.xml");
service.signRequest(accessToken, oauthrequest);
//now convert request to httpclient request.
DefaultHttpClient client = new DefaultHttpClient();
HttpUriRequest request = null;
if (oauthrequest.getVerb() == Verb.GET) {
@dustismo
dustismo / gist:1184051
Created Aug 31, 2011
javascript ISO date parser
View gist:1184051
/**
* Parses an iso date.
*
* works with most (all?) iso format variations
* 2011-04-25T20:59:59.999-07:00
* 2011-04-25T20:59:59+07:00
* 2011-04-25T20:59:59Z
*
*/
Trendrr.parseISODate = function(string) {
View gist:1174012
public class RedisQueue {
protected Log log = LogFactory.getLog(RedisQueue.class);
JedisPool pool = new JedisPool(new JedisPoolConfig(), "localhost");
String queueName = "test";
boolean lifo = false;
//how long to keep keys around to verify uniqueness.
//default to 2 hours
You can’t perform that action at this time.