This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |