ftblog

:: widerstand zwecklos ::
email jabber gpgkey
hackergotchi

September 07, 2008

Wehret den Anfängen

Filed under: news -- 18:17

Natürlich nur gegen Terroristen wenden wir das alles an.
Oh, warte für spielende Kinder machen wir gerne ne Ausnahme...

Gut, England. Aber wie gesagt...

August 31, 2008

VCSs and PS1

Filed under: computer -- 19:01

Recently, mika asked me if it would be possible to add information from version
control systems to the grml prompt. We had some code for this in the grml prompt
already (based on a blog posting by Mike Hommey). It wasn't enabled by default
and it was not exactly flexible.

Also the git-support, I added to *my* prompt was vastly superior to what the
disabled code in the grml zshrc could do.

So, I put some time into a (hopefully) powerful system that provides information
for prompts about several VCSs. It depends on a lot of zsh features, so you can
stop reading now, if you don't use it.

vcs_info() features code from my old git-only prompt, ideas from Mike Hommey's
__vcs_dir() solution and a bazaar backend from martin f. krafft's zshrc.

The system relies on the PROMPT_SUBST option to be set, so include something
like the following in your configuration:

setopt prompt_subst

Another thing, that is required, is a function called check_com. It is included
in the grml zshrc, and my config has a similar function. If you use neither of
these configurations, you can use the following snippet (that's simpler but does
everything needed here):

check_com () {
    shift # throw away the -c option used in vcs_info()
    [[ -n ${commands[$1]} ]] && [[ -x ${commands[$1]} ]] && return 0
    return 1
}

That should be all you need. There are still calls to sed and awk in there. But
normal unix-like systems should have those.

Now, to get the system running, let's add it to our prompt:

% PS1='%2~$(vcs_info)%# '

vcs_info() screenshot 0

Whoops, nothing happened?
Well, yes. In that picture, I'm not in a version-controlled directory, so the
system should damn well shut the hell up.

So, let's go to a mercurial repository and see what happens:

vcs_info() screenshot 1

Don't like format, vcs_info() uses to display the information? No problem, you
can define that completely to your liking:

% zstyle ':vcs_info:*' promptformat '-|%s|-{%b}-'

vcs_info() screenshot 2

Anyway I liked the default format; just a little dull. Let's spice things up by
some colors:

% autoload colors ; colors
% PS1='%{$fg[yellow]%}%2~%{$reset_color%}$(vcs_info)%# '

vcs_info() screenshot 3

Well, better. We *could* give the complete output of vcs_info() an own color,
but really, we can do better, so we should (using variables to make the lines
shorter):

% pS="%{${fg[magenta]}%}(%{${reset_color}%}%s%{${fg[magenta]}%})"
% pYD="%{${fg[yellow]}%}-"
% pND="%{${reset_color}%}-"
% pBO="%{${fg[magenta]}%}["
% pBC="%{${fg[magenta]}%}]"
% pBR="%{${fg[green]}%}%b"
% pYP="%{${fg[yellow]}%}|"
% pA="%{${fg[red]}%}%a"
% pactionformat=" $pS$pYD$pBO$pBR$pYP$pA$pBC$pND"
% pformat=" $pS$pYD$pBO$pBR$pBC$pND"
% zstyle ':vcs_info:*' promptactionformat $pactionformat
% zstyle ':vcs_info:*' promptformat $pformat

vcs_info() screenshot 4

Yeah, nicer. But what's promptactionformat?
That is a format, that is used when your vcs is currently in a non-default
state (like a conflicting merge). Currently, it is only used by the git backend,
and looks something like this, when I do a very dumb interactive rebase that
cannot work out:

vcs_info() screenshot 5

The red 'rebase-i' tells us, we are currently in the process of resolving a
conflict due to an interactive rebase. There are other states, that are reported
just like this, too.

Also note, that the '%s' replace changed to 'git' when I changed into the git
import of the 'grml-etc-core' repository.

vcs_info() supports eight different VCSs (git, hg, bzr, darcs, mtn, svn, svk
and cvs).

The different backends are only used, if the according client software was
found. So, the darcs backend will only be used, if the 'darcs' program was found
- no matter if the current directory is a darcs repository or not.

If you still want to disable some of the backends (for performance reasons), you
can do so by:

% zstyle ':vcs_info:*' disable svn mtn svk darcs

So, if we were in a svn repository, when we executed this command, we'll see:

vcs_info() screenshot 6

Oh, and nothing stops you from using vcs_info() in your RPROMPT:

vcs_info() screenshot 7

One last thing, I want to address is the bzr backend. The default backend uses
the 'bzr' command directly. That is awfully slow. Really annoyingly slow.

I added another bzr backend. However, I'm not a bzr user myself, so I really
don't know if it is the right way to go.

It does produce the same results as the default one for me in my test
repository; but that's obviously a very very simple case. Its major upside is,
that it works instantaneously.

