Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am malexw on github.
  • I am malexw (https://keybase.io/malexw) on keybase.
  • I have a public key ASDsrFFcSuNyXCaBuHsDJbiTbKEJlIT2G46fJ7Gw5mJfCQo

To claim this, I am signing this object:

@malexw
malexw / commit-msg.sh
Created June 4, 2015 21:36
Reject git commits that have a commit message greater than 50 characters
#!/bin/sh
exec 1>&2
char_count=$(cat $1 | wc -m)
if [ "$char_count" -gt "50" ]
then
echo "Aborting commit. Commit message too long (" $char_count "/ 50 chars )"
exit $char_count
fi
def make_cylinder():
FACETS = 12
DFACETS = FACETS * 2
RADIUS = 0.5
HEIGHT = 1
HALF_STEP = math.pi / FACETS
TRIG_STEP = HALF_STEP * 2
geom = Geometry()
@malexw
malexw / gowork.ps1
Created December 7, 2013 20:30
Powershell script to switch to a golang workspace and add its path to the gopath environment variable.
$Env:gopath = $args[0]
cd $args[0]
@malexw
malexw / dnc-hook.sh
Created January 11, 2013 19:39
When installed as a git pre-commit hook, this script will prevent a commit from being created if the token '!DNC' is found within the diff.
#!/bin/sh
exec 1>&2
dnc_count=$(git diff --cached | grep -c '!DNC')
if [ "$dnc_count" != "0" ]
then
echo "Aborting commit. Found" $dnc_count "!DNC markers"
exit $dnc_count
fi