Skip to content

Instantly share code, notes, and snippets.

View benhosmer's full-sized avatar

Ben Hosmer benhosmer

View GitHub Profile
@benhosmer
benhosmer / Vagrantfile
Created June 7, 2015 01:27
Vagrantfile for lemp Drupal
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@benhosmer
benhosmer / pyelapheupcgen.py
Created February 12, 2015 00:16
Python using elaphe to generate UPC A Barcodes
#/usr/bin/env python
# Install elaphe first
# pip install elaphe
from elaphe.upc import UpcA
upc_a = UpcA()
# Just a simple dictionary of numbers. If I remember right, I had to use UPC A because they had the number of characters I needed
<?php
/**
* This script is for easily deploying updates to Github repos to your local server. It will automatically git clone or
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below).
*
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/
*
* INSTRUCTIONS:
* 1. Edit the variables below
* 2. Upload this script to your server somewhere it can be publicly accessed
@benhosmer
benhosmer / vagrant-salt.rb
Created January 13, 2015 14:40
Vagrant-SALT
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@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

@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 / 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 / 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 / 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