If you are a bzr user, please try the simpler backend by using the following
command:

% zstyle ':vcs_info:bzr' use-simple true

If it works correctly for complex repositories, please report. ...and if it
doesn't, tell me what fails. :-)

For your convenience, I put the whole code needed for vcs_info() in to a
separate file, which reflects today's version of it: vcs_info.zsh

It includes a fairly complete documentation comment, that you should take a look
at, if you want to set vcs_info() up the way *you* like.

My own zshrc and the grml zshrc have vcs_info() enabled by default.

August 16, 2008

Brauchbarkeit...

Filed under: computer -- 01:58

82 Zeilen diff für die zsh erzeugen...

cvs diff -u > ~/zsh_cvs.diff 0.07s user 0.02s system 0% cpu 21.349 total

vs. (in einem git-import des zsh Repositories)

git --no-pager diff > ~/zsh_git.diff 0.07s user 0.01s system 88% cpu 0.091 total

Jaja, ein grosser Grund für den Unterschied ist natürlich das Netz, das CVS
für die Aktion bemühen muss.
    ...spielt für die gefühlte Brauchbarkeit aber keine Rolle.

July 05, 2008

Frag Katholi!1!!

Filed under: entertainment -- 11:28

Das grossartige extra3 vom NDR zum Thema katholische Kirche. Mehr davon!

July 01, 2008

FZ vs. * (Take one)

Filed under: entertainment -- 22:40

Zitat aus einem Interview mit Frank Zappa. Sehr schön.

Interviewer:
  "So Frank, you have long hair. Does that make you a woman?"
Frank Zappa:
  "You have a wooden leg. Does that make you a table?"

Sick Sad World #4

Filed under: news -- 19:46

Bei dem, was mir grad im Times Feed ins Haus flatterte, bleibt mir dann
wirklich die Spucke weg. Man lese selbst.

SZ und Spiegel haben offenbar auch schon drüber berichtet.

Und bei der SZ steht dann am Ende noch:

Zuletzt wurde 2006 eine Schwangere im US-Staat Illinois ermordet,
nachdem ihr das ungeborene Kind aus dem Bauch geschnitten worden war.

So eine Scheiße ist schon öfter vorgekommen? Ich glaube, ich muß meine
Hemmschwelle mal der Realität anpassen.

June 20, 2008

Sick Sad World #3

Filed under: news -- 15:29

Feuerzeug, Lösungsmittel, Mobiltelefon mit Kamera?

