Friday·30·September·2011
Fun facts from the UDD //at 23:20 //by abe
After spotting an upload of mira, who in turn spotted an upload of abe (the package, not an upload by me aka abe@d.o), mira (mirabilos aka tg@d.o) noticed that there are Debian packages which have same name as some Debian Developers have as login name.
Of course I noticed a long time ago that there is a Debian package with my login name “abe”. Another well-known Debian login and former package name is amaya.
But since someone else came up with that thought, too, it was time for finding the definite answer to the question which are the DD login names which also exist as Debian package names.
My first try was based on the list of trusted GnuPG keys:
$ apt-cache policy $(gpg --keyring /etc/apt/trusted.gpg --list-keys 2>/dev/null | \ grep @debian.org | \ awk -F'[<@]' '{print $2}' | \ sort -u) 2>/dev/null | \ egrep -o '^[^ :]*' alex tor ed bam ng
But this was not satisfying as my own name didn’t show up and gpg also threw quite a lot of block reading errors (which is also the reason for redirecting STDERR).
mira then had the idea of using the Ultimate Debian Database to answer this question more properly:
udd=> SELECT login, name FROM carnivore_login, carnivore_names WHERE carnivore_login.id=carnivore_names.id AND login IN (SELECT package AS login FROM packages, active_dds WHERE packages.package=active_dds.login UNION SELECT source AS name FROM sources, active_dds WHERE sources.source=active_dds.login) ORDER BY login; login | name -------+--------------------------------------- abe | Axel Beckert alex | Alexander List alex | Alexander M. List 4402020774 9332554 and | Andrea Veri ash | Albert Huang bam | Brian May ed | Ed Boraas ed | Ed G. Boraas [RSA Compatibility Key] ed | Ed G. Boraas [RSA] eric | Eric Dorland gq | Alexander GQ Gerasiov iml | Ian Maclaine-cross lunar | Jérémy Bobbio mako | Benjamin Hill mako | Benjamin Mako Hill mbr | Markus Braun mlt | Marcela Tiznado nas | Neil A. Schemenauer nas | Neil Schemenauer opal | Ola Lundkvist opal | Ola Lundqvist paco | Francisco Moya paul | Paul Slootman pino | Pino Toscano pyro | Brian Nelson stone | Fredrik Steen (26 rows)
Interestingly “tor” (Tor Slettnes) is missing in this list, so it’s not complete either…
At least I’m quite sure that nobody maintains a package with his own login name as package name. :-)
We also have no packages ending in “-guest”, so there’s no chance that
a package name matches an Alioth guest account either…
Tagged as: Alioth, DD, Debian, GnuPG, GPG, PGP, UDD
// show without comments // write a comment
Related stories
Thursday·22·September·2011
Emacs Macros: Repeat on Steroids //at 16:06 //by abe
vi users have their .
(dot) redo command for repeating
the last command. The article Repeating Commands in Emacs in Mickey Petersen’s blog Mastering Emacs explained
Emacs’ equivalent for that, namely the command repeat
, by
default bound to C-x z
.
I though seldomly use it as I mostly have to repeat a chain of commands. What I use are so called Keyboard Macros.
For example for the CVE-2011-3192 vulnerability in Apache I added a line like
Include /etc/apache2/sites-common/CVE-2011-3192.conf
to
all VirtualHosts.
So I started Emacs with all the relevant files: grep
CVE-2011-3192 -l /etc/apache2/sites-available/*[^~] | xargs emacs
&
To remove those “Include” lines again M-x flush-lines
is
probably the easiest way in Emacs. So for every file I had to call
flush-lines with always the same parameter, save the buffer and then
close the file or — in Emacsish — “kill” the buffer.
So while working on the first file I recorded my doing as a keyboard macro:
C-x (
- Start recording
M-x flush-lines<Enter>CVE-2011-3192<Enter>
- flush all lines which contain the string “CVE-2011-3192”
C-x C-s
- save the current buffer
C-x C-k<Enter>
- kill the current buffer, i.e. close the file
C-x )
- Stop recording
Then I just had to call the saved macro with C-x e
. It
flushed all lines, saved the changes and switched to the next
remaining file by closing the current file with three key-strokes. And
to make it even easier, from the second occasion on I only had to
press e
to call the macro directly again. So I just
pressed e
for a bunch of time and had all files edited.
(In this case I used git diff
afterwards to check that I
didn’t wreck anything by half-automating my editing. :-)
Of course there are other ways to do this, too, e.g. use
sed
or so, but I still think it’s a neat example for
showing the power of keyboard macros in Emacs. More things you can do
with Emacs Keyboard Macros are described in the EmacsWiki entry Keyboard Macros.
And if you still miss vi’s .
command in Emacs, you can
use the dot-mode, an Emacs mode currently maintained by Robert Wyrick
which more or less automatically defines keyboard macros and lets you
call them with C-.
.
Tagged as: Apache, CLI, CVE, CVE-2011-3192, dot-mode, Emacs, EmacsWiki, git, macro, Other Blogs, redo, repeat, vi, xargs
// show without comments // write a comment
Related stories
Wednesday·21·September·2011
Creative Toilet Paper Usage in Webcomics //at 10:34 //by abe
Funnily two of my daily web comics recently featured interesting things you could do with toilet paper: Zits on 19th of September 2011 involving a fan and Calvin and Hobbes on 13th of September 2011 involving flushing the toilet.
Although both experiments are obviously resource wasting, they look
like quite some fun and I’m tempted to actually try them both at least
once. (I though don’t plan to try
this, too. :-)
Tagged as: Calvin and Hobbes, comic, comicstrip, fan, toilet, toiletpaper, ventilator, webcomic, webcomics, Zits
// show without comments // write a comment
Related stories
Thursday·01·September·2011
Useful but Unknown Unix Tools: How wdiff and colordiff help to choose the right Swiss Army Knife //at 12:18 //by abe
In light of the fact that it seems possible to fit the plastic caps of a Debian branded Swiss Army Knife (Last orders today!) on an existing Swiss Army Knife (German written howto as PDF), I started to think about which Victorinox Cybertool would be the best fitting for me.
And because the Victorinox comparison page doesn’t really show diffs, just columns with floating text which are not very helpful for generating diffs in your head, I used command line tools for that purpose:
wdiff
Because the floating texts are not line- but just whitespace-based,
the tool of choice is not diff
but wdiff
, a word-based diff. It encloses additions and removals
in {+…+}
and [-…-]
blocks.
(No, those aren’t Japanese smileys although they look a lot like some.
^^).
The easiest and clearest way is to copy and paste the texts from Victorinox’ comparison page into some text files and
compare them with wdiff
:
$ wdiff cybertool34.txt cybertool41.txt
{+Schraubendreher 2.5mm,+} Pinzette, Nähahle mit Nadelöhr, {+Holzsäge,+} Bit-Schlüssel( 5 mm Innensechskant für die D-SUB Steckverbinder, 4 mm Innensechskant für Bits, Bit Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange( Hülsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber( auch zum DIP-Switch verstellen ), Mehrzweckhaken (Paketträger), {+Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ),+} Dosenöffner( kleiner Schraubendreher ), Kleine Klinge, Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer ), {+Holzmeissel / Schaber,+} Bit-Halter, Stecknadel, inox, Schere, Korkenzieher, Zahnstocher
So this already extracted the information which are the seven tools which are in the Cybertool 41, but not in the Cybertool 34. Nevertheless the diff is still not easily recognizable on the first glance. There are several ways to help here.
First wdiff
has an option --no-common
(the
according short option is -3
) which just shows added and
removed words:
$ wdiff -3 cybertool34.txt cybertool41.txt ====================================================================== {+Schraubendreher 2.5mm,+} ====================================================================== {+Holzsäge,+} ====================================================================== {+Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ),+} ====================================================================== {+Holzmeissel / Schaber,+} ======================================================================
This is already way better to quickly recognize the actual differences.
But if you still also want to see the common tools of the two knifes you need some visual help:
One option is to use wdiff
’s --terminal
(or
short -t
) option. Added words are then displayed inverse
and removed words are shown underlined (background and foreground
colors hardcoded as there is no “invert colors” style in CSS or HTML):
$ wdiff -t cybertool34.txt cybertool41.txt
Schraubendreher 2.5mm, Pinzette, Nähahle mit Nadelöhr, Holzsäge, Bit-Schlüssel( 5 mm Innensechskant für die D-SUB Steckverbinder, 4 mm Innensechskant für Bits, Bit Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange( Hülsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber( auch zum DIP-Switch verstellen ), Mehrzweckhaken (Paketträger), Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ), Dosenöffner( kleiner Schraubendreher ), Kleine Klinge, Druckkugelschreiber, Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer ), Holzmeissel / Schaber, Bit-Halter, Stecknadel, inox, Schere, Korkenzieher, Zahnstocher
But some still like to to use color instead of the contrast-rich inverse and the easily to oversee underlining. This is where colordiff comes into play:
colordiff
colordiff is like syntax highlighting for diffs on the
command line. I works with classic and unified diffs as well as with
wdiffs and debdiffs (the debdiff
command is part of the
devscripts package).
$ wdiff cybertool34.txt cybertool41.txt | colordiff
{+Schraubendreher 2.5mm,+} Pinzette, Nähahle mit Nadelöhr, {+Holzsäge,+} Bit-Schlüssel( 5 mm Innensechskant für die D-SUB Steckverbinder, 4 mm Innensechskant für Bits, Bit Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange( Hülsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber( auch zum DIP-Switch verstellen ), Mehrzweckhaken (Paketträger), {+Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ),+} Dosenöffner( kleiner Schraubendreher ), Kleine Klinge, Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer ), {+Holzmeissel / Schaber,+} Bit-Halter, Stecknadel, inox, Schere, Korkenzieher, Zahnstocher$ wdiff cybertool29.txt cybertool41.txt | colordiff
{+Schraubendreher 2.5mm,+} Pinzette, Nähahle mit Nadelöhr, {+Holzsäge,+} Bit-Schlüssel( 5 mm Innensechskant für die D-SUB Steckverbinder, 4 mm Innensechskant für Bits, Bit Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), {+Kombizange( Hülsenpresser, Drahtschneider ),+} Stech-Bohrahle, {+Kugelschreiber( auch zum DIP-Switch verstellen ), Mehrzweckhaken (Paketträger), Metallsäge( Metallfeile, Nagelfeile, Nagelreiniger ),+} Dosenöffner( kleiner Schraubendreher ), Kleine Klinge, [-Druckkugelschreiber,-] Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer ), {+Holzmeissel / Schaber,+} Bit-Halter, Stecknadel, inox, {+Schere,+} Korkenzieher, Zahnstocher
(Coloured “Screenshots” done with ANSI HTML Adapter from the package aha.)
Some, especially those who are used to git, are probably
confused by the default choice of diff colors. This is easily fixable
by writing the following into you ~/.colordiffrc
:
newtext=green oldtext=red diffstuff=darkblue cvsstuff=darkyellow
(See also /etc/colordiff
for the defaults and hints.)
colordiff
has by the way two operating modes:
- Without parameter it reads diffs from standard input as seen above.
- With parameters it works as drop-in diff replacement including all diff options as shown below.
So now let us compare the Cybertool 29 with Cybertool 34 in a normal diff (by using the texts from above and replacing all commata with newline characters) with git-like colors:
$ colordiff cybertool29-lines.txt cybertool34-lines.txt 12a13,14 > Kombizange( Hülsenpresser > Drahtschneider ) 13a16,17 > Kugelschreiber( auch zum DIP-Switch verstellen ) > Mehrzweckhaken (Paketträger) 16d19 < Druckkugelschreiber 25a29 > Schere
Or as unifed diff with some context:
$ colordiff -u cybertool29-lines.txt cybertool34-lines.txt --- cybertool29-lines.txt 2011-08-31 20:55:37.195546238 +0200 +++ cybertool34-lines.txt 2011-08-31 20:55:11.667710504 +0200 @@ -10,10 +10,13 @@ Bit Torx 8 Bit Torx 10 Bit Torx 15 ) +Kombizange( Hülsenpresser +Drahtschneider ) Stech-Bohrahle +Kugelschreiber( auch zum DIP-Switch verstellen ) +Mehrzweckhaken (Paketträger) Dosenöffner( kleiner Schraubendreher ) Kleine Klinge -Druckkugelschreiber Grosse Klinge Ring inox @@ -23,5 +26,6 @@ Bit-Halter Stecknadel inox +Schere Korkenzieher Zahnstocher
So if you want nicely colored diffs with Subversion like you’re used
to with git, you can use svn diff | colordiff
.
Tagged as: aha, colordiff, Colorful Console, Cybertool, debdiff, Debian, devscripts, diff, git, nuggets, SAK, svn, Swiss Army Knife, UUUT, Victorinox, wdiff
// show without comments // write a comment