Skip to content

Instantly share code, notes, and snippets.

@benprew
benprew / pre-commit
Created August 29, 2013 22:38
Git pre-commit hook to prevent committing changes with common errors (trailing whitespace, tab/space mixing and conflict markers) from: http://git.xiph.org/speex.git/hooks/pre-commit
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, make this file executable.
# This is slightly modified from Andrew Morton's Perfect Patch.
agent = Mechanize.new
href = 'http://www.google.com/not_found'
begin
page = agent.get(href)
rescue StandardError => e
if e.to_s =~ /404/
puts "Page #{href} not found"
end
end

How I setup my worktrees:

$ ll ~/work/analytical-solutions-trees drwxrwsr-x 81 bprew rtk 8.0K Nov 15 17:36 faster-rap-tags drwxrwxr-x 82 bprew rtk 8.0K Sep 11 22:27 master drwxrwsr-x 81 bprew rtk 8.0K Nov 13 16:20 migrate-as-linear-to-vpc

Adding a new worktree:

I have a git script named "start" that I use when I want to add a new worktree

@benprew
benprew / bfc.sh
Created August 6, 2021 06:01
bodyfat calculator
#!/bin/bash
height=$1
neck=$2
abdomen=$3
if [[ -z $height || -z $neck || -z $abdomen ]]; then
echo "$0 - calculate your bodyfat using the US Navy method"
echo "Usage: $0 <height> <neck> <abdomen>"
echo " height - height (in inches)"