Skip to content

Instantly share code, notes, and snippets.


Jan Moesen janmoesen

View GitHub Profile
janmoesen / gist:1286835
Created Oct 14, 2011
Word of the day in Bash
View gist:1286835
# 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;
local IFS=$'\n' words=($(<"$file"));
local num_words=${#words[@]};
janmoesen / .bash_profile
Created Aug 19, 2011
Temporary .bash_profile
View .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';