Skip to content

Instantly share code, notes, and snippets.

View benhosmer's full-sized avatar

Ben Hosmer benhosmer

View GitHub Profile
@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
<?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 / 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 / gitolite-repo-permissions.sh
Created April 20, 2012 15:26
A shell script to change permissions of the gitolite repositories to make them readable by GitPHP
#!/bin/sh
GITOLITE_REPO_PATH="/home/gitolite/repositories"
GITOLITE_ADMIN_PATH="$GITOLITE_REPO_PATH/gitolite-admin.git"
debug ()
{
echo "[D]: $1" > /dev/null
}
@benhosmer
benhosmer / temp-reading-bmp0895.ino
Created April 20, 2012 15:29
Arduino temperature sensor readings from the BMP0895
/*
A portion of this began as an example sketch from anologReadSerial
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor
This example code is in the public domain.
*/
/* From http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267245927
@benhosmer
benhosmer / 1000-Quantum-Numbers.sh
Created April 29, 2012 09:49
A BASH script to generate 100 random numbers using the Quantum Random Number Generator, and write them to a file.
#!/bin/bash
# This script requires the Quantum Random library https://github.com/lmacken/quantumrandom
# Use pip: pip install quantumrandom http://pypi.python.org/pypi/quantumrandom
for i in {1..100};
do qrandom --int --max 1 --min 1000 >> 100-numbers.txt;
done;
echo "Complete!";
@benhosmer
benhosmer / quantum-random-numbers-to-text-file.py
Created April 29, 2012 10:11
A small example using the Quantum Random Library to generate a user specified number of random numbers and print them to the screen.
import quantumrandom
i = 1
numberofNumbers = input("How many random numbers to you want to generate? ")
lowNumberRange = input("Enter the lowest number in the range: ")
highNumberRange = input("Enter the highest number in the range: ")
print "Generating " + str(numberofNumbers) + " Quantum Random numbers " + \
"in range " + str(lowNumberRange) + " and " + str(highNumberRange)
@benhosmer
benhosmer / server-telnet-node-chat.js
Created May 4, 2012 15:42
A Simple node.js chat server using telent from O'reilly's node up and running.
// A Simple nod.js chat server using telent from O'reilly's node up and running
var net = require('net')
var chatServer = net.createServer()
clientList = []
chatServer.on('connection', function(client) {
client.name = client.remoteAddress + ':' + client.remotePort
@benhosmer
benhosmer / thejavascriptfile.js
Created June 3, 2012 02:11
Drupal Javascript Example File
Drupal.behaviors.myModuleBehavior = function (context) {
//do some fancy stuff
};