Skip to content

Instantly share code, notes, and snippets.

@thom-nic
thom-nic / pom.xml
Created May 28, 2014 02:47
Facebook Android SDK POM for Maven
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.facebook</groupId>
<artifactId>facebook-android-sdk</artifactId>
<packaging>apklib</packaging>
<name>Facebook Android SDK</name>
<version>3.0.1</version>
@thom-nic
thom-nic / keybase.md
Created June 4, 2014 16:13
keybase.io proof of github identity

Keybase proof

I hereby claim:

  • I am thom-nic on github.
  • I am thom_nic (https://keybase.io/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
thom-nic / .gvimrc
Created June 5, 2014 13:53
Vim files
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
thom-nic / scroll.js
Created June 9, 2014 14:05
smooth scroll to element in HTML
/**
* Scroll to the given element on the page
*/
function scrollTo(elem) {
$('html').animate({
scrollTop: $(elem).offset().top
}, 600);
}
@thom-nic
thom-nic / bashup.sh
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
thom-nic / echo.erl
Created February 27, 2011 21:04
Erlang echo script
%%% 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.
-module(echo).
-author('Thom Nichols').
-import(erlang).
@thom-nic
thom-nic / node-builder.js
Created September 26, 2011 16:07
Node builder (DOM) for Javascript
/**
* 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
thom-nic / userContent.css
Created November 2, 2011 13:19
Google Reader CSS tweaks
/* Collapse Google Reader iframe ad frames */
@-moz-document url-prefix(https://www.google.com/reader/),
url-prefix(http://www.google.com/reader/) {
/* 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
thom-nic / rainbows.config.rb
Created February 8, 2012 13:05
Rainbows + AMQP configuration
# 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 "unicorn.pid"
#stderr_path "unicorn.log"
#stdout_path "unicorn.log"
# nuke workers after 30 seconds instead of 60 seconds (the default)
timeout 30