Skip to content

Instantly share code, notes, and snippets.

View benhosmer's full-sized avatar

Ben Hosmer benhosmer

View GitHub Profile
@benhosmer
benhosmer / classified-e1.md
Last active August 29, 2015 14:05
Classified: E1 Experimental Pale Ale

Classified: E1 Expiremental Brew

Ingredients Time Notes
Crystal 80L .5 lb. 60 Mash for 45 minutes at 170
6.6 lb. Briess LME 60
.5 lb. Corn Suger 60
Simcoe 1oz. 60
Centennial 1oz. 20
Whirlfloc 10
@benhosmer
benhosmer / classified-e2.md
Last active August 29, 2015 14:05
Classified: E2 Experimental Pale Ale

Classified: E2 Expiremental Brew

Ingredients Time Notes
Crystal 80L .5 lb. 60 Mash for 45 minutes at 170
6.6 lb. Briess LME 60
Centennial 1oz. 60
Columbus 2oz. 20
Whirlfloc 10
Simcoe 1oz. 0
@benhosmer
benhosmer / local-devl-snippet-settings.php
Created May 8, 2014 11:18
Drupal local development settings.php
$conf = array(
'environment_indicator_enabled' => 1,
'environment_indicator_position' => 'left',
'environment_indicator_margin' => 1,
'environment_indicator_text' => 'LOCAL DEVELOPMENT',
'environment_indicator_color' => '#21d00c',
'environment_indicator_suppress_pages' => 'imagecrop/*',
'reroute_email_enable' => 1,
'reroute_email_address' => 'no-reply@localhost.dev',
'reroute_email_enable_message' => 1,
@benhosmer
benhosmer / date-to-epoch.py
Created March 17, 2014 11:12
Python script to convert a date to epoch time.
hiredate= '1981-06-03'
pattern = '%Y-%m-%d'
epoch = int(time.mktime(time.strptime(hiredate, pattern)))
print epoch
360388800
@benhosmer
benhosmer / svn-to-git-authors-gen.sh
Created February 24, 2014 13:01
Create an SVN authors file to convert svn repos to git.
#!/usr/bin/env bash
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
echo "${author} = NAME <USER@DOMAIN>";
done
@benhosmer
benhosmer / dummy-file-gen.py
Created February 13, 2014 15:30
Generate dummy files with different modification times.
#!/usr/bin/env python
import time
directory = '/tmp/file_test/'
file_extension = '.gz'
for x in range(5):
filestamp = time.strftime('%Y-%m-%d-%I:%M:%S')
with open(directory + filestamp + file_extension, 'w') as dummy:
@benhosmer
benhosmer / atrium_project_case_migration.sql
Created October 16, 2013 19:19
Move cases within OpenAtrium to a different group.
UPDATE casetracker_case SET pid='NEWPROJECTNID' WHERE pid='OLDPROJECTNID';
UPDATE og_ancestry SET group_nid='OLDGROUPNID' WHERE nid in ('CASENODEID', 'OTHERCASENODEID');
@benhosmer
benhosmer / populate.yaml
Created September 18, 2013 20:04
Populate a jinja variable in a configuration file.
/srv/salt/populate/init.sls:
{% set host_name = grains['host'] -%}
testfile:
file:
- managed
- name: /home/vagrant/testfile
- source: salt://populate/testfile
- template: jinja
- defaults:
@benhosmer
benhosmer / simple-grid.py
Created September 9, 2013 17:31
Create a simple grid and print it properly in python.
#!/usr/bin/env python
board = [ ['-'] *3 for i in range(3) ]
for i, line in enumerate(board):
for char in line:
print char,
print
@benhosmer
benhosmer / disable_comments.sql
Created August 6, 2013 18:37
Mass disable comments for existing Drupal nodes. Credit: https://drupal.org/node/103064#comment-4922950
UPDATE `node` SET `comment` = '2' WHERE `type` = 'toolkit';
UPDATE node_revision SET comment=2 WHERE nid IN (SELECT nid FROM node WHERE node.type='toolkit');