Skip to content

Instantly share code, notes, and snippets.

View craSH's full-sized avatar

Ian Gallagher craSH

View GitHub Profile
@craSH
craSH / hashpromptshort.sh
Created April 24, 2010 07:02
color your prompt based roughly (1/8*2 hashing) on hostname -f output. Also strip vowels from hostname to give a shorter prompt.
if [ "$PS1" ]; then
if [ "$BASH" ]; then
shortname=${HOSTNAME%%.*}
shortname=${shortname//[aeiou]/}
hostname_crc=$(echo $HOSTNAME | tr 'A-Z' 'a-z' | cksum)
hostname_crc=${hostname_crc%% *}
hostcolor_a=$(( (0x${hostname_crc} + 1) % 2 ))
hostcolor_b=$(( 0x${hostname_crc} % 8 + 30 ))
PS1="\[\e[33;1m\]\u@\[\e[${hostcolor_a};${hostcolor_b}m\]${shortname}:\[\e[0m\]\w"'\$ '
PS2='\[\e[31;1m\]>\[\e[0m\]'
@craSH
craSH / updatechromiumnightly
Created November 17, 2009 02:16
Simple script to automatically download and install the latest available Chromium nightly build for Mac OSX
#!/bin/bash
#
# Simple script to update OSX Chromium to the latest nightly build.
# Will not download if you already have the latest (call with --force
# to override this check)
#
# Copyleft 2010 Ian Gallagher <crash@neg9.org>
#
LATEST=$(curl -s "http://build.chromium.org/f/chromium/snapshots/Mac/LATEST")