Skip to content

Instantly share code, notes, and snippets.

View benhosmer's full-sized avatar

Ben Hosmer benhosmer

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / d7-varnish-default.vcl
Last active August 29, 2015 14:05
Drupal 7 Varnish default.vcl
# Sample VCL based on VCL created by Four Kitchens, available at
# https://fourkitchens.atlassian.net/wiki/display/TECH/Configure+Varnish+3+for+Drupal+7
/*
* Copyright (c) 2013 Four Kitchens
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
@benhosmer
benhosmer / ps-random-pass.py
Created September 6, 2014 12:34
Generate pseudo-random passwords from a built in word list.
#!/usr/env python
'''
Author: Ben Hosmer
License: Unlicense http://unlicense.org/
Note: This is pseudo-random meaning don't rely on it for high-security!
'''
import random
import os
@benhosmer
benhosmer / settings.php
Created September 11, 2014 14:00
Autoslave module settings.php
// Snippet for configuring the autoslave module in settings.php
// Master is x.x.x.100 and slave is x.x.x.101
$databases['default']['master'] = array (
'database' => 'drupal',
'username' => 'root',
'password' => 'root',
'host' => '192.168.33.100',
'port' => '',
'driver' => 'mysql',
'prefix' => '',
@benhosmer
benhosmer / shellshock.md
Last active August 29, 2015 14:07
bash-shellshock.md

Run this from a prompt

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

And this just to make sure

cd /tmp; env X='() { (a)=>\' bash -c "echo date"; cat echo

Patch old ubuntu

cd ~/

mkdir bash

@benhosmer
benhosmer / chromebook-ovpn.md
Created October 3, 2014 10:45
Generate pk12 for chromebook to connect to openvpn.

openssl pkcs12 -export -in ben-chromebook.crt -inkey ben-chromebook.key -out ben-chromebook.p12