get list of most recently installed packages with dpkg log

# zcat -f /var/log/dpkg.log*|grep 'status installed'|awk '{print $1" "$5}'|sort -u |less
2015-05-04 ffmpeg
2015-05-04 libavcodec52
2015-05-04 libavdevice52
2015-05-04 libavfilter0
2015-05-04 libavformat52
2015-05-04 libavutil49
2015-05-04 libdc1394-22
2015-05-04 libdirac-encoder0
2015-05-04 libdirectfb-1.2-9
2015-05-04 libfaad2
2015-05-04 libgsm1
2015-05-04 libogg0
2015-05-04 libopenjpeg2
2015-05-04 liborc-0.4-0
2015-05-04 libpostproc51
2015-05-04 libraw1394-11
2015-05-04 libschroedinger-1.0-0
2015-05-04 libsdl1.2debian
2015-05-04 libsdl1.2debian-alsa
2015-05-04 libspeex1
2015-05-04 libsvga1
2015-05-04 libswscale0
2015-05-04 libtheora0
2015-05-04 libusb-1.0-0
2015-05-04 libvorbis0a
2015-05-04 libvorbisenc2
2015-05-04 libx86-1
2015-05-04 man-db

IRQBALANCE_BANNED_CPUS explained and working on Ubuntu 14.04

Despite the explanation and examples in the manual, there is still some confusion on how to use irqbalance to move interrupts to a specific set of CPUs. (For the sake of simplicity, I use the words CPUs in the same way Linux sees them; it doesn’t care whether they are physical, or cores, or threads.)

Let’s start with a box that has 8 CPUs

# grep processor /proc/cpuinfo 
processor       : 0
processor       : 1
processor       : 2
processor       : 3
processor       : 4
processor       : 5
processor       : 6
processor       : 7

irqbalance uses a variable set at runtime ( IRQBALANCE_BANNED_CPUS ) to make decisions which CPUs should not receive interrupts. IRQBALANCE_BANNED_CPUS is a hexidecimal representation of a “bitmask” to ignore certain CPUs when deciding which CPU to use for a specific interrupt. If we have a box with 8 cpus we will need to start with a binary string 8 digits long: “00000000”

0 means “allow interrupts on this CPU”
1 means “prevent interrupts on this CPU”

In the case of “00000000” we are allowing interrupts on all 8 CPUs. In binary numbers the least significant bit is on the right, mapping the CPUs like this:
“CPU7 CPU6 CPU5 CPU4 CPU3 CPU2 CPU1 CPU0″

Let’s say we want to allow interrupts on the 6th and 7th CPU, and exclude the 1st, 2nd, 3rd, 4th, 5th, and 8th CPU from interrupts. Our bitmask in this case would look like this”

   1    0    0    1    1    1    1    1
"CPU7 CPU6 CPU5 CPU4 CPU3 CPU2 CPU1 CPU0"

This can get tricky. Most humans start counting from 1 but computers start counting at 0. So be careful: the 7th CPU is CPU6 in this case.

Now that we have our bitmask of “10011111” we need to convert it to hexadecimal. You could use this handy bash function:

#
bin2hex() {
   echo "obase=16;ibase=2;$1"|bc
}
# bin2hex 10011111
9F
#

So now we can edit /etc/default/irqbalance and set the variable:

export IRQBALANCE_BANNED_CPUS="9F" 

NOTE: I have been able to get irqbalance working on Ubuntu 14.04 trusty only by exporting the IRQBALANCE_BANNED_CPUS variable using “export” in /etc/default/irqbalance AND using the latest (at the time of this writing) irqbalance 1.0.9

Once you understand how the CPUs translate to the bitmask you can extrapolate out from there and come up with a way to ban specific CPUs from irqbalance for any number of CPUs.

find fastest Ubuntu mirror with netselect

Using some internal metrics, netselect can tell you what mirror is “best” for you to use for downloading packages, or setting up your own mirror. netselect uses icmp to determine latency, and hop count between you and a mirror. It can take a list of many mirrors, tests them, and reports which one has the best (lowest) metric. If you want rsync or ftp as a preferred transport, you could change it to only look for one of those. Throw in a few verbose flags to get more output.

# netselect -s 20 `wget https://launchpad.net/ubuntu/+archivemirrors -q -O - | grep '>http' |cut -d / -f 3 | tr '\n' ' '`
    3 mirror.tcpdiag.net
   14 149.20.4.71
   17 nz.archive.ubuntu.com
   17 ftp.citylink.co.nz
   17 mirrors.easynews.com
   18 mirrors.nl.eu.kernel.org
   18 ubuntu.securedservers.com
   45 mirrors.cat.pdx.edu
   58 mirror.peer1.net
   67 mirror.pnl.gov
   77 76.73.4.58
   90 ubuntu.mirrors.tds.net
   95 mirror.steadfast.net
  100 ubuntu-archives.mirror.nexicom.net
  102 mirrors.gigenet.com
  105 mirrors.xmission.com
  109 ubuntu.mirror.constant.com
  115 mirror.cs.umn.edu
  117 ubuntu.bhs.mirrors.ovh.net
  120 mirrors.rit.edu

In this case it looks like mirror.tcpdiag.net is the best choice.

# ping -c 3 mirror.tcpdiag.net
PING mirror.tcpdiag.net (69.160.243.150) 56(84) bytes of data.
64 bytes from ip-69-160-243-150.static.atlanticmetro.net (69.160.243.150): icmp_req=1 ttl=59 time=3.11 ms
64 bytes from ip-69-160-243-150.static.atlanticmetro.net (69.160.243.150): icmp_req=2 ttl=59 time=2.85 ms
64 bytes from ip-69-160-243-150.static.atlanticmetro.net (69.160.243.150): icmp_req=3 ttl=59 time=3.27 ms

--- mirror.tcpdiag.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 2.852/3.081/3.275/0.185 ms

3ms is pretty close.

blacklist debian package

After upgrading synergy, every time I would hit the shift key on the remote screen, it would crash. I found the bug report, and decided to roll back the package. To make sure it didn’t get upgraded automatically, I did this:

# echo "synergy hold" | dpkg --set-selections

Of course this will also work for Ubuntu.

inspect .zip contents from command line

If you are browsing around in a terminal and want to see the contents of a .zip file, unzip is able to just list the contents but not actually extract them:

unzip -l myarchive.zip

Alternatively, if you want to open a .zip file in a GUI window to browse it’s contents do this:

file-roller myarchive.zip

It will open up Archive Manager to look at the contents.