Skip to content

Instantly share code, notes, and snippets.

@duggan
duggan / pre-commit
Last active Dec 19, 2016 — forked from hartfordfive/pre-commit
Git pre-commit hook to validate JSON files
View pre-commit
#!/bin/bash
# Comments:
# 1. You must add execution rights to this file (chmod u+x pre-commit)
# 2. You need to have the 'jq' package installed to parse the json
if [ "$(command -v jq )" == "" ] ; then
echo "jq required for pre-commit hook $0"
exit 1
fi
@duggan
duggan / Vagrantfile
Last active Dec 18, 2015 — forked from WIZARDISHUNGRY/Gemfile
Vagrant (v1.1+) snippet to set VirtualBox guest CPU count to the number of host cores on Linux or OS X
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
if not RUBY_PLATFORM.downcase.include?("mswin")
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpus",
`awk "/^processor/ {++n} END {print n}" /proc/cpuinfo 2> /dev/null || sh -c 'sysctl hw.logicalcpu 2> /dev/null || echo ": 2"' | awk \'{print \$2}\' | cut -d' ' -f2 `.chomp ]
end
end