Skip to content

Instantly share code, notes, and snippets.

@fin
fin / backuptweets.rb
Created February 1, 2012 00:17
lazy twitter backup script
grep -m 1 * | grep -v ']}'
require 'rubygems'
require 'twitter'
require 'json'
username = "fin"
last_id = nil
page = 1
numberoftweets = 0
savedtweets = 0
@fin
fin / compare-followers.py
Created October 18, 2011 11:09
should i retweet this?
import requests # pip install requests
import json
USER_1 = 'U1'
USER_2 = 'U2'
def get_user_followers(u):
x = json.loads(requests.get('http://api.twitter.com/1/followers/ids.json', params={'screen_name': u}).content)
return set(x)
@fin
fin / upstream-preconnect.diff
Created August 24, 2011 11:38
upstream preconnect patch for nginx 1.0.5
diff --git a/src/event/ngx_event_connect.h b/src/event/ngx_event_connect.h
index d64f1bb..f067830 100644
--- a/src/event/ngx_event_connect.h
+++ b/src/event/ngx_event_connect.h
@@ -24,6 +24,7 @@ typedef ngx_int_t (*ngx_event_get_peer_pt)(ngx_peer_connection_t *pc,
void *data);
typedef void (*ngx_event_free_peer_pt)(ngx_peer_connection_t *pc, void *data,
ngx_uint_t state);
+typedef void (*ngx_event_preconnect_pt)(void *pc, void *data);/* actually: ngx_http_request_t *r, ngx_http_upstream_t *u */
#if (NGX_SSL)
@fin
fin / upstream-preconnect.diff
Created August 24, 2011 11:38
upstream preconnect patch for nginx 1.0.5
diff --git a/src/event/ngx_event_connect.h b/src/event/ngx_event_connect.h
index d64f1bb..f067830 100644
--- a/src/event/ngx_event_connect.h
+++ b/src/event/ngx_event_connect.h
@@ -24,6 +24,7 @@ typedef ngx_int_t (*ngx_event_get_peer_pt)(ngx_peer_connection_t *pc,
void *data);
typedef void (*ngx_event_free_peer_pt)(ngx_peer_connection_t *pc, void *data,
ngx_uint_t state);
+typedef void (*ngx_event_preconnect_pt)(void *pc, void *data);/* actually: ngx_http_request_t *r, ngx_http_upstream_t *u */
#if (NGX_SSL)
@fin
fin / haml_watch.rb
Created July 17, 2011 23:02
haml directory watcher
#!/usr/bin/ruby1.8
# Script to watch a directory for any changes to a haml file
# and compile it.
#
# USAGE: ruby haml_watch.rb <directory_to_watch>
#
# Original by Blake Smith / http://blakesmith.github.com/2010/09/05/haml-directory-watcher.html
# Modifications by fin / http://fin.io
#