linux

Lucid Windows Control Layout

Stephen
After upgrading to lucid i noticed that they decided to go for the mac layout on windows controls to fix this. Run gconf-editor, then apps > metacity > general > button layout > menu:minimize,maximize,close Fixed thank god.

Powertop

Stephen
PowerTOP is a software utility designed to measure, explain and minimize a computers power consumption. It works for both Intel and AMD processors. It analyses the programs, devices and kernel options running Linux or Solaris. It estimates the power consumption for any computer. This information can be used to find out what programs / devices are using excessive power. The focus of powertop is monitoring CPU sleep states, and showing the programs or drivers responsible for “wakeups” which prevent CPUs entering sleep states.

Irq Fun

Stephen
Hardware interrupts were introduced as a way to avoid wasting the processor’s valuable time in polling loops, waiting for external events. They may be implemented in hardware as a distinct system with control lines, or they may be integrated into the memory subsystem.Read More [[email protected] ~]# cat /proc/interrupts CPU0 CPU1 <items removed> 30: 1543015844 70 IO-APIC-level eth0 33: 982 1125222804 IO-APIC-level eth1 NMI: 0 0 LOC: 312789123 312790125 ERR: 0 MIS: 0 As you can see from the list above the interrupts for the network card has been balanced betwen the Cores.

The Most Useful Command Ever

Stephen
How many times have you run a command and then thought, ooo crap i now need to leave work, i really should have nohupped it or run it in screen session well welcome to. disown \[-ar\] \[-h\] [jobspec ...] Without options, each jobspec is removed from the table of active jobs. If the -h option is given, each jobspec is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP.

Network Condition Emulation

Stephen
I was asked to today if it was possible to add latency and packet loss to a device in order to replicated network problems. After a while googleing i found tc +netem. This allows you do funcy stuff to replicated network problems. If i wanted to add 100ms of latency i could do tc qdisc add dev eth0 root netem delay 100ms You can also add variation tc qdisc change dev eth0 root netem delay 100ms 10ms

Wonders Of Cssh

Stephen
If you need to run the same commands on multiple computers, then maybe you should be thinking about using puppet but if you only need to do a one time thing then there is clusters ssh aka cssh. After a apt-get install clusterssh You can then start using it by simple typing cssh server01 server02 etc etc Another way to do it is include this in you .csshrc file extra_cluster_file=~/.clusters Then in you ~.

Httping

Stephen
One of my work mates was trying to find the util that allows you to do “pings” to a http server. I knew about it but couldn’t remember the url thusly one has placed it on the block so i dont have to remember it httping. apt-get install httping On running the command you get the following output [email protected]:~$ httping -g http://google.com - Using proxyserver: nokes.nokia.com:8080 PING google.com:80 (http://google.com): connected to google.

Luks

Stephen
After some googling i have worked out how to add keys to a luks, First we need to generate a key dd if=/dev/urandom of=keyfile bs=1M count=10 We can then add it to luks cryptsetup luksAddKey /dev/device keyfile Once this is done we can then unlock the device with a key cryptsetup luksOpen /dev/sdb1 external -d keyfileexternal A device mapper will be added to /dev/mapper/external We can then lock the device again with a cryptsetup luksClose external

Hal Dbus and Python

Stephen
How to tie into dbus to get alerts on had drive device insertion also generates pretty notifications. Its the first set in making the code decrypt a usb device on insertion run a rdiff backup and then eject the device. Step two is to work out how to generate a key file for a pass phrase with luks. import pynotify import dbus import gobject from dbus.mainloop.glib import DBusGMainLoop import time class DeviceFinder ( ): def run ( self ): pynotify.

CouchDB

Stephen
Just had a meeting with Jan Lehnardt about Couchdb, very interesting. Talked about map reduce, how it indexes, how we could shared the data using Lounge. Looks like an exciting technology, he did a talk about couch and how it works at Peer to Peer. One of my work friends did a blog post about it. Time to fire up the vm and start playing it seems, see if i can actually get it to perform as well as its suppose to.