Skip to content

Instantly share code, notes, and snippets.

Ben Hosmer benhosmer

Block or report user

Report or block benhosmer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benhosmer
benhosmer / Vagrantfile
Created Jun 7, 2015
Vagrantfile for lemp Drupal
View Vagrantfile
# -*- 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 Feb 12, 2015
Python using elaphe to generate UPC A Barcodes
View pyelapheupcgen.py
#/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
View git-php-webhook.php
<?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
View vagrant-salt.rb
# -*- 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 Oct 3, 2014
Generate pk12 for chromebook to connect to openvpn.
View chromebook-ovpn.md

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

@benhosmer
benhosmer / shellshock.md
Last active Aug 29, 2015
bash-shellshock.md
View 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 Sep 11, 2014
Autoslave module settings.php
View 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 Sep 6, 2014
Generate pseudo-random passwords from a built in word list.
View ps-random-pass.py
#!/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 Aug 29, 2015
Drupal 7 Varnish default.vcl
View d7-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
You can’t perform that action at this time.