Skip to content

Instantly share code, notes, and snippets.

View BrianHicks's full-sized avatar

Brian Hicks BrianHicks

View GitHub Profile
@BrianHicks
BrianHicks / bible.org.coffee
Created February 10, 2012 03:17
Bible.org NET Bible wrapper
# Wrapper for bible.org NET Bible API
# Use must follow copyright statement at http://bible.org/netbiblecopyright
# Code released into the public domain, without warranty
http = require 'http'
get_passage = (passage, callback) ->
passage = encodeURIComponent passage
options =
@BrianHicks
BrianHicks / benchmark.py
Created May 17, 2012 13:11
Benchmark String Building
'test concatenation, substitution, join'
import timeit
DOMAIN = 'http://stackoverflow.com'
QUESTIONS = '/questsions'
def so_q_sub(n):
return '%s%s/%d' % (DOMAIN, QUESTIONS, n)
def so_q_cat(n):
@BrianHicks
BrianHicks / README.md
Created May 22, 2012 15:39
Graph taskwarrior tasks with graphviz

Graph taskwarrior tasks with graphviz

Dependencies

Running

graphdeps produces "deps.png" in the working directory. Just graphdeps will graph all tasks. You can change the default behavior by specifying a more specific query.

@BrianHicks
BrianHicks / uri_resource.py
Created September 21, 2012 14:29
Override URI field in TastyPie
'''
Usage:
class MyResource(CustomURIResource):
class Meta:
queryset = User.objects.all()
resource_name = 'user'
url_field = 'username'
Will make accessible URIs like so:
@BrianHicks
BrianHicks / _compass.rb
Created December 8, 2012 07:59
Improved Compass Rendering for Jekyll
require 'zurb-foundation'
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "_site/static/css"
sass_dir = "_sass"
images_dir = "static/images"
javascripts_dir = "static/js"
@BrianHicks
BrianHicks / .poltergist.yaml
Last active December 12, 2015 03:59
Presentation on Emit
style: swiss.css
@router.node(('bigram',))
def bigrams(msg):
'get bigrams from a document'
prev = None
for word in msg.document.strip().split(' '):
yield (prev, word)
prev = word
@router.node(('bigram', 'frequency'), 'bigrams')
def count_bigrams(msg):
@BrianHicks
BrianHicks / multiple-deps.yaml
Created February 15, 2013 13:50
Extra for my comment on saltstack/salt #3736
State: - pkg [425/1906]
Name: python-dev
Function: installed
Result: False Comment: The following package(s) failed to install/update: python-dev.
Changes: libgomp1: {'new': '4.6.3-1ubuntu5', 'old': ''} libmpfr4: {'new': '3.1.0-3ubuntu2', 'old': ''} libz-dev: {'new': '1', 'old': ''}
gcc-4.6: {'new': '4.6.3-1ubuntu5', 'old': ''} python2.7-dev: {'new': '2.7.3-0ubuntu3.1', 'old': ''} linux-libc-dev: {'new': '3.2.0-37.58', 'old': ''}
cpp-4.6: {'new': '4.6.3-1ubuntu5', 'old': ''} python-dev: {'new': '2.7.3-0ubuntu2', 'old': ''}
gcc: {'new': '4:4.6.3-1ubuntu5', 'old': ''}
@BrianHicks
BrianHicks / profile.yaml
Last active December 14, 2015 00:29
Starting a server on salt-cloud (command was `salt-cloud -l all -p manage-staging manage-staging 2> salt-cloud.log`)
manage-staging:
provider: aws
image: ami-43e2772a
size: m1.small
script: bootstrap-salt-minion
minion:
grains:
staging: True
database: True
media: True
sets!
one(1): True
two(2): True
Join/Or!
one_or_two(1): True
one_or_two(2): True
Intersect/And!
one_but_not_two(1): True