Archive for October, 2010
Using sed for grouping
Fun game: using sed to group lines
sed -ne '/^BEGIN/, /^END/ H; /^END/ {x; s/\n/£/g; p;}'
You can then use grep to extract those groups that you are interested in and return them to normal formatting use
tr £ \n
Getting Steam to run on ubuntu with play on linux
Steam is a downloaded windows client buy software and download it via the internet.
When I first ran it on linux it got this far
Checking plugin: Advanced Wine Configuration... Checking plugin: Offline PlayOnLinux... Checking plugin: Capture... Checking plugin: Transgaming Cedega... Checking plugin: Wine Import... Checking plugin: Wine Look... Checking plugin: Detour... Running install menu Running configuration of Steam Running Steam CellID: Fetching server list from CSDS. . . CellID: CSDS returned 171 servers. CellID: Connecting to 58.120.225.151:27031. . . CellID: Connect to 58.120.225.151:27031 took 317 MS CellID: Nothing beat our old best time of 36 MS
Before sitting idly and not doing anything.
After some fiddling I discovered that to get this to work one needed to make wine emulate the appropriate windows version – Windows Vista seemed to work here. (Windows 2008 caused Steam to try to install updates which failed)
Fun with hping3
Hping3 is a high-level command-line tool for sending raw packets to random places while allowing you to specify most things about said packets. It further allows you to use these packets for other tasks, like traceroute.
One particular use-case is identifying which hops are resulting in packets being dropped. (One occasionally finds that packet loss depends on things like packet size and content)
Examples
Find out which hop is dropping your DNS packets:
sudo hping3 –udp –traceroute -p 53 8.8.8.8
Find out which machine is blocking your ssh connections:
hping3 –syn -p 22 –traceroute sshbox.com
You can, further, specify the contents of the packet sent (Here it is useful to use wireshark to capture and export packet data):
hping3 -E packet.data –udp -p 53 –traceroute -d $(wc -c packet.data | cut -d ‘ ‘ -f 1)
Vanity Generality
The act of pretending something is general even though it has
and will always have only one purpose because it seems silly to have this specific a thing.
Generality of this type can make code easier to understand at times, and at other times very much harder, but this is not the motive for vanity generality.
Pretending that code is general can be a sllightly dangerous activity because you might just start trying to make it applicable in very general situations…