This is O.R.Senthil Kumaran's blogspot on programming and technical things. The title is a line from "Zen of Python".
Linux Tip - ^
Ubuntu Server Tip: If you need to perform a command a second time on a different file, you can use command replacement with the ^ symbol. e.g. "cp foo.txt /to/some/directory" then "^foo^bar", expanding to: "cp bar.txt /to/some/directory".
Simple Countdown Clock - Python and xdaliclock
Here is a simple countdown clock script which you can use. It is simply
sending -countdown argument properly to the xdaliclock binary.
I find having this script in my /usr/local/bin pretty useful.
sending -countdown argument properly to the xdaliclock binary.
I find having this script in my /usr/local/bin pretty useful.
#!/usr/bin/python
# A Simple Countdown Clock using xdaliclock
# usage: countdown [time]
# time defaults to 1 hour.
import time
import sys
import subprocess
try:
hours = float(sys.argv[1])
except IndexError:
hours = 1
hours = int(time.time()) + int(hours * 3600)
command = 'xdaliclock -countdown %d' % hours
subprocess.Popen(command.split())
Subscribe to:
Posts (Atom)