Custom Search

Tuesday, November 10, 2009

Small Conky Calendar

I”m not a perl programmer and I’m sure my chances of having
come up with this on my own would be right up there with the
classic example about the monkeys with typewriters creating
the encyclopedia! :-) I got it off this mailing list:

freebsd-questions@freebsd.org

cal | perl -pe ’s/^/ /;s/$/ /;s/ ‘”$(date “+%e”)”‘ /\['"$(date "+%e")"']/’

I plugged it into the bottom of my .conkyrc file like so:

${color green}${execi 360 cal | perl -pe ’s/^/ /;s/$/ /;s/ ‘”$(date “+%e”)”‘ /\[ '"$(date "+%e")"']/’} ${color}

BTW, the above perl lines are wrapped, both the first which
is from the command line, and the second, which is the entire
line in .conkyrc. It shows the current day enclosed in brackets
in order to highlight it. Nice touch.

Cheers!

Labels: , , , , ,

Sunday, October 18, 2009

Find and Kill Process

I had used the following to find an instance of conky and
kill it in order to start a different conky configuration:

ps -U useracct |grep justweather |head -1 | \
cut -c 1-5 |sed -e ’s/[\ ]//g;/^$/d’ > jwpid.out
kill -9 `cat jwpid.out`

That’s unnecessarily complicated compared to this simpler way:

ps -U useracct |grep justweather.conkyrc | awk ‘{print $1}’ | \
xargs kill -15

Labels: , , , , , ,