Hat man alles schon mal in der Hand gehabt. Drei Arschlöcher aus Spanien, im
Alter von 15 und 16 Jahren haben mit diesen Dingen jedoch in deutlicher Art
und Weise klar gemacht, daß sie absolut keinen Platz in einer zivilisierten
Gesellschaft wollen. Gratulation. Damit teilen die drei sich den heutigen
WWP Award (World's Worst Person). [Quelle: Spiegel]

Verbrennen? Und an den Qualen ergötzen? Un-fass-bar.

Sind ja noch Kinder... ...fünf Jahre müssen da reichen. Ich bin ja kein
Rechtsexperte, ich nehme mal an, das wird das Maximum sein, das man da verhängen
kann. Aber mit welcher Begründung will man da Jugendstrafrecht anwenden?
'Die wollten nur spielen?' oder wie!? - Jaja, das Alter... schon klar. Aber
wenn jemand so etwas plant und dann kaltblütig durchführt, dann fällt es mir
schon schwer, einen Jugendlichen darin zu erkennen.

June 18, 2008

Fokus Hüpfen deluxe

Filed under: computer -- 23:33

Ooookay... Gerade mal nach Firefox3 geupdated. Fühlt sich bisher ganz okay
an. Bis auf eine Sache...

Wenn ihr auch zu denen gehört, die gerne mal Tabs über von aussen an den
Firefox schicken (meine lookup() zsh Funktion zum Beispiel; oder öffnen von
Links aus Liferea heraus), dann werdet ihr ziemlich schnell angepisst sein
von der Tatsache, daß Firefox sich wegen jedem Mist in den Fokus drängt.

Bei mir läuft Firefox per fvwm-Style immer auf einem bestimmten Desktop.
Und so sprang mein Windowmanager wegen jedem Furz auf meinen
Firefox-Desktop... Zum verrückt werden. Nach fünf Minuten.

Style "*"           !FPFocusByFunction

Das löst das Problem. Andere Windowmanager können das sicherlich auch.

[Update]

Streicht das.
Das macht natürlich den Fokuswechsel per ALT-Tab Funktion kaputt... Das kann
man nicht ernsthaft wollen. Ich schon mal gar nicht.

Es gibt einen 'extended window manager hint' (EWMH) der zum aktivieren eines
Fensters gedacht ist.

FVWM handled diesen über die Funktion EWMHActivateWindowFunc, die standardmäßig
wie folgt aussieht:

DestroyFunc EWMHActivateWindowFunc
AddToFunc EWMHActivateWindowFunc
+ I Iconify Off
+ I Focus
+ I Raise

Eine EWMH-konforme Taskbar könnte so zum Beispiel ein Fenster in den Vordergrund
drücken.

Firefox schiebt sich so mit Macht in der Vordergrund. Auch über meine
Desktopgrenzen hinweg. Ich habe noch keine Möglichkeit gefunden, dem Programm
das abzugewöhnen. Aber da ich keine solche Taskbar habe (und auch niemals haben
möchte), löse ich mein Problem nun einfach dadurch, daß ich besagte Funktion
einfach auslösche:

DestroyFunc EWMHActivateWindowFunc

Done. (Wenn jemand weiss wie man dieses Verhalten dem Firefox abgewöhnen kann:
immer her mit Lösungen.)

[Update 2.0]

deifl weisst mich darauf hin, das es zu diesem ekeligen Verhalten vom Firefox
seit einem knappen halben Jahr einen Bugreport gibt, der das bemängelt. :-/

May 30, 2008

Angewohnheiten

Filed under: computer -- 10:11

Auch wenn ich vim mit gut zehn Jahren schon recht lange nutze, mache ich von
einigen sehr nützlichen Features viel zu selten Gebrauch. Und wie Bram Moolenaar
in seinem sehr nützlichen Video richtig bemerkt, muß man sich dazu zwingen diese
Dinge zu nutzen bis sie einem in Fleisch und Blut übergegangen sind.

Dinge, die ich bei vim mehr nutzen möchte:

    - marks
        m<mark-char>: 'ma' Setzt eine Marke mit dem Namen 'a' an der
        momentanen Position. Per `a, 'a (oder in meinem Setup: äa).
        Zwischen den letzen beiden Marken springt man mit: ''
    - registers
        "<register-char>: "qdiw löscht das Wort auf dem der Cursor
        gerade steht Das Wort wird ins 'q' Register kopiert. Das ist ein
        anderes als die Lösch- und Kopierbefehle normalerweise nutzen.
        Man kann damit nun machen, was man will; es zum Beispiel an
        beliebiger Stelle einfügen, mit: "gp
    - text objects
        is, iw, as or aw: {inner,a}-{sentence,word}
    - X im Normal Mode anstelle von Backspace im Insert Mode nutzen.
    - db (anstelle von ^W im Insert Mode) und dw im Normal Mode nutzen.
    - Benutze c (change) anstelle von d (delete) und in den Insert Mode
      wechseln.
    - Nutze I anstelle von Caret-i.
    - Magie im Insert Mode
        - completions
            ^P,^N   normale Wort Komplettierung
            ^X^F    Datennamen Komplettierung
            ^X^D    Macro Definitionen
            ^X^I    momentane&benutzte Dateien
            ^X^K    Wörterbuch Worte
            ^X^]    komplettiere Tags
            ^X^O    Omni-Completion
        - Duplizieren der vorherigen und nächsten Zeile
            ^Y      kopiere Zeichen von der vorherigen Zeile
            ^E      kopiere Zeichen von der nächsten Zeile
        - Registerinhalte direkt im Insert Mode einfügen
            ^R      ^Rr fügt den Inhalt des 'r' Registers ein.
        - Besondere Zeichen einfügen
            ^K      Fügt Zeichen, die nicht auf jeder Tastatur vorkommen
                    ein; Für Details: ':digraphs'
        - Den Insert Mode für *ein* Normal Mode Kommando verlassen
            ^O

May 29, 2008

Einige Leute...

Filed under: entertainment -- 19:06

Oh, wie recht er hat.
George Carlin: Some people are stupid

May 24, 2008

SYSHH#4

Filed under: entertainment -- 22:03

Bei Deep Purple kann ich mich natürlich eigentlich nicht auf einen einzigen
Song festlegen. "Hush" ist aber einer meiner Lieblingssongs und mir ist gerade
aufgefallen, das der Song nunmehr vierzig(!) Jahre alt ist.

Definitely a "song you should have heard"...

np: Deep Purple - Shades of Deep Purple - Hush

<Album Version auf youtube>
<Merkwürdige Live Version aus der Playboy Villa>

May 22, 2008

Sick Sad World #2

Filed under: news -- 19:51

Eigentlich hatte ich gehofft, daß es in dieser Minikategorie nicht so schnell
so viele Einträge geben würde...

...aber Fabian macht mich gerade auf diese Geschichte aufmerksam.

Nur ist das Ganze leider wieder keine Geschichte aus der Feder irgendeines
merkwürdigen Autors. Wie abgefucked muß dein Leben denn bitte sein, damit du
mit sieben oder neun Jahren auf so eine beschissene Idee kommst!?

Powered by zblog
valid css | valid xhtml | utf-8 encoded | best viewed with anybrowser