Skip to content

Instantly share code, notes, and snippets.

@eban
Created March 27, 2009 16:49
Show Gist options
  • Save eban/86777 to your computer and use it in GitHub Desktop.
Save eban/86777 to your computer and use it in GitHub Desktop.
Calender Image
#! /bin/sh
export LC_TIME
LC_TIME=C
day=`date +%e`
plain=`cal -3`
sat=`cal -3 |sed '1s/./ /g;s/.\{18\}\(..\)\( \|$\)/ \1\2/g'`
sun=`cal -3 |sed '1s/./ /g;s/\(..\).\{18\}\( \|$\)/\1 \2/g'`
today=`cal -3 |sed 's/^\(.\{21,\}\) '"$day"' \(.\{21,\}\)$/\1 @ \2/' |tr -c '@\n' ' ' |sed s/@/"$day"/`
xy="${xy:=text 40,660}"
convert \
-font Liberation-Mono-Bold \
-fill gray -draw "$xy \"$plain\"" \
-fill cyan4 -draw "$xy \"$sat\"" \
-fill red -draw "$xy \"$sun\"" \
-fill white -draw "$xy \"$today\"" \
$1 $2
# -font '-misc-sazanami gothic-medium-r-normal--11-0-0-0-c-0-iso10646-1' \
# -font '-misc-fixed-*-*-*-*-*-*-*-*-*-*-*-*' \
# -font '-misc-fixed-*-*-*-*-8-*-*-*-*-*-*-*' \
# -display ${DISPLAY-:0} \
#! /bin/sh
export LC_TIME
LC_TIME=C
day=`date +%e`
plain=`cal -3`
sat=`cal -3 |sed '1s/./ /g;s/.\{18\}\(..\)\( \|$\)/ \1\2/g'`
sun=`cal -3 |sed '1s/./ /g;s/\(..\).\{18\}\( \|$\)/\1 \2/g'`
today=`cal -3 |sed 's/^\(.\{21,\}\) '"$day"' \(.\{21,\}\)$/\1 @ \2/' |tr -c '@\n' ' ' |sed s/@/"$day"/`
xy="${xy:=text 0,60}"
convert \
-size 600x300 \
xc:black \
-font Liberation-Mono-Bold \
-draw "stroke darkgray stroke-width 1 $xy \"$plain\"" \
-draw "fill gray $xy \"$plain\"" \
-draw "fill cyan4 $xy \"$sat\"" \
-draw "fill red $xy \"$sun\"" \
-draw "fill white $xy \"$today\"" \
-trim -bordercolor black -border 4 -frame 3x3+1+1 \
$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment