Mon, 06 Sep 2010
How to make a checklist in HTML
In my ongoing quest to get rid of unnecessary use of WinWord, I moved a two-page checklist into our internal wiki. Unfortunately I came across two problems while doing that:
- HTML <li>s don't support big empty circles. They default to black bullets, and the CSS {"list-style-type: disc;} only creates tiny circles.
Unicode to the rescue: \x25EF, also known as \N{LARGE CIRCLE} or ◯
makes a fine replacement. Two lines of CSS to fix your list:
ul { list-style-type:none; }
ul li:before { content: "\25EF"; }
- No page breaks. The list was on two pages for a reason and I needed to keep it that way. That was easily fixed by inserting
<br class="break" />
and making the break with CSS:
br.break { page-break-before: always; }
My first attempt was to use a <hr> instead – but strangely enough it made Firefox print another empty page at the beginning when used inside our wiki.
Putting it all together for TWiki:
<!-- <pre> -->
<style type="text/css" media="all">
br.pagebreak { page-break-before: always; }
.patternTopic > ul { list-style-type:none; }
.patternTopic > ul > li:before { content: "\25EF"; }
</style>
<!-- </pre> -->
The .patternTopic makes it only apply within the article, and the > makes it only apply on the first level after that.
– Sec
posted at: 19:02
| Category:
/tidbits
|
permanent link to this entry
|
0 comments
(
trackback)
Wed, 30 Jun 2010
RAID5 recovery interlude
Last time we discussed the block order of linux-mdraid.
How do you find out which block order your RAID has?
The simplest way requires a working RAID to test against. (Ray created a small (50MB) test-RAID for that). First we get the first few blocks from each raw disk:
for $disk in sda1 sdb1 sdc1 sdd1 ;do
for $nr in 0 1 2 3 4;do
dd if=/dev/$disk skip=$nr count=1 bs=16k of=B.$disk.$nr
done
done
dd if=/dev/md0 bs=16k count=20 of=RAID
Note that this assumes your stripe-size is 16k. If you know it is different, change it, if not you will find out later and have to retry with an adjusted value.
Now try to match up the first block with the RAID contents like this:
cat B.sda1.0 | cmp - RAID
If the block matches, you will get:
cmp: EOF on stdin
If the block is the wrong one:
stdin RAID differ: char 1, line 1
If none of your first blocks (the files ending with .0) match, either your block-size is too big (try again with half the previous size) or your RAID prefixes the disks with some internal bookkeeping info (in that case you can try to start with later blocks)
Now try to match the next blocks by adding then one by one to the cat command line like this:
cat B.sda1.0 B.sdb1.0 | cmp - RAID
that way you will easily recover the block allocation order of your RAID.
For example our linux-mdraid starts like this:
cat B.sda1.0 B.sdb1.0 B.sdc1.0 B.sdd1.1 B.sda1.1 ...
After that, its only a two-line patch to raidextract to fix that – hope you know C ;-)
That concludes our intermission for today. Tomorrow we will see why all this work wasn't even necessary.
– Sec
posted at: 21:06
| Category:
/tidbits
|
permanent link to this entry
|
0 comments
(
trackback)
RAID5 recovery (Part II)
We left our heroes yesterday with a broken RAID 5 due to read errors on multiple disks. (Read part I: here)
A great starting point is raidextract by Peter Benie which attempts to re-assemble a RAID5. His web-page on this tool also serves as a great overview in the inner workings of standard RAID 5.
The first problem we stumbled upon is the fact that it assumes a certain pattern of the Parity blocks. (All examples from here on assume 4 disks, since that is what we had. But of course that's all applicable to any number of disks)
Adapting the example from his page:
| D1: | P | 3 | 6 | 9 | P | 15 | 18 | 21 | ... |
|
| D2: | 0 | P | 7 | 10 | 12 | P | 19 | 22 | ... |
|
| D3: | 1 | 4 | P | 11 | 13 | 16 | P | 23 | ... |
|
| D4: | 2 | 5 | 8 | P | 14 | 17 | 20 | P | ... |
|---|
Our Linux-mdraid unfortunately didn't conform to this expectation. Not only does it start with parity on the last disk (which raidextract would support with --rotate), but it also moves the parity block 'backward' instead of 'forward'.
The correct allocation order looks like this:
| D1: | 0 | 4 | 8 | P | 12 | 16 | 20 | P | ... |
|
| D2: | 1 | 5 | P | 9 | 13 | 17 | P | 21 | ... |
|
| D3: | 2 | P | 6 | 10 | 14 | P | 18 | 22 | ... |
|
| D4: | P | 3 | 7 | 11 | P | 15 | 19 | 23 | ... |
|---|
A quick&dirty hack to raidextract to implement this order:
--- raidextract.c 2008-07-26 11:33:53.000000000 +0200
+++ raidextract-new.c 2010-06-28 13:49:54.000000000 +0200
@@ -316,8 +316,10 @@
int paritydisk=(stripe / (disks-1) + rotate) % disks;
int len=stripesize-offset;
int bytes;
+ int ndisk;
char *ptr;
+ ndisk=(disk-paritydisk+3)%disks;
if (!noparity && paritydisk <= disk) disk++;
if (len>raidlen) len=raidlen;
if (winoffset+len > datasize) len=datasize-winoffset;
@@ -337,7 +339,7 @@
raidstart+=len;
raidlen-=len;
- ptr=window[disk][windowalt]+winoffset;
+ ptr=window[ndisk][windowalt]+winoffset;
while (len)
{
bytes=write(STDOUT_FILENO, ptr, len);
A run on an error-free test-RAID confirms this and extracted it correctly. Yay!
continued in part III, coming soon
– Sec
posted at: 02:26
| Category:
/tidbits
|
permanent link to this entry
|
0 comments
(
trackback)
Mon, 28 Jun 2010
RAID5 recovery (Part I)
The Munich CCC fileserver uses (as many other servers) software RAID 5 amongst its disks. We all (should) know that RAIDs are no substitute for backups, which was reinforced by a recent problem we had. While RAID level 5 can recover gracefully from a single failed disk, it generally can't cope with multiple failed disks at the same time.
One of the problems with large harddisks is, that there may be yet undetected errors on it, just because you haven't attempted to read that part for quite some time. Now when you start a rebuild of a RAID5, these errors quickly pop due to the rebuild process needing to read all the data. This is the main reason why you should regularly run complete surface scans on your RAID arrays.
Almost all RAID implementations tend to mark a whole disk as failed as soon as it contains a single error. This becomes a problem as soon as you detect a second error on your currently degraded RAID you are just attempting to rebuild.
Fortunately there is still hope. If the errors on your failing disks occur on non-overlapping points of the array, you can recover a complete copy of your data by assembling just the right pieces. But unfortunately there appears to be no hardware or software RAID solution able to do that out of the box. So we're left to try this manually.
more on this saga in part II, coming soon…
– Sec
posted at: 19:23
| Category:
/tidbits
|
permanent link to this entry
|
0 comments
(
trackback)
Mon, 21 Jun 2010
Filmfest München 2010
Huch, schon steht es vor der Tür – Das diesjährige FilmFest.
Dieses Jahr sinds doch wieder 24 Filme geworden, obwohl «Tod in Istanbul» leider schon ausverkauft war. Mit von der Partie sind diesmal 3 Mitternachtsfilme, das wird vermutlich ein wenig anstrengend, dieses Jahr %-)
Wenn jemand von euch in einen gleichen Film geht kann er sich ja melden ;-)
vollständige Liste...
posted at: 11:58
| Category: /misc
| permanent link to this entry
| 1 comment
(trackback)
Fri, 16 Apr 2010
Das eHaserl und der Funkchip
Für alle dies bisher nicht mitbekommen haben, die Kurzzusammenfassung:
Auf der Easterhegg gabs als Badge
das Haserl
. Fertig bestückt mit einer kleinen analogen Schaltung die die LEDs bei Dunkelheit leuchten lässt.
Mehr Text und Bilder hier...
posted at: 22:20
| Category: /tidbits
| permanent link to this entry
| 0 comments
(trackback)
Thu, 15 Apr 2010
Sshd ohne x11 auf Ubuntu
Danke zu freundlich, aber ich will wirklich nicht
So gings mir heute mit Ubuntu. Ich wollte einen sshd installieren, aber auch wirklich nur einen sshd, und kein X11. Ubuntu ist aber wohl leider der Meinung ein X11 gehört auf jedes System. apt-get install openssh-server sagt u.a.:
The following NEW packages will be installed:
adduser libedit2 libkeyutils1 libkrb53 libwrap0 libx11-6 libx11-data libxau6
libxcb1 libxdmcp6 libxext6 libxmuu1 openssh-client openssh-server tcpd
x11-common xauth
Was tun? Nach ein bisschen frickeln bin ich auf folgende, an sich recht einfache, Lösung gekommen:
apt-get install -d openssh-server
cd /var/cache/apt/archives
dpkg -i openssh-server* openssh-client* libwrap* libedit2* libkrb53* adduser* libkeyutils1*
apt-get clean
Voilà. Kein Plattenplatz im chroot für nix verschwendet. Yay!
– Sec
posted at: 17:23
| Category:
/tidbits
|
permanent link to this entry
|
2 comments
(
trackback)
Tue, 09 Feb 2010
Fundstück der Woche
Gerade diesen wunderbaren Zettel gesehen:
(Liebe Mitmenschen ...)
Ehrlich gesagt sieht das wirklich mehr nach Mülleimer aus, besonders von
leicht weiter weg:
(Mülleimer?)
– Sec
posted at: 14:10
| Category:
/moblog
|
permanent link to this entry
|
0 comments
(
trackback)
Thu, 12 Nov 2009
Wikimedia mini-fail
Wie sagt man so schön? Traue keiner Statistik die du nicht selber gefälscht hast.
Aus dem Tätigkeitsbericht 2008 der Wikimedia Deutschland. (Ja, genau die, die Kritik nicht vertragen.
Fällt euch was auf?
Neueintritte Wikimedia Deutschland 2004 bis 2008:
So macht man sich elegant mal eben doppelt so groß :-)
– Sec
posted at: 12:32
| Category:
/soapbox
|
permanent link to this entry
|
1 comment
(
trackback)
Mon, 02 Nov 2009
Yet Another xkcd-titles greasemonkey script update
The Greasemonkey-script to insert xkcds image title tags broke yet again. This time Randall Munroe added a link around the image which my script didn't expect. Seeing that the last breakage is over a year in the past, I think this is a good track record :-)
Without much further ado, here is the fixed version: xkcd-titles.v4.
– I hope it works for you :)
– Sec
posted at: 13:37
| Category:
/tidbits
|
permanent link to this entry
|
0 comments
(
trackback)
Sat, 31 Oct 2009
Firefox-Addons und die Startreihenfolge
(Oder auch: Hilfe, mein Echofon ist nicht mehr rechts :-)
Ich bin ja seit längerem Fan von echofon (also, damals als es noch Twitterfox hieß). Beim letzten Update/Neustart von Firefox war das Icon von Echofon nicht mehr rechts unten in der Ecke der Statuszeile sondern deutlich weiter links. Verdrängt von lauter anderen Extension-Icons (NoScript, Operator, HTML Validator, Greasemonkey, Firebug, FoxyProxy, CookieSafe, Ghostery, RefControl, Adblock Plus, NoSquint, Read It Later)
(Wann gründet eigentlich mal jemand die Selbsthilfegruppe anonymer Extension-Süchtiger?)
Naja, zumindest war das Icon nicht mehr rechts, was ich ja noch verschmerzen könnte, aber auch das Popup-Window war über dem Icon, und somit Mitten in der Seite.
Nun, was tut der findige Geek? Nachdem man die Position nicht konfigurieren kann, muss sie wohl an der Startreihenfolge der Add-Ons liegen. Also flugs mal Echofon ans ende der Liste gepackt, und siehe da, beim nächsten restart ist Echofon wieder brav am rechten Rand. Yay!
Welche Liste, fragt ihr?
%PROFILEDIR%/extensions.ini.
Die enthält lauter Zeilen der Form:
Extension%nummer%=%EXTENSIONPFAD%
Nun einfach Echofon mit dem letzten Platz der Liste vertauschen. Nicht vergessen die Nummer am Anfang der Zeile anzupassen, und fertig.
Echofon ist übrigens die Extension die mit "twitternotifier@naan.net" aufhört.
– Sec
posted at: 17:19
| Category:
/tidbits
|
permanent link to this entry
|
2 comments
(
trackback)
Wed, 07 Oct 2009
Viele bunte Passwörter
Grade geisterte durch die Medien das eine Liste mit 10000 hotmail Passwörtern aufgetaucht sei. Das hat mich als Sysadmin natürlich gleich interessiert.
10 Minuten, und einen Bittorrent-Client später hatte ich dann auch ein File:
karoshi:~>cat hotmail.csv|wc -l
11017
Nun aber die Preisfrage weshalb mich das File interessiert hatte:
Was ist das häufigste Passwort in der Liste?
Mehr nach dem Weiterklick...
posted at: 19:26
| Category: /tidbits
| permanent link to this entry
| 1 comment
(trackback)
Thu, 17 Sep 2009
Hilfe, ich seh' nix mehr!
Unter Ubuntu gibt es mittlerweile eine sogenannte Bildschirmlupe
die man hervorragend aus Versehen
aktivieren kann. In Wirklichkeit ist das aber keine Lupe, denn es wird einfach nur der gesamte Bildschirm um ca. Faktor 4 vergrößert. Verstellen kann man die Vergrößerung dann per Windows+Mausrad.
Wer das loswerden will, dem sei hier ein:
sudo gconftool-2 -u /desktop/gnome/applications/at/screen_magnifier_enabled
und/oder ein
empfohlen.
– Sec
posted at: 14:19
| Category:
/tidbits
|
permanent link to this entry
|
1 comment
(
trackback)
Wed, 16 Sep 2009
Piraten in München
Heute fast direkt vor der Arbeit auf dem Weg zum Mittagessen gesehen:
Klarmachen zum Ändern!
(48°7'44.64"N,11°35'38.61"E)
Yay! für Piratenwerbung. Ich hoffe sie hilft.
Wählen darf ich hier ja leider nicht.
– Sec
posted at: 23:48
| Category:
/moblog
|
permanent link to this entry
|
0 comments
(
trackback)
Fri, 07 Aug 2009
Eine Regenbogen-Welt ist das hier
Gerade auf dem Weg zum Mittagessen auf dem Boden entdeckt:
(Graffiti, 48°7'44.76"N,11°35'37.70"E)
Bizarr. Erinnert mich spontan irgendwie an Planet Unicorn. :-)
– Sec
posted at: 16:09
| Category:
/moblog
|
permanent link to this entry
|
1 comment
(
trackback)