Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am lordgaav on github.
* I am lord_gaav (https://keybase.io/lord_gaav) on keybase.
* I have a public key whose fingerprint is E30F 3470 BB50 02FA 5BB1 3D40 3D5B 72B1 CD9C 0E84
To claim this, I am signing this object:
@LordGaav
LordGaav / install.sh
Last active December 19, 2015 18:19
Opscode Chef install.sh fixed for Debian Wheezy
#!/bin/bash
# This is the current stable release to default to, with Omnibus patch level (e.g. 10.12.0-1)
# Note that the chef template downloads 'x.y.z' not 'x.y.z-r' which should be a duplicate of the latest -r
use_shell=0
prerelease="false"
# Check whether a command exists - returns 0 if it does, 1 if it does not
exists() {
@LordGaav
LordGaav / gist:4708566
Created February 4, 2013 18:32
Quickly pretty print + syntax highlight JSON
<command with JSON output on stdout> | python -m json.tool | pygmentize -l javascript
@LordGaav
LordGaav / gist:4674198
Last active August 21, 2017 19:01
Ugly Python hack to make SSL work properly with broken SSL servers and Ubuntu 12.04
try:
# Ugly hack to force SSLv3 and avoid
# urllib2.URLError: <urlopen error [Errno 1] _ssl.c:504: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error>
import _ssl
_ssl.PROTOCOL_SSLv23 = _ssl.PROTOCOL_TLSv1
except:
pass
@LordGaav
LordGaav / post-commit
Created June 19, 2012 11:59
Git hook that determines the author based on the email address in a SSH key. Doesn't work because Git doesn't check the config between pre-commit and commit.
#!/bin/sh
# Retrieve author information as Git sees it while commiting
AUTHORINFO=$(git var GIT_AUTHOR_IDENT) || exit 1
NAME=$(printf '%s\n' "${AUTHORINFO}" | sed -n 's/^\(.*\) <.*$/\1/p')
EMAIL=$(printf '%s\n' "${AUTHORINFO}" | sed -n 's/^.* <\(.*\)> .*$/\1/p')
printf "AUTHORINFO: %s\n" "${AUTHORINFO}"
printf "NAME: %s\n" "${NAME}"
printf "EMAIL: %s\n" "${EMAIL}"