Wednesday, August 26, 2015

I Repeat...

I'm always forgetting how to repeat a command. Here's how in tcsh:

$ repeat 9999 sh -c 'now=`date +%s` ; date > /tmp/tmp ; then=`date +%s` ; diff=`expr ${then} - ${now}` ; echo xxxxx ${diff} xxxxx ; if [ ${diff} -gt 0 ] ; then date ; fi ; sleep 15'

(The inner command is /bin/sh, of course)

Saturday, January 03, 2015

Hot and Sour Matzo Ball Soup

Ingredients:

  • Swanson Chinese hot and sour broth 
  • more broth (h&s or vegetable, optional)
  • a can or two of mushrooms
  • a scallion or two, chopped like you do
  • matzo balls, prepared as directed on the back of a can of Manischewitz matzo meal
Note: you can use one or two boxes/cans of broth, depending on your desired broth/ball ratio. The amount of scallions & mushrooms would then tend to follow the broth.

Instructions:

  1. Mix up the matzo ball ingredients and put them in the refrigerator.
  2. Cut up the scallion(s) and put them, along with the mushrooms, into the broth.
  3. Bring the broth and vegetables to a boil.
  4. Add the matzo balls to the boily broth.
  5. Lower the heat and simmer per the Manischewitz directions, about 30 minutes or so.

Monday, August 04, 2014

Listening Ports

Here's a handy command to find out which ports are listening:

/usr/sbin/lsof -P | sed -e '/(LISTEN)/ ! d; s/.* TCP .*:\([0-9][0-9]*\) .*/\1/' | sort -n | uniq

And ymmv, but sudo is probably a good way to run that.

Saturday, April 26, 2014

Emacs Window Title

One of those things I'll forget if I don't write it down - how to change the title of an Emacs window.

M-x set-frame-name

th! Stack Overflow

Wednesday, April 23, 2014

New cron job

Welcome to my crontab, new cron job!

18 * * * * ps -feww | grep -v grep | grep python | wc -l | sed -e '/^[0-4]$/ d; s/$/ pythons are running/g'

Why? If you've ever run into the problem where python cron jobs start piling up because of abrtd, and you've restarted abrtd, this will help you keep an eye on things. Every hour on the 18 (so as not to run into one of my running python scripts) I'm counting python processes and if there are more than four, I'll hear about it.

Friday, January 31, 2014

Pet Peeve: "infinite number of"

Welcome to my long list of pet peeves, "infinite number of"!!

Why say "infinite number of monkeys" when you can just say "infinite monkeys"??

Tuesday, January 28, 2014

Solaris TAR with Excluded Directories

It's been a long time since I had to use Solaris, and tar is bad enough without the differences between Linux and my previously favorite Unix!

$ tar cfX - /tmp/excludes . | gzip > ~/excluded.tgz

where /tmp/excludes looks like this:

./sub1
./sub2
./sub3

So it's not just a list of what's excluded, it's starting with the dot!

hattip: thank you, My Couple Of Cents!!