Skip to content

Instantly share code, notes, and snippets.

Siegfried Bilstein sbilstein

Block or report user

Report or block sbilstein

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sbilstein /
Last active Jul 19, 2018
Get an emoji for the time of day!
function get_time
local hour="`date +%H`"
local emoji="a"
if [ $hour -lt 10 -a $hour -gt 6 ]; then
elif [ $hour -lt 15 ]; then
elif [ $hour -lt 20 ]; then
branch=`git branch | grep \* | cut -d ' ' -f2`
if [ $branch = 'master' ]; then
echo "Can't remaster on master" >&2
exit 1
ref=`git rev-parse $branch`
echo "To restore your branch ($branch), run the following:"
sbilstein / bash_prompt
Last active Dec 31, 2015
BASH prompt with git branch name and status. Fixed to handle directory names with spaces and checks to see if nested directories are under source control.
View bash_prompt
# BASH prompt builder
# This is a script I use to generate BASH prompts that look like this:
# (master)*
# [sbilstei@sbilstei-mn1:~/localcode/git-sandbox]:$
# Basically user, the machine's hostname, current working directory tilde condensed and an optional branch name
# when navigating a git repo. The asterisk is visible if there are uncommitted changes.
View .gitconfig
helper = osxkeychain
excludesfile = ~/.gitexcludes
autosetuprebase = always
rem = rebase origin/master
co = checkout
br = branch
View gist:8792434
grep 'some shit' | cut -f2 -d:
sbilstein / gist:8698161
Created Jan 29, 2014
remove padding with sed
View gist:8698161
sed -e 's/^\s*//' -e '/^$/d'
You can’t perform that action at this time.