Skip to content

Instantly share code, notes, and snippets.

@duggan
duggan / Vagrantfile
Last active December 18, 2015 11:09 — 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
# -*- 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
@duggan
duggan / pre-commit
Last active December 19, 2016 15:32 — forked from hartfordfive/pre-commit
Git pre-commit hook to validate JSON files
#!/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