Skip to content

Instantly share code, notes, and snippets.

thom-nic / pom.xml
Created May 28, 2014 02:47
Facebook Android SDK POM for Maven
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""
<name>Facebook Android SDK</name>
thom-nic /
Created June 4, 2014 16:13 proof of github identity

Keybase proof

I hereby claim:

  • I am thom-nic on github.
  • I am thom_nic ( on keybase.
  • I have a public key whose fingerprint is 66D4 6F49 8A5A CF50 61DD 028A F60F F0BE 93E2 E646

To claim this, I am signing this object:

thom-nic / .gvimrc
Created June 5, 2014 13:53
Vim files
View .gvimrc
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
source ~/.vimrc
behave mswin
set diffexpr=MyDiff()
function MyDiff()
let opt = ''
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
thom-nic / scroll.js
Created June 9, 2014 14:05
smooth scroll to element in HTML
View scroll.js
* Scroll to the given element on the page
function scrollTo(elem) {
scrollTop: $(elem).offset().top
}, 600);
thom-nic /
Created September 26, 2014 00:50
Mac bash upgrade to mitigate the Shellshock exploit
# shellshock upgrade & patch for Mac OSX
# OSX ships with a horribly old version of bash (3.2) which is vulnerable to
# the Shellshock exploit (CVE-2014-6271)
# We use homebrew to get a recent version of bash, then symlink it to
# /bin/bash and /bin/sh (because sh is really bash)
# Use this to see if you're vulnerable
# env X="() { :;} ; echo vulnerable" /bin/bash -c "echo testing"
brew update && brew install bash
import Queue as _oldQueue
import heapq
from time import mktime, time as _time
class PriorityQueue(_oldQueue.PriorityQueue):
This class extends Python's Queue.PriorityQueue by allowing it to
evict lower priority items in order to make room. This avoids a
starvation problem where low-priority items fill the queue and prevent
a high-priority item from being inserted.
thom-nic / echo.erl
Created February 27, 2011 21:04
Erlang echo script
View echo.erl
%%% Sends a message back & forth
%%% Author: Thom Nichols
%%% Remote server communication demo.
%%% Use start_listener/1 to register a listener on a remote or local node.
%%% use send/2 to send a messge to a node and listen for its response.
-author('Thom Nichols').
thom-nic / node-builder.js
Created September 26, 2011 16:07
Node builder (DOM) for Javascript
View node-builder.js
* Node builder. Call like:
* $n('div',{class:'top'},'inner text') // or:
* $n('div',{class:'top'},[$n('p',{},'nested element'])
$n= function(e,attrs,inner) {
if(typeof(e)=='string') e = document.createElement(e);
if (attrs) for (var k in attrs) e.setAttribute(k,attrs[k]);
if (inner) {
if (typeof(inner)=='string') e.textContent = inner;
thom-nic / userContent.css
Created November 2, 2011 13:19
Google Reader CSS tweaks
View userContent.css
/* Collapse Google Reader iframe ad frames */
@-moz-document url-prefix(,
url-prefix( {
/* Make the search bar take up less vertical space */
#top-bar { height: 44px !important; }
#search { padding: 8px 0 !important; }
/* make the 'subscribe' bar take up less vertical space */
#viewer-header, #lhn-add-subscription-section { height: 42px !important; }
/* Right panel */
thom-nic / rainbows.config.rb
Created February 8, 2012 13:05
Rainbows + AMQP configuration
View rainbows.config.rb
# run with rainbows -c rainbows.config.rb
require 'rainbows'
listen 8888 # by default Unicorn listens on port 8080
worker_processes 9 # this should be >= nr_cpus
pid ""
#stderr_path "unicorn.log"
#stdout_path "unicorn.log"
# nuke workers after 30 seconds instead of 60 seconds (the default)
timeout 30