An shell script idiom for choosing what file to operate on
This is one of those Bourne shell idioms where I show the code firstand explain the effect later:
#!/bin/shdef=$1; shiftcase "$#" in 0) if test -t 0; then cat -- $def else cat fi;; *) cat -- "$@";;esac
Call this selfile . You use it in things like log scanning scripts,invoking it as:
selfile /var/log/something "$@" | .
An obvious way to do bulk initialization of dictionaries
Every so often in my Python programs I need to initialize adictionary with a whole bunch of values (and then pass it offsomewhere). For a long time, my usual approach to this was:
d = {}d['a'] = b.whatd['c'] = foo(d)....Recently I stumbled over the better way to do this, which isembarrassingly obvious in retrospect:
d = { 'a': b.what, 'c紀行
七日倒數
Weekly spam summary on May 27th, 2006
This week, we:
- got 11,513 messages from 227 different IP addresses.
- handled 18,277 sessions from 912 different IP addresses.
- received 133,583 connections from at least 42,540 different IPaddresses.
- hit a highwater of 8 connections being checked at once.
This is about the same as last week . Tuesday,Wednesday, and Thursday were the busiest days this week for connections;I suppose that's not
Today's dilemma: wiki page or blog entry?
As time goes by, there's an increasing amount of stuff I want to writedown. One of the things that stalls me out on this (apart from the sheereffort of writing) is the question of where and how I should put them;in particular, should I make a wiki page or write a blog entry?
In theory this shouldn't come up; WanderingThoughts is part ofa hybrid wiki-blog, which I've extolled the virtues of before . In practice this is an illusion
異議聲音 二零零六
(天安門迴響)
一九八九 六四
想超越愛國
要真正民主
做人的運動
愛恨哀怨 迴響不絕
二零零六六四
要再上路
愛人同志
到廣場去
死生相隨
一個公開呼籲
接收到此訊息的朋友 請帶同自己的發聲、演展、播放器具 ,於六