Skip to content

Instantly share code, notes, and snippets.

fredrick / couchdb.conf
Created Nov 28, 2011 — forked from kowsik/couchdb.conf
Upstart script for CouchDB
View couchdb.conf
# Upstart file at /etc/init/couchdb.conf
# CouchDB
start on runlevel [2345]
stop on runlevel [06]
pre-start script
chown -R couchdb /usr/local/etc/couchdb
chown -R couchdb /usr/local/lib/couchdb
chown -R couchdb /usr/local/var/log/couchdb
fredrick /
Created Nov 22, 2011
Graylog2 Upstart Jobs

#Graylog2 Upstart

A basic set of Upstart jobs to get Graylog2 up and running quickly. Assumes MongoDB and Graylog2 installed in /opt/. Tested on Ubuntu Server 10.04 LTS, MongoDB 2.0.0, graylog2-server-0.9.5p1, and graylog2-web-interface-0.9.5p2.


Place job definitions in /etc/init/ and then use service [job] [command] to start/stop/restart/status the services manually. On boot, the services flow into each other, only starting if dependent services have started. For more on controlling jobs or Upstart in general (a replacement for System-V init), see the cookbook.


fredrick /
Created Nov 9, 2011
JavaScript In a "Gist" | Client-side web development

#First Steps

##Development environment JavaScript is most commonly added to HTML documents as either an embedded or external script.

<!DOCTYPE html>
    <meta charset="utf-8" />
fredrick / index.html
Created Oct 31, 2011
Bare necessities of an HTML(5) document
View index.html
<!DOCTYPE html>
<meta charset="utf-8" />
<!--Content goes here!-->
fredrick /
Created Oct 6, 2011
Installing Django (virgin) in OS X Leopard
# In Terminal
curl -O
sh ~/setuptools-0.6c11-py2.5.egg
sudo easy_install django
fredrick /
Created Sep 28, 2011
Optional function arguments in Python
def hello(f, k=None):
@param f is required
@param k is optional
if (k == None): return '%s, hello world!' % f
else: return 'Hello %s!, said %s' % (f, k)
print(hello('Tony', 'Fred'))
View feed.html
<div class="feed">
<script type="text/javascript">
(function(url, callback) {
url: document.location.protocol + '//' + encodeURIComponent(url),
dataType: 'json',
success: function(data) {
View gist:1226653
# the rest of this snippet assumes installation of libxml 2.7.8. YMMV.
brew install libxml2
brew link libxml2
# install libxslt from source
tar -zxvf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 \
fredrick /
Created Sep 14, 2011
GNU Screen Cheat Sheet

#GNU Screen Cheat Sheet


  • ctrl a c -> cre­ate new win­dow
  • ctrl a A -> set win­dow name
  • ctrl a w -> show all win­dow
  • ctrl a 1|2|3|… -> switch to win­dow n
  • ctrl a " -> choose win­dow
  • ctrl a ctrl a -> switch between win­dow
  • ctrl a d -> detach win­dow
View tumblrGists.js
var gistPrefix = '',
cachedWrite = document.write,
body = $('body'),
gists = $('p.gist').map(function(n, p) {
p = $(p);
var a = $('a', p),
href = a.attr('href');
if (a.length && href.indexOf(gistPrefix) == 0) {