Fiddling with X selections from shell scripts

I know of three command-line programs that will fiddle with theX selection (and/or the cut buffers) in a way that's usefulfor shell scripts: xsnarf from Smarasderagd's collectionof X things , xcb , and xclip .

I use xsnarf for a variety of reasons, I think partly historical (inthat I had it around well before I found the others); I'm jotting downthe other two here partly so that I have the information handy the nexttime someone asks me


A simple way to get a disk space usage summary

In the spirit of my little shell scripts, here's a simple way to get auseful summary of disk space usage on a Unix system:

du | sort -nr | less

(substitute the pager of your choice for less , and use ' du -x ' asnecessary.)

This is less pretty than the various graphical disk space visualizationprograms that float around, but I find it gives me pretty much theinformation I need. It's pretty easy to narrow down what areas of thefilesystem,


說個笑話紀念我











來,去
花/火



時間,
時間

所有的時間都聚合,同時顛倒,最快和最慢











click上面幅野 ,當祝福我,啦。

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 "$@" | .


20060529網摘 – Blade Runner Final Cut

重有巴士阿叔


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

紀行


行進地獄之後我前所未有地能夠接受自己的醜怪,在這個意義上它就是天堂。深淵就是上方。

於是我竟然覺得德里達好看起來,猶勝齊澤克。

快慰、澄明的漩渦,連淚都咻一聲蒸發的顛倒瞬間,總是過長或過短。地獄裡處處是奔

七日倒數


我帶著一般常見的東西去旅行:潰爛的臉、彎曲的頸椎、柴可夫斯基、red bull、鐵觀音、咖啡、vodka、巧克力——我在過去兩星期內吃下的巧克力高於過去三年總和於是在愛情的複影和幻像裡與腦分泌嬉戲對著空氣還擊問題。

朋友們

巴士阿叔之通識教育

有學校為怕學生駁嘴,竟然禁止學生講「有壓力」、「未解決」,其實巴士阿叔事件,是很好的通識課內容,何不借此機會,讓學生思考一下事件背後反映了什麼?

好了,各位同學,請試答以下問題:

(一) 阿叔篇

  • 試分析阿叔一