Skip to content

Instantly share code, notes, and snippets.

@fredrick
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
fredrick / README.md
Created Nov 22, 2011
Graylog2 Upstart Jobs
View README.md

#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.

#Usage

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.

#Author

@fredrick
fredrick / FirstSteps.1.md
Created Nov 9, 2011
JavaScript In a "Gist" | Client-side web development
View FirstSteps.1.md

#First Steps

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

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
@fredrick
fredrick / index.html
Created Oct 31, 2011
Bare necessities of an HTML(5) document
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Title</title>
</head>
<body>
<!--Content goes here!-->
</body>
</html>
@fredrick
fredrick / install_django.sh
Created Oct 6, 2011
Installing Django (virgin) in OS X Leopard
View install_django.sh
#!/bin/sh
# In Terminal
cd
curl -O http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
sh ~/setuptools-0.6c11-py2.5.egg
sudo easy_install django
@fredrick
fredrick / optional.py
Created Sep 28, 2011
Optional function arguments in Python
View optional.py
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'))
print(hello('Tony', 'Fred'))
View feed.html
<div class="feed">
<script type="text/javascript">
(function(url, callback) {
jQuery.ajax({
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
dataType: 'json',
success: function(data) {
callback(data.responseData.feed);
}
});
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
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar -zxvf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 \
--with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.8
@fredrick
fredrick / screen.md
Created Sep 14, 2011
GNU Screen Cheat Sheet
View screen.md

#GNU Screen Cheat Sheet

##Basics

  • 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 = 'https://gist.github.com/',
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) {
You can’t perform that action at this time.