Skip to content

Instantly share code, notes, and snippets.

View janmoesen's full-sized avatar

Jan Moesen janmoesen

View GitHub Profile
@janmoesen
janmoesen / gist:1286835
Created October 14, 2011 11:13
Word of the day in Bash
# Read a random word from the dictionary and try to get its definition from
# Merriam-Webster.
function word-of-the-day {
local file="${1:-/usr/share/dict/words}";
if ! [ -r "$file" ]; then
echo "Cannot read from dictionary file: $file" 1>&2;
return 1;
fi;
local IFS=$'\n' words=($(<"$file"));
local num_words=${#words[@]};
@janmoesen
janmoesen / .bash_profile
Created August 19, 2011 06:01
Temporary .bash_profile
# ============== shell
# Case-insensitive globbing.
shopt -s nocaseglob;
# Do not overwrite files when redirecting using ">", ">&" or "<>".
# Note that you can still override this with ">|".
set -o noclobber;
# UTF-8 all the way.
export LC_ALL='en_GB.UTF-8';