<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[noqqe.de]]></title>
  <link href="http://noqqe.de/atom.xml" rel="self"/>
  <link href="http://noqqe.de/"/>
  <updated>2012-05-14T15:36:28+02:00</updated>
  <id>http://noqqe.de/</id>
  <author>
    <name><![CDATA[Florian Baumann]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[LXC. Not ready yet for production use, huh?]]></title>
    <link href="http://noqqe.de/blog/2012/05/14/lxc-not-ready-for-production-huh/"/>
    <updated>2012-05-14T15:30:00+02:00</updated>
    <id>http://noqqe.de/blog/2012/05/14/lxc-not-ready-for-production-huh</id>
    <content type="html"><![CDATA[<p>Von <a href="http://lxc.sourceforge.net">LinuX Containern</a> hab ich zum ersten Mal auf den
Linux Tagen im <a href="http://chemnitzer.linux-tage.de/2012/vortraege/1035">Vortrag</a>
von <a href="http://linsenraum.de/erkules">Erkan Yanar</a> gehört.</p>

<p>Kurz gesagt ist LXC größtenteils eine Sammlung von Skripten welche in
soetwas wie einem <code>chroot</code> einen neuen init-Prozess spawnen. Das bietet mit
cgroups in eigenen Namespaces auch eine Art dynamische Ressourcen Zuweisung.</p>

<p><img class="center" src="http://noqqe.de/uploads/2012/05/xzibit-virtualisierung.jpg"></p>

<p>Dafür gibts jetzt verschiedene Use-Cases. Bei mir ist das sowas wie eine Art
Sandboxing für Spielereien auf meinem Thinkpad.</p>

<blockquote><p>I said before that in my opinion LXC is not ready yet for production use, and I<br/>maintain that opinion today. I would also rephrase it in something that might<br/>make it easier to understand what I think: I would never trust root on a<br/>container to somebody I wouldn’t trust root with on the host.</p><footer><strong>Diego Elio “Flameeyes” Pettenò,</strong> <cite><a href='http://blog.flameeyes.eu/2010/06/lxc-and-why-it-s-not-prime-time-yet'>blog.flameeyes.eu</a></cite></footer></blockquote>


<p>Das Zitat triffts eigentlich recht gut auf den Punkt. Besonders gefährlich ist
das gemeinsam genutzte /dev und /proc Verzeichnis, wobei es unter Umständen auch
einfach möglich ist die gesamte Maschine herunterzufahren. Deshalb würde ich
davon abraten virtuelle Maschinen an Dritte abzugeben.</p>

<h2>LXC: Debian Stable oder Testing?</h2>

<p>Trotz allem reizt mich das Thema. Installiert wird das wie so ziemlich alles
über</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ apt-get install lxc bridge-utils debootstrap</span></code></pre></td></tr></table></div></figure>


<p>Allerdings gibt es bei testing und auch bei stable Nachteile.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ apt-cache policy lxc
</span><span class='line'>lxc:
</span><span class='line'>  Installiert: 0.7.2-1
</span><span class='line'>  Kandidat:    0.7.2-1
</span><span class='line'>  Versionstabelle:
</span><span class='line'>     0.8.0~rc1-4 0
</span><span class='line'>        500 ftp://ftp.de.debian.org/debian/ testing/main amd64 Packages
</span><span class='line'> *** 0.7.2-1 0
</span><span class='line'>        990 http://ftp.uni-erlangen.de/debian/ squeeze/main amd64 Packages
</span><span class='line'>        100 /var/lib/dpkg/status</span></code></pre></td></tr></table></div></figure>


<ul>
<li>Testing: Im Moment scheinen die cgroups kaputt. Dafür konnte ich keine Lösung
finden da ich auch noch keine Erfahrung mit cgroups habe. Schade. Verison 0.8 hätte mich gereizt.</li>
</ul>


<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ lxc-start --name vm0
</span><span class='line'>lxc-start: No such file or directory - failed to rename cgroup /sys/fs/cgroup//14051->/sys/fs/cgroup//vm0/14051
</span><span class='line'>lxc-start: failed to spawn 'vm0'
</span><span class='line'>lxc-start: No such file or directory - failed to remove cgroup '/sys/fs/cgroup//vm0/14051'</span></code></pre></td></tr></table></div></figure>


<ul>
<li>Stable: Unter Stable ist kein Template für Debian Squeeze verfügbar. Da
heissts dann Lenny Template <a href="http://jtrancas.wordpress.com/2011/02/10/debian-squeeze-lxc-template/">umbauen</a>.
Anleitung ist recht einfach zu verstehen und funktioniert.</li>
</ul>


<h2>Networking über WLAN</h2>

<p>Das mit dem normalen Bridiging über WLAN Interfaces haut erfahrungsgemäß nicht
hin. Deshalb hab ich mir <a href="http://s3hh.wordpress.com/2011/05/17/lxc-containers-on-a-host-with-wireless/">hier</a>
etwas helfen lassen. Meine Config sieht und in etwa so aus:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>auto lxcbr0
</span><span class='line'>iface lxcbr0 inet static
</span><span class='line'>  address 10.10.0.1
</span><span class='line'>  netmask 255.255.255.0
</span><span class='line'>  pre-up brctl addbr lxcbr0
</span><span class='line'>  post-up /usr/local/bin/lxcbr0-up
</span><span class='line'>  post-down brctl delbr lxcbr0</span></code></pre></td></tr></table></div></figure>




<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ cat /usr/local/bin/lxcbr0-up
</span><span class='line'>#!/bin/sh
</span><span class='line'># This is the address we assigned to our bridge in /etc/network/interfaces
</span><span class='line'>braddr=10.10.0.1
</span><span class='line'># ip address range for containers
</span><span class='line'>brrange=10.10.0.10,10.10.0.100
</span><span class='line'>iptables -A FORWARD -i lxcbr0 -s ${braddr}/24 -m conntrack --ctstate NEW -j ACCEPT
</span><span class='line'>iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
</span><span class='line'>iptables -A POSTROUTING -t nat -j MASQUERADE 
</span><span class='line'>dnsmasq --bind-interfaces --conf-file= --listen-address $braddr --except-interface lo --dhcp-range $brrange --dhcp-lease-max=253 --dhcp-no-override</span></code></pre></td></tr></table></div></figure>


<p>Wenn man das ohne DHCP möchte geht das auch einfach so - ohne Umkonfiguration :)</p>

<h2>Mass-LXC</h2>

<p>Ich möchte meine Linux Container nun immer in einem <code>screen</code> starten. Ein Start
sieht daher ungefähr immer so aus:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ screen -d -m -S vm0 lxc-start -n vm0 -f /var/lib/lxc/vm0/config</span></code></pre></td></tr></table></div></figure>


<p>Aus erst einem Alias wurden dann Mehrere und dann ein Wrapper Script
mit dem ich Infos und Start/Stops für alle VMs auslesen/anweisen kann.
Ich muss zugeben es ist etwas ausgeartet.
Das Script ist wie immer auf <a href="https://gist.github.com/2693967">Github</a> zu haben. Unter Umständen kann
nochjemand etwas damit anfangen.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ mlxc info
</span><span class='line'>Screens:
</span><span class='line'>No Sockets found in /var/run/screen/S-root.
</span><span class='line'>
</span><span class='line'>LXC Status:
</span><span class='line'>'vm0' is STOPPED
</span><span class='line'>'vm1' is STOPPED
</span><span class='line'>'vm2-mysqld' is STOPPED
</span><span class='line'>'vm3-postgresql' is STOPPED
</span><span class='line'>'vm4-matomat' is STOPPED
</span><span class='line'>
</span><span class='line'>$ mlxc all
</span><span class='line'>$ mlxc info
</span><span class='line'>Screens:
</span><span class='line'>There are screens on:
</span><span class='line'>  8682.vm0  (14.05.2012 15:29:47) (Detached)
</span><span class='line'>  8686.vm1  (14.05.2012 15:29:47) (Detached)
</span><span class='line'>  8690.vm2-mysqld (14.05.2012 15:29:47) (Detached)
</span><span class='line'>  8694.vm3-postgresql (14.05.2012 15:29:47) (Detached)
</span><span class='line'>  8698.vm4-matomat  (14.05.2012 15:29:47) (Detached)
</span><span class='line'>5 Sockets in /var/run/screen/S-root.
</span><span class='line'>
</span><span class='line'>LXC Status:
</span><span class='line'>'vm0' is RUNNING
</span><span class='line'>'vm1' is RUNNING
</span><span class='line'>'vm2-mysqld' is RUNNING
</span><span class='line'>'vm3-postgresql' is RUNNING
</span><span class='line'>'vm4-matomat' is RUNNING
</span><span class='line'>
</span><span class='line'>$ mlxc net
</span><span class='line'>Netstat for vm0:
</span><span class='line'>IP: 10.10.0.10
</span><span class='line'>Aktive Internetverbindungen (Server und stehende Verbindungen)
</span><span class='line'>Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
</span><span class='line'>tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      10815/sshd      
</span><span class='line'>tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      10728/master    
</span><span class='line'>[...]</span></code></pre></td></tr></table></div></figure>


<p>Auf Ideen, Anmerkungen, Kritik und Beleidigungen freu ich mich natürlich immer.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Deadly 30 unter Debian Squeeze 64bit]]></title>
    <link href="http://noqqe.de/blog/2012/05/06/deadly-30-unter-debian-squeeze-64bit/"/>
    <updated>2012-05-06T21:51:00+02:00</updated>
    <id>http://noqqe.de/blog/2012/05/06/deadly-30-unter-debian-squeeze-64bit</id>
    <content type="html"><![CDATA[<p>Gerade von <a href="http://www.deadly30.com/index.php">Deadly 30</a> gelesen. Linux Version
ist fertig. Hurra!</p>

<p>Als ich den Trailer gesehen habe musste ich sofort an die <a href="http://de.wikipedia.org/wiki/Metal_Slug">Metal Slug
Reihe</a> denken, die ich total mag.</p>

<p>Egal, es ist Sonntag Abend und hatte die 4 Euro übrig. Ich hatte aber bereits
erwartet, dass es nicht nur auf ein <code>./deadly\ 30</code> hinauslaufen würde. Damit lag
ich auch richtig.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ ./Deadly\ 30
</span><span class='line'>./Deadly 30: error while loading shared libraries: libgstreamer-0.10.so.0:
</span><span class='line'>cannot open shared object file: No such file or directory</span></code></pre></td></tr></table></div></figure>


<p>Mh. Da ich nicht zwischen 32 und 64bit wählen durfte wahrscheinlich 32bit?</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ file Deadly\ 30                                                                                                                 
</span><span class='line'>Deadly 30: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically
</span><span class='line'>linked (uses shared libs), for GNU/Linux 2.6.15, stripped</span></code></pre></td></tr></table></div></figure>


<p>Also die nötigen 32bit Libraries runterladen und einbauen.</p>

<h2>1. /usr/lib32/ Backup erstellen</h2>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ tar cfvz $HOME/usr-lib32.tar.gz /usr/lib32</span></code></pre></td></tr></table></div></figure>


<h2>2. libgstreamer installieren</h2>

<ul>
<li><a href="http://packages.debian.org/squeeze/libgstreamer0.10-0">http://packages.debian.org/squeeze/libgstreamer0.10-0</a></li>
</ul>


<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ cd /tmp
</span><span class='line'>$ wget http://ftp.de.debian.org/debian/pool/main/g/gstreamer0.10/libgstreamer0.10-0_0.10.30-1_i386.deb
</span><span class='line'>$ ar -x libgstreamer0.10-0_0.10.30-1_i386.deb
</span><span class='line'>$ tar xfvz data.tar.gz
</span><span class='line'>$ sudo cp -av /tmp/usr/lib/* /usr/lib32/</span></code></pre></td></tr></table></div></figure>


<h2>3. libgstreamer-plugins installieren</h2>

<ul>
<li><a href="http://packages.debian.org/squeeze/libgstreamer-plugins-base0.10-0">http://packages.debian.org/squeeze/libgstreamer-plugins-base0.10-0</a></li>
</ul>


<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ cd /tmp
</span><span class='line'>$ wget http://ftp.de.debian.org/debian/pool/main/g/gst-plugins-base0.10/libgstreamer-plugins-base0.10-0_0.10.30-1_i386.deb 
</span><span class='line'>$ ar -x libgstreamer-plugins-base0.10-0_0.10.30-1_i386.deb 
</span><span class='line'>$ tar xfvz data.tar.gz
</span><span class='line'>$ sudo cp -av /tmp/usr/lib/* /usr/lib32/</span></code></pre></td></tr></table></div></figure>


<p>Das ist zwar alles immer total unschön, aber es funktioniert. Außerdem, was tut
man nicht alles für ein bisschen 2D Shooter und Zombies?</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Ext Filesystem Checks vorhersagen]]></title>
    <link href="http://noqqe.de/blog/2012/05/05/ext-filesystem-checks-vorhersagen/"/>
    <updated>2012-05-05T11:33:00+02:00</updated>
    <id>http://noqqe.de/blog/2012/05/05/ext-filesystem-checks-vorhersagen</id>
    <content type="html"><![CDATA[<p>Kernel Updates am Server seiner Wahl einspielen und dann&#8230;warten. Warten auf die erlösenden
ICMP Antworten. Oder bootet die Kiste doch nicht? Alles dauert verdächtig lange. Auch nach 10 Minuten noch nichts.
Gerade wenn man die Zugangsdaten fürs DRAC/ILO rausgekramt hat zeigt sich: Filesystem Check.</p>

<p>Extended Filesystems machen an den folgenden 2 Punkten fest wann fsck&#8217;s passieren:</p>

<ul>
<li>Maximale Anzahl von Mounts</li>
<li>Zeitliche Abstände zwischen den Routine Checks</li>
</ul>


<p>Die Informationen stehen im Superblock einer Parition. Das Tool dumpe2fs stellt diese zur Verfügung:</p>

<pre><code>$ dumpe2fs -h /dev/sda1 
</code></pre>

<p>Das ganze hab ich dann verskriptet. Es &#8220;scanned&#8221; alle gemounteten ext Parititonen und warnt einen, falls die
maximalen Mounts oder die zyklischen Checks anstehen.</p>

<div><script src='https://gist.github.com/2601222.js?file='></script>
<noscript><pre><code>#!/bin/bash
# ext-verify: Verfiy if max mount count or cyclic fsck 
# on ext2,ext3,ext4 filesystems has been reached. 
# Copyright: (C) 2011 Florian Baumann &lt;florian.baumann@noris.net&gt;
# License: GPL-3 &lt;http://www.gnu.org/licenses/gpl-3.0.txt&gt;
# Date: Tuesday 2012-05-04

# Configuration
DUMPE2FS=$(which dumpe2fs)
DUMPOPTS=&quot;-h&quot;
WARNC=0

# Security 
if [ -z &quot;$DUMPE2FS&quot; ]; then
    if [ ! -x $DUMPE2FS ]; then
        echo &quot;ERR: Could not find your dumpe2fs&quot;
        echo &quot;ERR: Are you root?&quot;
        exit 1
    fi
fi

# Parsing functions
function get_value () {
    LANG=C $DUMPE2FS $DUMPOPTS $HDD 2&gt;/dev/null | grep &quot;$1&quot; | sed &quot;s#$1\s*##&quot; | tail -1
    if [ $? -gt 0 ]; then echo &quot;ERR: Could not find value $1&quot; ; fi
}
function convert_date () {
    if [ -n &quot;$1&quot; ]; then
        date -d &quot;$1&quot; &quot;+%s&quot;
    fi
}

# Scan Mode
if [ -z &quot;$*&quot; ]; then
    for x in $(mount | grep ext | awk '{print $1}'); do
        HDD=$x
        MOUNTED=$(get_value &quot;Mount count:&quot;)
        MAXMOUNT=$(get_value &quot;Maximum mount count:&quot;)
        NEXT=$(get_value &quot;Next check after:&quot;)
        DATENOW=&quot;$(date +%s)&quot;
        DATENEXT=$(convert_date &quot;$NEXT&quot;)

        if [ ! &quot;$MAXMOUNT&quot; == &quot;-1&quot; ]; then
                if [ $MOUNTED -ge $MAXMOUNT ]; then
                        echo &quot;WARNING: Max mount count on $HDD has been reached. ($MOUNTED/$MAXMOUNT)&quot;  
                        ((WARNC++))
                fi
        fi

        if [ -n &quot;$DATENEXT&quot; ]; then
                if [ $DATENOW -ge $DATENEXT ]; then
                        echo &quot;WARNING: $HDD has reached the next periodically filesystemcheck. ($NEXT)&quot;
                        ((WARNC++))
                fi
        fi

        if [ $WARNC -gt 0 ]; then
            echo &quot;RESULT: A fsck will be executed at the next reboot for $HDD.&quot;  
        else
            echo &quot;RESULT: Everything's fine on $HDD.&quot;
        fi
    done
fi

exit $WARNC
</code></pre></noscript></div>


<p>Das sieht dann unter Umständen so aus:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>WARNING: Max mount count on /dev/sda1 has been reached. (29/29)
</span><span class='line'>WARNING: /dev/sda1 has reached the next periodically filesystemcheck. (Sa Apr 7 13:37:58 2012)
</span><span class='line'>RESULT: A fsck will be executed at the next reboot for /dev/sda1.</span></code></pre></td></tr></table></div></figure>


<p>Natürlich für jede gefundene Partition. Um das jetzt noch am besten irgendwie zu
automatisieren hab ich mich entschieden das in <code>apt</code> zu integrieren.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ vim /etc/apt/apt.conf.d/09extverfiy
</span><span class='line'>DPkg::Pre-Install-Pkgs   { "if [ -x /usr/local/bin/ext-verify.sh ]; then echo 'Verifying ext Filesystems' ; /usr/local/bin/ext-verify.sh ; fi"; };</span></code></pre></td></tr></table></div></figure>


<p>Bei jedem apt-get/aptitude wird das nun ausgeführt.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ aptitude install whois
</span><span class='line'>Die folgenden NEUEN Pakete werden zusätzlich installiert:
</span><span class='line'>  whois
</span><span class='line'>0 Pakete aktualisiert, 1 zusätzlich installiert, 0 werden entfernt und 0 nicht aktualisiert.
</span><span class='line'>Muss 0 B/64,9 kB an Archiven herunterladen. Nach dem Entpacken werden 406 kB zusätzlich belegt sein.
</span><span class='line'>Verifying ext Filesystems
</span><span class='line'>RESULT: Everything's fine on /dev/sda1.
</span><span class='line'>Vormals abgewähltes Paket whois wird gewählt.
</span><span class='line'>(Lese Datenbank ... 48680 Dateien und Verzeichnisse sind derzeit installiert.)
</span><span class='line'>Entpacken von whois (aus .../whois_5.0.10_amd64.deb) ...
</span><span class='line'>Trigger für man-db werden verarbeitet ...
</span><span class='line'>whois (5.0.10) wird eingerichtet ...</span></code></pre></td></tr></table></div></figure>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Das CAP Theorem]]></title>
    <link href="http://noqqe.de/blog/2012/04/29/das-cap-theorem/"/>
    <updated>2012-04-29T12:22:00+02:00</updated>
    <id>http://noqqe.de/blog/2012/04/29/das-cap-theorem</id>
    <content type="html"><![CDATA[<p>Das CAP Theorem ist mir das erste mal wirklich begegnet im Podcast
<a href="http://www.radiotux.de/index.php?/archives/5497-Binaergewitter-1-NoSQL.html">Binärgewitter #1
NoSQL</a>
in dem es kurz und knackig an einfachen Beispielen gut erklärt wurde.</p>

<p><img src="http://noqqe.de/uploads/2012/04/cap-theorem.png"></p>

<p>Im Grunde hat sich schon kurz nach der Jahrtausendwende ein Professor in
Berkeley Gedanken gemacht was man von einem Datenbank System erwarten kann.
Im wesentlichen gehts um 3 Faktoren, die aber niemals alle zugleich erfüllt
werden können.</p>

<blockquote><p>Konsistenz (C): Alle Knoten sehen zur selben Zeit dieselben Daten.<br/>Verfügbarkeit (A): Alle Anfragen an das System werden stets beantwortet.<br/>Partitionstoleranz (P): Das System arbeitet auch bei Verlust von Nachrichten, einzelner Netzknoten oder Partition des Netzes weiter.</p></blockquote>


<p>Will man sich mal anschauen, wenn man Datenbanken betreut.</p>

<p>Links</p>

<ul>
<li><a href="http://de.wikipedia.org/wiki/CAP-Theorem">CAP Theorem - Wikipedia Deutsch</a></li>
<li><a href="http://en.wikipedia.org/wiki/CAP-Theory">CAP Theory - Wikipedia Englisch</a></li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Keyboard Codes unter Debian mit xfce4.8]]></title>
    <link href="http://noqqe.de/blog/2012/04/20/keyboard-codes-unter-debian-mit-xfce4-dot-8/"/>
    <updated>2012-04-20T08:52:00+02:00</updated>
    <id>http://noqqe.de/blog/2012/04/20/keyboard-codes-unter-debian-mit-xfce4-dot-8</id>
    <content type="html"><![CDATA[<p>Zuerstmal sei gesagt, dass ich sowieso schon sehr begeistert bin wie viele von
den Spezialtasten auf dem Thinkpad schon Out-of-the-Box unter Debian
funktionieren. Trotzdem gab es noch ein paar die das nicht Taten oder zumindest
nicht mit der Software funktioniert hatte bei der ich es brauche.</p>

<h2>Keyboard Signale mit xev abfangen</h2>

<p>Erstmal gehts darum rauszufinden was für lustige Tasten ich eigentlich gerade
drücke. Hier gibts verschiedene Spielereien mit dem Tool xev und sed:</p>

<pre><code>$ xev | sed -n 's/^.*keycode *\([0-9]\+\).*$/keycode \1 /p' 
keycode 36 
keycode 8 
keycode 160 
keycode 160 
</code></pre>

<h2>XKeysymDB und benutzerdefiniertes Mapping</h2>

<p>Nachdem man weiss, was für KeyCodes man gerade drückt kann man damit auch weiter
arbeiten. Diese KeyCodes müssen nun Keysyms zugeordnet werden.
Der X11 bringt hier automatisch eine kleine Übersicht mit die es sich
lohnt mal anzusehen:</p>

<pre><code>$ less /usr/share/X11/XKeysymDB
</code></pre>

<p>Obacht: Man kann keine neuen Keysyms definieren. Man muss Keysyms aus dem DB
File benutzen um diese dann auf den Keycode zu mappen. Dieses Mapping
findet folgendem File statt:</p>

<pre><code>$ vim ~/.Xmodmap 
keycode 160 = hpModelock1 
</code></pre>

<p>Anschliessend kann man die Xmodmap neu laden:</p>

<pre><code>$ xmodmap ~/.Xmodmap 
</code></pre>

<h2>xfce Keymapping</h2>

<p>Der eigentlich spannende Teil ist, die Shortcuts jetzt mit xfce zu verknüpfen,
damit man bei Betätigung einen Befehl seiner Wahl ausführen kann. In xfce gibt
es eine kleine gui im Settings Manager (xfce4-settings-manager) mit der man
soetwas einrichten kann. Zumindest theoretisch. Leider können hier nur
Tastenkombinationen(!) hinterlegt werden. Keine Keysyms.</p>

<p>Aber das macht nichts. Wie so ziemlich alles gibts ein xml File in dem die Werte
stehen:</p>

<pre><code>$ vim .config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml 
</code></pre>

<figure class='code'><figcaption><span>xfce4-keyboard-shortcuts.xml </span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='xml'><span class='line'><span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;custom&quot;</span> <span class="na">type=</span><span class="s">&quot;empty&quot;</span><span class="nt">&gt;</span>
</span><span class='line'>  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;&amp;lt;Alt&amp;gt;F2&quot;</span> <span class="na">type=</span><span class="s">&quot;string&quot;</span> <span class="na">value=</span><span class="s">&quot;xfrun4&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'>  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;&amp;lt;Control&amp;gt;&amp;lt;Alt&amp;gt;Delete&quot;</span> <span class="na">type=</span><span class="s">&quot;string&quot;</span> <span class="na">value=</span><span class="s">&quot;xflock4&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'>  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;XF86Display&quot;</span> <span class="na">type=</span><span class="s">&quot;string&quot;</span> <span class="na">value=</span><span class="s">&quot;xrandr --auto&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'>  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;override&quot;</span> <span class="na">type=</span><span class="s">&quot;bool&quot;</span> <span class="na">value=</span><span class="s">&quot;true&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'>  <span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;hpModelock1&quot;</span> <span class="na">type=</span><span class="s">&quot;string&quot;</span> <span class="na">value=</span><span class="s">&quot;/usr/bin/i3lock&quot;</span><span class="nt">/&gt;</span>
</span><span class='line'><span class="nt">&lt;/property&gt;</span>
</span></code></pre></td></tr></table></div></figure>


<p>Der letzte Eintrag wurde von mir per Hand eingetragen und funktioniert. Mit
fn+F2 kann ich jetzt (wie auf meinem Keyboard belabelt) meinen Bildschirm
sperren.</p>

<h2>Links</h2>

<p><a href="http://en.gentoo-wiki.com/wiki/Multimedia_Keys">http://en.gentoo-wiki.com/wiki/Multimedia_Keys</a></p>

<p><a href="http://wiki.ubuntuusers.de/Xmodmap">http://wiki.ubuntuusers.de/Xmodmap</a></p>

<p><a href="http://wiki.xfce.org/faq#keyboard">http://wiki.xfce.org/faq#keyboard</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Thinkpad X201]]></title>
    <link href="http://noqqe.de/blog/2012/04/15/thinkpad-x201/"/>
    <updated>2012-04-15T11:16:00+02:00</updated>
    <id>http://noqqe.de/blog/2012/04/15/thinkpad-x201</id>
    <content type="html"><![CDATA[<p>Ich erstand bei <a href="http://ralf-scharbert.de">ralf-scharbert.de</a> ein Thinkpad X201
(refurbished) für einen m.E. guten Preis.</p>

<p><img class="right" src="http://noqqe.de/uploads/2012/04/thinkpadx201-400px.png" title="Thinkpad X201" ></p>

<p>Alles ist toll, Debian installiert, Funktionstasten gehen fast alle
Out-of-the-Box. Nur das wlan musste kurz nachgebaut werden, weil non-free
Firmware:</p>

<pre><code>$ apt-get install firmware-iwlwifi
</code></pre>

<p>Wenn ich mich jetzt noch dran gewöhnen könnte den roten Nippel zu nutzen statt
das kleine Touchpad ist alles gut. Zumindest wurde mir das Nahe gelegt ;)</p>

<p><img class="right" src="http://noqqe.de/uploads/2012/04/thinkpadx201-400px-2.png" title="Thinkpad X201" ></p>

<p>Um das zu Windows 7 zu sichern (sollte ich es mal brauchen) hab ich außerdem
mal die Windows Image Sicherung ausprobiert. Konkret auf ein CIFS Share im
Netzwerk die .VHD Files überspielt und aus dem Internet den &#8220;Windows
Systemrettungsdatenträger&#8221; geholt :). Habe nicht probiert ob das wirklich
funktioniert, aber es klingt zumindest so als könne man sich darauf verlassen.</p>

<p>Hurra.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[DaviCal, PostgreSQL und Apple Produkte]]></title>
    <link href="http://noqqe.de/blog/2012/04/09/davical-postgresql-und-apple-produkte/"/>
    <updated>2012-04-09T20:05:00+02:00</updated>
    <id>http://noqqe.de/blog/2012/04/09/davical-postgresql-und-apple-produkte</id>
    <content type="html"><![CDATA[<p>Vor ewigen Zeiten hab ich mir mal ein eGroupware installiert. Es war schrecklich
und deshalb hab ich es durch etwas weniger Schreckliches ersetzt.
<a href="http://davical.org">DaviCal</a>.</p>

<p>Nicht das ich spontan Lust gehabt hätte sowas wie Kontakte und so mal zu Ordnen.
Vielmehr hat mich die PostgreSQL Datenbank intressiert die dazu nötig ist.
Installation und
Konfiguration ist so schön dokumentiert das ich das hier nicht widerholen
brauche. Die Integration in Thunderbird verlief ohne Probleme. Dann kamen meine
beiden Geräte aus dem Hause Crapple mit der Synchronisation der Kontakte dran.</p>

<h2>iPhone</h2>

<p>Mein iPhone wollte den hingeworfenen Remote für Contacts nicht einfach so
hinnehmen. Ewiges &#8220;Verifying&#8221; durch den Installationsassistenten und jedesmal
gefühlte 5-10 Minuten später hat er mich dann abgewiesen. Im Apache Log ist
davon nichts
aufgetaucht. Nach bisschen wälzen in der Dokumentation hier und da:</p>

<blockquote><p>CardDav-Accounts only could set up via iPhone configuration utility. It had to<br/>set up a principal url (e.g. https://domain.tld/caldav.php/username/contacts)<br/>for a working account.</p><footer><strong>Carddav Clients,</strong> <cite><a href='http://wiki.davical.org/w/CardDAV/Clients'>wiki.davical.org</a></cite></footer></blockquote>


<p>Das <a href="http://www.apple.com/support/iphone/enterprise/">iPhone configuration utility</a> also.
So ganz leicht fand ich das damit nicht&#8230; Ich hab aber gelernt das man super
Debuggen kann über die eingebaute Consolen Funktion in dem Tool. Im iPhone wird
man nach dem ServerPath gefragt. Den ich mit</p>

<blockquote><p>http://cal.n0q.org/caldav.php/noqqe/addressbook</p></blockquote>

<p>Mein Fehler war eben genau die Angabe des Protokolls. Ich meine sorry.
Apple probiert hier gefühlte 1,3 mio (nichtmal wirklich RFC spezifizierte) Orte
an denen meine Kontakte serverseitig wohl liegen könnten durch und am Ende
können die nichtmal ein führendes http:// wegparsen? Egal. Fehler sah wie folgt
aus:</p>

<blockquote><p>http://http//cal.n0q.org/caldav.php/noqqe/addressbook</p></blockquote>

<h2>Macbook</h2>

<p>Hier nun der wirklich lustige Teil. Das Address Book des Macbooks. Selbes
&#8220;Verifying&#8221; Spielchen wieder.</p>

<p>Nachdem ich rausgefunden habe wie ich das intuitive Interface der App wirklich
benutzen soll kam nur folgendes auf meinem Webserver an:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>77.191.14.156 - - [09/Apr/2012:19:35:53 +0200] "PROPFIND /caldav.php/noqqe/addressbook:0(null)/ HTTP/1.1" 401 401 "-" "Address%20Book/883 CFNetwork/454.12.4 Darwin/10.8.0 (i386) (MacBook2%2C1)"
</span><span class='line'>77.191.14.156 - - [09/Apr/2012:19:35:53 +0200] "PROPFIND /caldav.php/noqqe/addressbook:0(null)/ HTTP/1.1" 400 477 "-" "Address%20Book/883 CFNetwork/454.12.4 Darwin/10.8.0 (i386) (MacBook2%2C1)"</span></code></pre></td></tr></table></div></figure>


<p>Herzlichen Glückwunsch. Woher kommt dieses &#8220;:0(null)&#8221; ? Ich habe den Serverport angegeben:</p>

<p><a href="http://noqqe.de/uploads/2012/04/addressbook.png"><img src="http://noqqe.de/uploads/2012/04/addressbook.png" alt="" /></a></p>

<p>Ich habe mehr als 10 mal versucht das Interface korrekt auszufüllen, aber hatte
keine Chance. Nach einmaligem Anlegen konnte ich den Serverpath nicht mehr
editieren und wenn ich Ihn von vornherein eingetragen habe bekam ich immer das
oben beschriebene &#8220;:0(null)&#8221;.</p>

<p>Ich hab mir schliesslich die Config von Addressbuch mühsam ergrept und gefunden:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>~/Library/Application Support/AddressBook/Sources/FC24F051-B1B2-4286-9A28-5830207F0DA2/Configuration.plist</span></code></pre></td></tr></table></div></figure>


<p>Dort gibt es unter anderem folgende Paramteri (bereits korrigiert):</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
</span><span class='line'>&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
</span><span class='line'>&lt;plist version="1.0"&gt;
</span><span class='line'>&lt;dict&gt;
</span><span class='line'>    &lt;key&gt;_className&lt;/key&gt;
</span><span class='line'>    &lt;string&gt;PHXCardDAVSource&lt;/string&gt;
</span><span class='line'>    &lt;key&gt;disabled&lt;/key&gt;
</span><span class='line'>    &lt;integer&gt;0&lt;/integer&gt;
</span><span class='line'>    &lt;key&gt;haveWriteAccess&lt;/key&gt;
</span><span class='line'>    &lt;integer&gt;0&lt;/integer&gt;
</span><span class='line'>    &lt;key&gt;isSharedABAccount&lt;/key&gt;
</span><span class='line'>    &lt;integer&gt;1&lt;/integer&gt;
</span><span class='line'>    &lt;key&gt;name&lt;/key&gt;
</span><span class='line'>    &lt;string&gt;cal.n0q.org&lt;/string&gt;
</span><span class='line'>    &lt;key&gt;refreshInterval&lt;/key&gt;
</span><span class='line'>    &lt;integer&gt;0&lt;/integer&gt;
</span><span class='line'>    &lt;key&gt;serverSupportsSearch&lt;/key&gt;
</span><span class='line'>    &lt;integer&gt;0&lt;/integer&gt;
</span><span class='line'>    &lt;key&gt;servername&lt;/key&gt;
</span><span class='line'>    &lt;string&gt;http://cal.n0q.org:80/caldav.php/noqqe/addressbook&lt;/string&gt;
</span><span class='line'>    [...]
</span><span class='line'>&lt;/dict&gt;
</span><span class='line'>&lt;/plist&gt;</span></code></pre></td></tr></table></div></figure>


<p>Hurra. Ohne das kaputte Interface kann mein Address Book problemlos mit meinem neuen DaviCal Server reden.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[ASCII Statistik Graphen mit Bash]]></title>
    <link href="http://noqqe.de/blog/2012/04/01/ascii-statistik-graphen-mit-bash/"/>
    <updated>2012-04-01T11:11:00+02:00</updated>
    <id>http://noqqe.de/blog/2012/04/01/ascii-statistik-graphen-mit-bash</id>
    <content type="html"><![CDATA[<p><a href="http://noqqe.de/blog/2011/04/14/statistical-statistiken-visualisieren-im-terminal/">Vor einem Jahr</a>
hab ich mich mit einem ASCII Balkendiagramm beschäftigt. Als es dann fertig war
kams unter dem Namen statistical auf Github:
<a href="http://github.com/noqqe/statistical">http://github.com/noqqe/statistical</a></p>

<p><a href="http://noqqe.de/uploads/2012/04/statistics-fail.jpg"><img src="http://noqqe.de/uploads/2012/04/statistics-fail.jpg" alt="" /></a></p>

<p>Hab mir überlegt wie schwierig das wohl ist, dass ganze Teil nochmal so
umzubauen, dass vertikale Balken entstehen. Horizontal gesehen ist das ja
relativ easy. Etwas skalieren hier und da und dann einfach die Anzahl der
Zeichen in einer Zeile ausgeben.</p>

<p>Im v-barplot ist da schon etwas mehr Logik nötig. Aber es ging dann trotzdem. Heraus kam dabei folgendes:</p>

<pre><code>./v-barplot foo:24 bar:90 alice:76 flo:32 blu:79 fa:12 bob:230 kika:121
</code></pre>

<p><a href="http://noqqe.de/uploads/2012/04/v-barplot.png"><img src="http://noqqe.de/uploads/2012/04/v-barplot.png" alt="" /></a></p>

<p>Beide Skripte (v-barplot &amp; h-barplot) sind jetzt im statistical Repo. Anregungen
&amp; Kritik immer gerne.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The Revival of SCCS]]></title>
    <link href="http://noqqe.de/blog/2012/03/23/the-revival-of-sccs/"/>
    <updated>2012-03-23T15:11:00+01:00</updated>
    <id>http://noqqe.de/blog/2012/03/23/the-revival-of-sccs</id>
    <content type="html"><![CDATA[<p>Ich durfte wie bereits <a href="http://noqqe.de/blog/2012/03/22/chemnitzer-linux-tage-2012/">erwähnt</a>
auf den Chemnitzer LinuxTagen einem Vortrag zur Geschichte von Versionskontrollsystemen und dem Revival von SCCS lauschen.
Diesen fand ich unter anderem (besonders beim Historischen) informativ und unterhaltsam.</p>

<p><a href="http://localhost:4000/uploads/2012/03/git-header.gif"><img src="http://noqqe.de/uploads/2012/03/git-header.gif" alt="" /></a></p>

<p>Nicht übereinstimmen kann ich aber in den angebrachten &#8220;Vergleichen&#8221; von SCCS zu
(unter anderem) git. Die Vortragsfolien können <a href="http://chemnitzer.linux-tage.de/2012/vortraege/folien/941_SCCS.pdf">hier</a>
angesehen werden.</p>

<h2>Die Repository Initalisierung</h2>

<p>Initalisierung aller OpenSolaris Source Files:</p>

<blockquote><p>SCCS: 8 Sekunden<br/>git: 100 Sekunden</p><footer><strong>Schnelle Massenübernahme in SCCS,</strong> <cite><a href='http://chemnitzer.linux-tage.de/2012/vortraege/folien/941_SCCS.pdf'>SCCS Seite 29</a></cite></footer></blockquote>


<p>Aus dem Hörsaal kam die berechtigte Frage:</p>

<blockquote><p>Wie oft mache ich das?</p></blockquote>

<p>Ich denke das spricht schonmal für sich, aber das eigentliche Feature hierbei
ist, dass git von allen Files im Repo einen Binärblob in .git/ ablegt. Während
SCCS nur Diffs vom letzten zum neuen Commit speichert.</p>

<p>Das hab ich mal nachgebaut, kommt schon hin:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span><span class="nb">time </span>git add .
</span><span class='line'>real  0m38.405s
</span><span class='line'>user  0m17.121s
</span><span class='line'>sys 0m2.620s
</span></code></pre></td></tr></table></div></figure>




<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span><span class="nb">time </span>git commit -a -m <span class="s2">&quot;init&quot;</span>
</span><span class='line'>real  0m26.078s
</span><span class='line'>user  0m6.132s
</span><span class='line'>sys 0m1.660s
</span></code></pre></td></tr></table></div></figure>


<p>Nachvollziehbar, dass git länger dafür braucht alle Files zu kopieren als SCCS
mit &#8220;Ah, hier ist noch ein File, schreib ich den Namen des Files mal in meine Liste&#8221;.</p>

<h2>Das Datenvolumen</h2>

<p>Die angesprochenen Werte auf Seite 36 der Präsentation beziehen sich auf simple
Timestamps. Jörg Schilling hat hier 2 Mio. Timestamps erstellt und mit git und sccs
jeden davon mit jeweils einem Commit abgeschlossen.</p>

<blockquote><p>Platzbedarf mit SCCS ca. 300 MB (komprimiert 160 MB)<br/>Platzbedarf mit GIT geschätzt: ca. 15 TB</p><footer><strong>Dauertest mit SCCS &gt;2 Millionen Deltas,</strong> <cite><a href='http://chemnitzer.linux-tage.de/2012/vortraege/folien/941_SCCS.pdf'>SCCS Seite 36</a></cite></footer></blockquote>


<p>Ich war so frei das einfach mal (aus zeitlichen Gründen mit 1 Mio. Files) nachzustellen:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c">#!/bin/bash</span>
</span><span class='line'>touch <span class="nb">test </span>
</span><span class='line'>git add <span class="nb">test </span>
</span><span class='line'><span class="nv">C</span><span class="o">=</span>0
</span><span class='line'><span class="nb">time </span><span class="k">while</span> <span class="o">[</span> <span class="nv">$C</span> -le 1004225 <span class="o">]</span>; <span class="k">do</span>
</span><span class='line'><span class="k">  </span>date <span class="s2">&quot;+%Y%m%d %H%M%s%N&quot;</span> &gt; <span class="nb">test </span>
</span><span class='line'><span class="nb">  </span>git commit -a -m <span class="s2">&quot;$C&quot;</span>
</span><span class='line'>  <span class="o">((</span>C++<span class="o">))</span>
</span><span class='line'><span class="k">done</span>
</span></code></pre></td></tr></table></div></figure>


<p>Größe nach dem Command:</p>

<figure class='code'> <div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>du -sh /tmp/1miocommits/
</span><span class='line'>12G .
</span></code></pre></td></tr></table></div></figure>


<p>Ich bin mir nicht sicher was Jörg hier genau getan hat. Meine Testwerte
unterscheiden sich jedenfalls erheblich von dem, was im Vortrag vorkommt.</p>

<p>Unter anderem wurde erwähnt, dass die Größe des Git Repositories hochgerechnet
wurde. Nun das ist natürlich insofern doof, wie man weiss das git Deduplication
betreibt. Teile aus den Blobs werden einmalig aufgehoben, wenn sie idientisch
sind. So lässt sich viel Platz sparen und das Konstrukt des &#8220;Hochrechnens&#8221;
bricht zusammen. Selbst wenn ich das jetzt nur verdopple kommen dabei 24 GB
statt 15 TB raus.</p>

<h2>Die Zeit</h2>

<p>Ein weiterer Punkt der meines Erachtens beim Vergleich von git zu SCCS außer
acht gelassen wurde. Die Zeit.</p>

<p>Was mich sehr interessiert sind die Wiederherstellzeiten. Klar git hat
einen spezifischen Commit welcher auf ein Objekt im Hash Store zeigt. Dieser
wird ausgelesen und fertig ist die Wiederherstellung.</p>

<p><a href="http://localhost:4000/uploads/2012/03/gitobjects.png"><img src="http://noqqe.de/uploads/2012/03/gitobjects.png" alt="" /></a>
(Bild von progit.org - Creative Commons Attribution Non Commercial Share Alike 3.0
license)</p>

<p>Aber bei SCCS? Angenommen ich möchte vom 1.000.000 Commit zum 1. zurück. Alle
Diffs werden dazu auf das aktuelle File angewandt und zurückgerechnet bis
das File wieder am Ursprungszustand angekommen ist. Ob das Spass macht?</p>

<h2>Die Konsistenz</h2>

<p>Selbes Szenario hier. Ich weiss nicht was passiert wenn das Diff File von SCCS
unterwegs mal kaputt geht. Aus welchen Gründen auch immer. HDD Block kaputt oder
versehentlich editiert. Faktisch sollte das File dann nicht mehr herstellbar sein.</p>

<p>Bei git bleibt weiterhin der mit zlib komprimierte Binary Blob bestehen und
alles ist gut weil wie oben der Commit auf einen binär Blob referenziert.
Selbst wenn dazwischen mal ein Block eines Blobs kaputt sein
sollte (oder was auch immer).</p>

<h2>Ende</h2>

<p>Ich möchte zum Schluss nochmal unterstreichen, dass ich in keinster Weise den
Vortrag oder die Weiterentwicklung von Jörg Schilling an SCCS kritisieren will.
Im Gegenteil. SCCS ist für bestimmte Einsatzzwecke bestimmt nett, eben weil es
&#8220;anders&#8221; ist als git. Aber, dass SCCS in allen Punkte besser als git möchte ich
nicht unterschreiben.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Chemnitzer Linux Tage 2012]]></title>
    <link href="http://noqqe.de/blog/2012/03/22/chemnitzer-linux-tage-2012/"/>
    <updated>2012-03-22T20:16:00+01:00</updated>
    <id>http://noqqe.de/blog/2012/03/22/chemnitzer-linux-tage-2012</id>
    <content type="html"><![CDATA[<p>Mittlerweile das 3. Jahr, dass ich mich bei den Chemnitzer Linux Tagen habe
blicken lassen. Wie immer war alles sehr super, klasse organisiert (dickes
Kompliment an die Orga) und interessant :)</p>

<p>Kurze Review der Vorträge</p>

<ul>
<li><p><a href="http://chemnitzer.linux-tage.de/2012/vortraege/1022">Penetration Testing mit MetaSploit</a>
MetaSploit ist angeblich mit 1,2 Mio. Zeilen das größte gepflegte OpenSource
Ruby Projekt. Wohl wegen den Zig Plugins :)</p></li>
<li><p><a href="http://chemnitzer.linux-tage.de/2012/vortraege/1006">Der Systemaufruf und was danach passiert</a>
Ein bisschen was zu SysCalls unter Linux und Unix. Folien waren leider nur
begrenzt lesbar wegen gelber Schrift auf weissem Grund. Ansonsten viel C
Beispiele.</p></li>
<li><p><a href="http://chemnitzer.linux-tage.de/2012/vortraege/906">strace für Bash Versteher</a>
strace benutzen um Bash Probleme zu debuggen? Einwandfrei. Manchmal etwas
überzogen gleich zu strace zu greifen, aber ansonsten super, da ich bisher wenig
mit strace gemacht hatte.</p></li>
<li><p><a href="http://chemnitzer.linux-tage.de/2012/vortraege/974">Mit OpenStack zur eigenen Cloud</a>
Auch nett gewesen. Die verschiedenen Komponenten von OpenStack mal
kennenzulernen die von RackSpace und der NASA entwickelt werden.</p></li>
<li><p><a href="http://chemnitzer.linux-tage.de/2012/vortraege/941">Ursprünge der Versionsverwaltung und Revival von SCCS</a>
Den Folien habe ich nichts hinzuzufuegen. Ganz besonders nicht Seite 36. Aber
ich habe schon wieder Schaum vorm Mund, wenn ich dran denke. Vielleicht gibts
darüber einen separaten Blogpost.</p></li>
<li><p><a href="http://chemnitzer.linux-tage.de/2012/vortraege/1054">Bitcoin, das elektronische Geld</a>
Paar interessante Hints bei gewesen. Wenn man sich aber schonmal schlau gelesen
hat war wenig neues dabei.</p></li>
<li><p><a href="http://chemnitzer.linux-tage.de/2012/vortraege/1035">LinuXContainer in der Praxis</a>
Fand ich persönlich vortragstechnisch und inhaltlich den besten Vortrag. Bin
auch schon 2 Stunden am basteln damit, wenn ich schonmal Urlaub habe.</p></li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Git Shell Environment Tricks]]></title>
    <link href="http://noqqe.de/blog/2012/03/10/git-shell-environment-tricks/"/>
    <updated>2012-03-10T12:00:00+01:00</updated>
    <id>http://noqqe.de/blog/2012/03/10/git-shell-environment-tricks</id>
    <content type="html"><![CDATA[<p>Heute mal ein Blick in meine <code>~/.bashrc</code> über viele Schnippsel und Funktionen
die ich im Laufe der Jahre für git zusammengesammelt habe. Wenns mir noch
einfällt mit Quelle :)</p>

<h2>Aliases</h2>

<p>Teilweise selber gebastelt, teilweise aus <a href="https://github.com/revans/bash-it">bash-it</a> geklaut.</p>

<figure class='code'><figcaption><span>Aliases </span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="c">## git Aliases</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gcl</span><span class="o">=</span><span class="s1">&#39;git clone&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">ga</span><span class="o">=</span><span class="s1">&#39;git add&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gall</span><span class="o">=</span><span class="s1">&#39;git add .&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">g</span><span class="o">=</span><span class="s1">&#39;git&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gs</span><span class="o">=</span><span class="s1">&#39;git status&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gss</span><span class="o">=</span><span class="s1">&#39;git status -s&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gl</span><span class="o">=</span><span class="s1">&#39;git log --oneline&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gup</span><span class="o">=</span><span class="s1">&#39;git fetch &amp;&amp; git rebase&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gp</span><span class="o">=</span><span class="s1">&#39;git push&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gpo</span><span class="o">=</span><span class="s1">&#39;git push origin &#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gb</span><span class="o">=</span><span class="s1">&#39;git branch&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gcount</span><span class="o">=</span><span class="s1">&#39;git shortlog -sn&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gdel</span><span class="o">=</span><span class="s1">&#39;git branch -D&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gcm</span><span class="o">=</span><span class="s1">&#39;git commit -a -m&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gll</span><span class="o">=</span><span class="s1">&#39;git log --graph --pretty=oneline --abbrev-commit&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">cdiff</span><span class="o">=</span><span class="s1">&#39;git diff --cached&#39;</span>
</span><span class='line'><span class="nb">alias </span><span class="nv">gsdiff</span><span class="o">=</span><span class="s1">&#39;git diff --staged&#39;</span>
</span></code></pre></td></tr></table></div></figure>


<p>Hervorheben will ich hier besonders <code>gll</code>:</p>

<p><a href="http://noqqe.de/uploads/2012/03/gitlog-graph.png"><img src="http://noqqe.de/uploads/2012/03/gitlog-graph.png" alt="" /></a></p>

<h2>git Informationen</h2>

<p>Wer viel in verschiedenen git Repos unterwegs ist hilft vielleicht (wie mir)
diese Funktion. Selbst geschrieben.</p>

<figure class='code'><figcaption><span>git_info function</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="k">function </span>git_info<span class="o">()</span> <span class="o">{</span>
</span><span class='line'>
</span><span class='line'>    <span class="k">if</span> <span class="o">[</span> -n <span class="s2">&quot;$(git symbolic-ref HEAD 2&gt; /dev/null)&quot;</span> <span class="o">]</span>; <span class="k">then</span>
</span><span class='line'>        <span class="c"># print informations</span>
</span><span class='line'>        <span class="nb">echo</span> <span class="s2">&quot;git repo overview&quot;</span>
</span><span class='line'>        <span class="nb">echo</span> <span class="s2">&quot;-----------------&quot;</span>
</span><span class='line'>        <span class="nb">echo</span>
</span><span class='line'>
</span><span class='line'>        <span class="c"># print all remotes and thier details</span>
</span><span class='line'>        <span class="k">for </span>remote in <span class="k">$(</span>git remote show<span class="k">)</span>; <span class="k">do</span>
</span><span class='line'><span class="k">            </span><span class="nb">echo</span> <span class="nv">$remote</span>:
</span><span class='line'>            git remote show <span class="nv">$remote</span>
</span><span class='line'>            <span class="nb">echo</span>
</span><span class='line'><span class="nb">        </span><span class="k">done</span>
</span><span class='line'>
</span><span class='line'>        <span class="c"># print status of working repo</span>
</span><span class='line'>        <span class="nb">echo</span> <span class="s2">&quot;status:&quot;</span>
</span><span class='line'>        <span class="k">if</span> <span class="o">[</span> -n <span class="s2">&quot;$(git status -s 2&gt; /dev/null)&quot;</span> <span class="o">]</span>; <span class="k">then</span>
</span><span class='line'><span class="k">            </span>git status -s
</span><span class='line'>        <span class="k">else</span>
</span><span class='line'><span class="k">            </span><span class="nb">echo</span> <span class="s2">&quot;working directory is clean&quot;</span>
</span><span class='line'>        <span class="k">fi</span>
</span><span class='line'>
</span><span class='line'>        <span class="c"># print at least 5 last log entries</span>
</span><span class='line'>        <span class="nb">echo </span>
</span><span class='line'><span class="nb">        echo</span> <span class="s2">&quot;log:&quot;</span>
</span><span class='line'>        git log -5 --oneline
</span><span class='line'>        <span class="nb">echo </span>
</span><span class='line'>
</span><span class='line'><span class="nb">    </span><span class="k">else</span>
</span><span class='line'><span class="k">        </span><span class="nb">echo</span> <span class="s2">&quot;you&#39;re currently not in a git repository&quot;</span>
</span><span class='line'>
</span><span class='line'>    <span class="k">fi</span>
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>Gitinfo Output</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span>git_info
</span><span class='line'>git repo overview
</span><span class='line'>-----------------
</span><span class='line'>
</span><span class='line'>origin:
</span><span class='line'>* remote origin
</span><span class='line'>  Fetch URL: git@github.com:revans/bash-it.git
</span><span class='line'>  Push  URL: git@github.com:revans/bash-it.git
</span><span class='line'>  HEAD branch: master
</span><span class='line'>  Remote branch:
</span><span class='line'>    master tracked
</span><span class='line'>  Local branch configured <span class="k">for</span> <span class="s1">&#39;git pull&#39;</span>:
</span><span class='line'>    master merges with remote master
</span><span class='line'>  Local ref configured <span class="k">for</span> <span class="s1">&#39;git push&#39;</span>:
</span><span class='line'>    master pushes to master <span class="o">(</span>up to date<span class="o">)</span>
</span><span class='line'>
</span><span class='line'>status:
</span><span class='line'>working directory is clean
</span><span class='line'>
</span><span class='line'>log:
</span><span class='line'>39f8ef9 add defaults autocompletion <span class="k">for </span>OS X
</span><span class='line'>67f642f Merge pull request <span class="c">#102 from jpschewe/master</span>
</span><span class='line'>d0ffb0d Merge remote-tracking branch <span class="s1">&#39;berenm/master&#39;</span>
</span><span class='line'>94a7b78 Revert <span class="s2">&quot;Revert new color framework&quot;</span>
</span><span class='line'>87d7d7a Fixed issue <span class="c">#103 caused by &quot;normal&quot; colors not reseting bold/underline/... text attributes.</span>
</span></code></pre></td></tr></table></div></figure>


<h2>git Bash Prompt</h2>

<p>Eines der nützlichsten Dinge. Wenn das aktuellen Working Directory ein git Repository ist verändert sich der Prompt.
Es zeigt falls das der Fall ist den aktuell ausgecheckten Branch an und eine Asterisk (*) wenn das
PWD sich in einem uncommitteten Zustand befindet.</p>

<figure class='code'><figcaption><span>git Prompt</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">GIT_THEME_PROMPT_DIRTY</span><span class="o">=</span><span class="s1">&#39;*&#39;</span>
</span><span class='line'>
</span><span class='line'><span class="k">function </span>git_prompt_info<span class="o">()</span> <span class="o">{</span>
</span><span class='line'>  <span class="nv">ref</span><span class="o">=</span><span class="k">$(</span>git symbolic-ref HEAD 2&gt; /dev/null<span class="k">)</span> <span class="o">||</span> <span class="k">return</span>
</span><span class='line'><span class="k">  </span><span class="nb">echo</span> -e <span class="s2">&quot; (${ref#refs/heads/}$(parse_git_dirty))&quot;</span>
</span><span class='line'><span class="o">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">function </span>parse_git_dirty <span class="o">{</span>
</span><span class='line'>  <span class="k">if</span> <span class="o">[[</span> -n <span class="k">$(</span>git status -s 2&gt; /dev/null |grep -v ^# | grep -v <span class="s2">&quot;working directory clean&quot;</span> <span class="k">)</span> <span class="o">]]</span>; <span class="k">then</span>
</span><span class='line'><span class="k">      </span><span class="nb">echo</span> -e <span class="s2">&quot;$GIT_THEME_PROMPT_DIRTY&quot;</span>
</span><span class='line'>  <span class="k">else</span>
</span><span class='line'><span class="k">    </span><span class="nb">echo</span> -e <span class="s2">&quot;$GIT_THEME_PROMPT_CLEAN&quot;</span>
</span><span class='line'>  <span class="k">fi</span>
</span><span class='line'><span class="o">}</span>
</span><span class='line'>
</span><span class='line'><span class="nv">PS1</span><span class="o">=</span><span class="s2">&quot;\u@\h:\w\[\$(git_prompt_info)\]$ &quot;</span>
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>Prompt Example</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>noqqe@deathstar:~/Code<span class="nv">$ </span><span class="nb">cd </span>octopress
</span><span class='line'>noqqe@deathstar:~/Code/octopress <span class="o">(</span>master<span class="o">)</span><span class="nv">$ </span>touch foobar
</span><span class='line'>noqqe@deathstar:~/Code/octopress <span class="o">(</span>master*<span class="o">)</span><span class="nv">$ </span>
</span></code></pre></td></tr></table></div></figure>


<h2>git Remotes</h2>

<p>Zwei Funktionen an die ich mich ziemlich gewöhnt habe, weil ich für meine git
repos meistens sowieso den selben Remote benutze. Ebenfalls veruntreut vom
bash-it Framework.</p>

<figure class='code'><figcaption><span>Remote functions</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="k">function </span>git_remote <span class="o">{</span>
</span><span class='line'>  <span class="nb">echo</span> <span class="s2">&quot;Running: git remote add origin git@n0q.org:$1&quot;</span>
</span><span class='line'>  git remote add origin git@n0q.org:<span class="nv">$1</span>
</span><span class='line'><span class="o">}</span>
</span><span class='line'>
</span><span class='line'><span class="k">function </span>git_first_push <span class="o">{</span>
</span><span class='line'>  <span class="nb">echo</span> <span class="s2">&quot;Running: git push origin master:refs/heads/master&quot;</span>
</span><span class='line'>  git push origin master:refs/heads/master
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>


<h2>git Statistiken</h2>

<p>Hier noch ein Stück für die Statistik Liebhaber. Ich mags.</p>

<figure class='code'><figcaption><span>git stats </span><a href='https://github.com/esc/git-stats'>git-stats</a></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="k">function </span>git_stats <span class="o">{</span>
</span><span class='line'><span class="k">if</span> <span class="o">[</span> -n <span class="s2">&quot;$(git symbolic-ref HEAD 2&gt; /dev/null)&quot;</span> <span class="o">]</span>; <span class="k">then</span>
</span><span class='line'><span class="k">    </span><span class="nb">echo</span> <span class="s2">&quot;Number of commits per author:&quot;</span>
</span><span class='line'>    git --no-pager shortlog -sn --all
</span><span class='line'>    <span class="nv">AUTHORS</span><span class="o">=</span><span class="k">$(</span> git shortlog -sn --all | cut -f2 | cut -f1 -d<span class="s1">&#39; &#39;</span><span class="k">)</span>
</span><span class='line'>    <span class="nv">LOGOPTS</span><span class="o">=</span><span class="s2">&quot;&quot;</span>
</span><span class='line'>    <span class="k">if</span> <span class="o">[</span> <span class="s2">&quot;$1&quot;</span> <span class="o">==</span> <span class="s1">&#39;-w&#39;</span> <span class="o">]</span>; <span class="k">then</span>
</span><span class='line'><span class="k">        </span><span class="nv">LOGOPTS</span><span class="o">=</span><span class="s2">&quot;$LOGOPTS -w&quot;</span>
</span><span class='line'>        <span class="nb">shift</span>
</span><span class='line'><span class="nb">    </span><span class="k">fi</span>
</span><span class='line'><span class="k">    if</span> <span class="o">[</span> <span class="s2">&quot;$1&quot;</span> <span class="o">==</span> <span class="s1">&#39;-M&#39;</span> <span class="o">]</span>; <span class="k">then</span>
</span><span class='line'><span class="k">        </span><span class="nv">LOGOPTS</span><span class="o">=</span><span class="s2">&quot;$LOGOPTS -M&quot;</span>
</span><span class='line'>        <span class="nb">shift</span>
</span><span class='line'><span class="nb">    </span><span class="k">fi</span>
</span><span class='line'><span class="k">    if</span> <span class="o">[</span> <span class="s2">&quot;$1&quot;</span> <span class="o">==</span> <span class="s1">&#39;-C&#39;</span> <span class="o">]</span>; <span class="k">then</span>
</span><span class='line'><span class="k">        </span><span class="nv">LOGOPTS</span><span class="o">=</span><span class="s2">&quot;$LOGOPTS -C --find-copies-harder&quot;</span>
</span><span class='line'>        <span class="nb">shift</span>
</span><span class='line'><span class="nb">    </span><span class="k">fi</span>
</span><span class='line'><span class="k">    for </span>a in <span class="nv">$AUTHORS</span>
</span><span class='line'>    <span class="k">do</span>
</span><span class='line'><span class="k">        </span><span class="nb">echo</span> <span class="s1">&#39;-------------------&#39;</span>
</span><span class='line'>        <span class="nb">echo</span> <span class="s2">&quot;Statistics for: $a&quot;</span>
</span><span class='line'>        <span class="nb">echo</span> -n <span class="s2">&quot;Number of files changed: &quot;</span>
</span><span class='line'>        git log <span class="nv">$LOGOPTS</span> --all --numstat --format<span class="o">=</span><span class="s2">&quot;%n&quot;</span> --author<span class="o">=</span><span class="nv">$a</span> | cut -f3 | sort -iu | wc -l
</span><span class='line'>        <span class="nb">echo</span> -n <span class="s2">&quot;Number of lines added: &quot;</span>
</span><span class='line'>        git log <span class="nv">$LOGOPTS</span> --all --numstat --format<span class="o">=</span><span class="s2">&quot;%n&quot;</span> --author<span class="o">=</span><span class="nv">$a</span> | cut -f1 | awk <span class="s1">&#39;{s+=$1} END {print s}&#39;</span>
</span><span class='line'>        <span class="nb">echo</span> -n <span class="s2">&quot;Number of lines deleted: &quot;</span>
</span><span class='line'>        git log <span class="nv">$LOGOPTS</span> --all --numstat --format<span class="o">=</span><span class="s2">&quot;%n&quot;</span> --author<span class="o">=</span><span class="nv">$a</span> | cut -f2 | awk <span class="s1">&#39;{s+=$1} END {print s}&#39;</span>
</span><span class='line'>        <span class="nb">echo</span> -n <span class="s2">&quot;Number of merges: &quot;</span>
</span><span class='line'>        git log <span class="nv">$LOGOPTS</span> --all --merges --author<span class="o">=</span><span class="nv">$a</span> | grep -c <span class="s1">&#39;^commit&#39;</span>
</span><span class='line'>    <span class="k">done</span>
</span><span class='line'><span class="k">else</span>
</span><span class='line'><span class="k">    </span><span class="nb">echo</span> <span class="s2">&quot;you&#39;re currently not in a git repository&quot;</span>
</span><span class='line'><span class="k">fi</span>
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>




<figure class='code'><figcaption><span>git_stats Output</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
<span class='line-number'>10</span>
<span class='line-number'>11</span>
<span class='line-number'>12</span>
<span class='line-number'>13</span>
<span class='line-number'>14</span>
<span class='line-number'>15</span>
<span class='line-number'>16</span>
<span class='line-number'>17</span>
<span class='line-number'>18</span>
<span class='line-number'>19</span>
<span class='line-number'>20</span>
<span class='line-number'>21</span>
<span class='line-number'>22</span>
<span class='line-number'>23</span>
<span class='line-number'>24</span>
<span class='line-number'>25</span>
<span class='line-number'>26</span>
<span class='line-number'>27</span>
<span class='line-number'>28</span>
<span class='line-number'>29</span>
<span class='line-number'>30</span>
<span class='line-number'>31</span>
<span class='line-number'>32</span>
<span class='line-number'>33</span>
<span class='line-number'>34</span>
<span class='line-number'>35</span>
<span class='line-number'>36</span>
<span class='line-number'>37</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>Number of commits per author:
</span><span class='line'>   149  Mark Szymanski
</span><span class='line'>    64  Robert R Evans
</span><span class='line'>    53  Travis Swicegood
</span><span class='line'>    22  Florian Baumann
</span><span class='line'>    16  Jesus de Mula Cano
</span><span class='line'>    14  John Schulz
</span><span class='line'>    12  Ryan
</span><span class='line'>    10  JFSIII
</span><span class='line'>    10  Ryan Kanno
</span><span class='line'>     9  David DeSandro
</span><span class='line'>-------------------
</span><span class='line'>Statistics <span class="k">for</span>: Mark
</span><span class='line'>Number of files changed: 52
</span><span class='line'>Number of lines added: 1577
</span><span class='line'>Number of lines deleted: 733
</span><span class='line'>Number of merges: 19
</span><span class='line'>-------------------
</span><span class='line'>Statistics <span class="k">for</span>: Robert
</span><span class='line'>Number of files changed: 74
</span><span class='line'>Number of lines added: 5817
</span><span class='line'>Number of lines deleted: 3065
</span><span class='line'>Number of merges: 16
</span><span class='line'>-------------------
</span><span class='line'>Statistics <span class="k">for</span>: Travis
</span><span class='line'>Number of files changed: 106
</span><span class='line'>Number of lines added: 4416
</span><span class='line'>Number of lines deleted: 3919
</span><span class='line'>Number of merges: 19
</span><span class='line'>-------------------
</span><span class='line'>Statistics <span class="k">for</span>: Florian
</span><span class='line'>Number of files changed: 14
</span><span class='line'>Number of lines added: 363
</span><span class='line'>Number of lines deleted: 145
</span><span class='line'>Number of merges: 3
</span><span class='line'>-------------------
</span><span class='line'><span class="o">[</span>...<span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>


<h2>git fehlende Files entfernen</h2>

<figure class='code'><figcaption><span>git fehlende Files entfernen</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="k">function </span>git_remove_missing_files<span class="o">()</span> <span class="o">{</span>
</span><span class='line'>  git ls-files -d -z | xargs -0 git update-index --remove
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>


<h2>git lokales ignore</h2>

<figure class='code'><figcaption><span>git lokales Ignore</span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="k">function </span><span class="nb">local</span>-ignore<span class="o">()</span> <span class="o">{</span>
</span><span class='line'>  <span class="nb">echo</span> <span class="s2">&quot;$1&quot;</span> &gt;&gt; .git/info/exclude
</span><span class='line'><span class="o">}</span>
</span></code></pre></td></tr></table></div></figure>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Das Ext4 Directory Indexing]]></title>
    <link href="http://noqqe.de/blog/2012/03/08/a-byte-of-ext4-directory-indexing/"/>
    <updated>2012-03-08T19:38:00+01:00</updated>
    <id>http://noqqe.de/blog/2012/03/08/a-byte-of-ext4-directory-indexing</id>
    <content type="html"><![CDATA[<p>Mit ext4 kam unter anderem ein Feature hinzu, welches sich Directory Indexing
nennt. Es ist dazu gedacht in Verzeichnissen mit vielen Dateien eine Art Map
anzulegen an welchen Inodes welche Files liegen und kommt erst ab Fileanzahl X
pro Directory automatisch dazu. Ziel der Entwickler war natürlich Performance Gewinn.</p>

<p>Allerdings kauft man mit diesem Feature auch eine zusätzliche Limitierung mit
ein, bei der ich mich schwer tat wirklich (aufgrund in meiner Wahrnehmung
mangelnder Berichte und Doku) das Problem zu debuggen.</p>

<p>Die Limitierung bei vielen Files sind in den meisten Fällen erstmal die Inodes
der Platte. Ist die Platte aber ausreichend groß (oder die Inodes ausreichend
klein) kommt hier das Directory Indexing ins Spiel:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>EXT4-fs warning (device /dev/sdd): ext4_dx_add_entry: Directory index full!</span></code></pre></td></tr></table></div></figure>


<p>Rsyncs bzw. Schreibende Zugriffe in das Verzeichnis brechen ab und im <code>dmesg</code>
findet man obige Meldung. Problem dabei: In dem Directory Index sind so viele
Files gelistet, dass in dem (wahrscheinlich FS Designtechnisch limitierten,
korrigiert mich bitte) Hashmap Block kein Platz mehr ist. Es können schlicht
und ergreifend keine neuen Einträge hinzugefügt werden.</p>

<h2>Was jetzt?</h2>

<p>Längeres wälzen von Dokumentation lässt sich nicht vermeiden.</p>

<blockquote><p>A linear array of directory entries isn&#8217;t great for performance, so a new<br/>feature was added to ext3 to provide a faster (but peculiar) balanced tree keyed<br/>off a hash of the directory entry name. If the EXT4_INDEX_FL (0x1000) flag is<br/>set in the inode, this directory uses a hashed btree (htree) to organize and<br/>find directory entries.</p><footer><strong>Ext4 Disk Layout,</strong> <cite><a href='https://ext4.wiki.kernel.org/articles/e/x/t/Ext4_Disk_Layout_aecb.html'>ext4.wiki.kernel.org</a></cite></footer></blockquote>


<p>Oder auch andere schaurige Threads aus Mailinglisten:</p>

<p><a href="http://www.mail-archive.com/cwelug@googlegroups.com/msg01937.html">http://www.mail-archive.com/cwelug@googlegroups.com/msg01937.html</a></p>

<p>Mit debugfs lassen sich die Informationen des Filesystems
auszulesen, die einen interessieren. Basic Problematik ist einfach, welches
Verzeichnis ist betroffen, wie konnte das passieren und wie bekomme ich es wieder heile.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="nv">$ </span><span class="nb">cd</span> /var/
</span><span class='line'><span class="nv">$ </span>debugfs
</span><span class='line'>debugfs&gt; open /dev/sdd1
</span><span class='line'>debugfs&gt; <span class="nb">cd </span>log/
</span><span class='line'>debugfs&gt; htree .
</span><span class='line'><span class="o">[</span>...<span class="o">]</span>
</span><span class='line'>Number of Entries <span class="o">(</span>count<span class="o">)</span>: 508
</span><span class='line'>Number of Entries <span class="o">(</span>limit<span class="o">)</span>: 508
</span><span class='line'><span class="o">[</span>...<span class="o">]</span>
</span></code></pre></td></tr></table></div></figure>


<p>
htree listet die Indexes in dem Ordner und Informationen zum hashed B-Tree. Die
Limit und Count Values sprechen denke ich für sich.</p>

<h2>Okay. Problem gefunden. Wie beheb ich es?</h2>

<p>Man baut den Directory Index neu auf, wobei der alte Dir Index
prinzipiell behalten wird und der Neue an der letzten Stelle auf den weiteren
Index referenziert.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>fsck.ext4 -yfD /dev/sdd1
</span></code></pre></td></tr></table></div></figure>


<p>Dazu ist ein unmounten zwingend erforderlich, was bei produktiven Systemen
unschön ist. Oder man löscht das Verzeichnis.</p>

<p>Wie sich später herausgestellt hat war die Ursache davon ein nicht korrekt
funktionierendes Logrotate welches ca 8 Mio. Files produziert hat. Das Löschen
hat auch nur ca. 10 Tage gedauert. Nur so am Rande.</p>

<h2>Irritiert.</h2>

<p>Zum Abschluss muss ich sagen bin ich etwas.. irritiert. Man schafft ein Feature,
dass dann einspringt wenn es viele Files werden (bei meinen Tests ab 300.000
Files), welches dann später wegen diesen vielen Files zu fehlern führt. In dem
Bereich dazwischen ist das eventuell wirklich nett zu haben, weil Perfomance.
Aber dass ich den &#8220;Referenzakt&#8221; nicht anstossen kann während das FS gemountet
ist finde ich dann speziell für den HA Betrieb von Servern &#8230; fragwürdig.</p>

<p>Klar es ist in keinem Fall eine gute Idee mehr als 2 Mio. files in <em>ein</em>
Verzeichnis zu legen, aber hey.</p>

<p>Wirklich gestört hat mich eher das mangelhaft Dokumentierte Vorgehen dafür.
Seitens Entwickler, seitens Community. Aber deswegen hab ich ja jetzt diesen
Post verfasst.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Switched to Octopress]]></title>
    <link href="http://noqqe.de/blog/2012/03/05/switched-to-octopress/"/>
    <updated>2012-03-05T21:22:00+01:00</updated>
    <id>http://noqqe.de/blog/2012/03/05/switched-to-octopress</id>
    <content type="html"><![CDATA[<p>Hatte von <a href="http://octopress.org">Octopress</a> gelesen. Dann nochmal im <a href="http://k4cg.org">k4cg</a> drüber
gesprochen. Irgendwie. So halb und anschliessend für super befunden.</p>

<p><a href="http://noqqe.de/uploads/2012/03/05/zoidberg.png"><img src="http://noqqe.de/uploads/2012/03/05/zoidberg.png" alt="" /></a></p>

<p>Ich weiss nicht warum, aber irgendwie hat mich das Thema dann einfach nicht mehr
los gelassen. Hier probiert, da gemacht. Das Ende vom Lied war dann, dass ich
ein fast vollstänidg migriertes Blog in Octopress lokal gebaut hatte. Dann wars
auch schon egal und ich hab mein Wordpress eingestampft.</p>

<p>Eigentlich ging alles ganz fix.</p>

<ul>
<li>Ruby 1.9.2 via rvm installiert</li>
<li>Die Anleitung auf <a href="http://octopress.org/docs/setup/">octopress.org</a> befolgt</li>
<li>In Wordpress Inhalte in wordpress.xml exportiert</li>
<li>Dem Konvertierungstool <a href="https://github.com/thomasf/exitwp">exitwp</a> vorgeworfen</li>
<li>Alles in <code>source/_posts</code> platziert</li>
<li>wordpress.xml nach <a href="http://disqus.com">Disqus.com</a> hochgeladen</li>
<li>Viele sed/awk Spielchen für die richtigen ImagePfade und Code Block
Formattierung betireben</li>
<li>Deployed auf Webserver</li>
<li>Apache Redirects für alte Posts eingerichtet</li>
</ul>


<p>Lediglich das umgemappe und durch die Gegend redirecte war müßig. Aber naja.
Jetzt ist schön und auch schon umgezogen. Mir gefällts.</p>

<p>Was mir bei der Recherche noch aufgefallen ist:</p>

<blockquote><p>The &lt;center&gt; element is deprecated in HTML4 since 1998. Just use CSS to make it<br/>or its wrapper a block element with a fixed width and margin: 0 auto</p><footer><strong>BalusC,</strong> <cite><a href='http://stackoverflow.com/questions/3912694/using-markdown-how-do-i-center-an-image-and-its-caption'>Stackoverflow</a></cite></footer></blockquote>


<p>WTF. Ich habe ca. 7 Jahre danach das erste mal ein Buch gelesen, dass sich mit
HTML beschäftigt und es war dort schon deprecated. Das war mir nicht klar.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[MySQL | Table Migration zu InnoDB]]></title>
    <link href="http://noqqe.de/blog/2012/01/22/mysql-table-migration-zu-innodb/"/>
    <updated>2012-01-22T15:09:07+01:00</updated>
    <id>http://noqqe.de/blog/2012/01/22/mysql-table-migration-zu-innodb</id>
    <content type="html"><![CDATA[<p>Ich durfte letztens einer schönen Schulung zum Thema MySQL lauschen. Dabei kam viel herrum. Ein Teil davon hat sich mit verschiedenen Storage Engines beschäftigt.</p>

<p>Ich habe mich entschieden den Großteil meiner Datenbanken zu InnoDB umzuwandeln. Welche Vor- und Nachteile das hatt sollte sich jeder vorher klarmachen. Stichwort: ACID und Fulltext-Search. Natürlich könnte man einfach mit ALTER arbeiten. Aber ich wollte nicht umbedingt die alten MyISAM Tables noch im FS liegen haben. Also alle Datenbanken droppen und den geänderten Dump wieder einspielen, sodass die Tables neu (mit InnoDB) angelegt werden.</p>

<p>Zuersteinmal eine Liste mit den generieren mit den Datenbanken die man Bearbeiten möchte. Es ist zu beachten, dass man den mysql Table selbst nicht auf InnoDB umstellen möchte.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>mysql -u root -p -e <span class="s2">&quot;show databases;&quot;</span> -N --batch | grep -v ^information_schema<span class="nv">$ </span>| grep -v ^mysql<span class="err">$</span>
</span></code></pre></td></tr></table></div></figure>


<p>Die Liste der Datenbanken wird nachher noch hilfreich sein. Danach will man wahrscheinlich erstmal alle Dienste beenden, die auf dem MySQL zugreifen (Apache, Tomcat, whatever). In der my.cnf habe ich dann folgende Optionen für die InnoDB spezifiziert.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>defaulot-storage-engine <span class="o">=</span> InnoDB
</span><span class='line'><span class="nv">innodb_buffer_pool_size</span> <span class="o">=</span> 16M
</span><span class='line'><span class="nv">innodb_additional_mem_pool_size</span> <span class="o">=</span> 2M
</span><span class='line'><span class="nv">innodb_log_file_size</span> <span class="o">=</span> 5M
</span><span class='line'><span class="nv">innodb_log_buffer_size</span> <span class="o">=</span> 8M
</span><span class='line'><span class="nv">innodb_flush_log_at_trx_commit</span> <span class="o">=</span> 1
</span><span class='line'><span class="nv">innodb_lock_wait_timeout</span> <span class="o">=</span> 50
</span></code></pre></td></tr></table></div></figure>


<p>Anschliessend den Dump erstellen und alle ENGINE=MyISAM durch InnoDB ersetzen:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>mysqldump -u root -p &gt; all-databases.sql
</span><span class='line'>sed -i -e <span class="s1">&#39;s#ENGINE=MyISAM#ENGINE=InnoDB#g&#39;</span> all-databases.sql
</span></code></pre></td></tr></table></div></figure>


<p><strong>Vorsicht. Hier ist mysql als Datenbank mit gedumped!</strong> Mir ist dabei keine wirklich einfache Zeile eingefallen die mit Suche/Ersetze Spielchen mysql ausschliesst. Es gibt bei mysqldump die Option &#8220;&#8211;ignore-table=&#8221; aber auch hier hätte ich jeden mysql Table einzeln nennen müssen. Ich hab die Datenbank dann einfach per hand aus dem Dump herausgelöscht.</p>

<p>Außerdem sollte man seinen Datenbank Dump nach FULLTEXT durchsuchen, da dieser von InnoDB nicht unterstützt wird. In meinem Fall hat es nur ein altes Forum das niemand mehr benutzt betroffen, weshalb ich die Zeile einfach löschen konnte.</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>grep <span class="s2">&quot;FULLTEXT&quot;</span> all-databases.sql
</span></code></pre></td></tr></table></div></figure>


<p>Um jetzt alle Datenbanken zu droppen hab ich mir folgende Line gebastelt:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'><span class="k">for </span>x in <span class="k">$(</span>mysql -u root -phierstehteinpasswort -e <span class="s2">&quot;show databases;&quot;</span> -N --batch | grep -v ^information_schema | grep -v ^mysql<span class="nv">$)</span> ; <span class="k">do </span>mysql -u root -phierstehteinpasswort -e <span class="s2">&quot;drop database $x ; &quot;</span> --batch  ; <span class="k">done</span>
</span></code></pre></td></tr></table></div></figure>


<p>Nach der Bearbeitung kann man den Dump mit der neuen Engine für die Tables wieder einspielen:</p>

<figure class='code'><figcaption><span></span></figcaption><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='bash'><span class='line'>mysql -u root -p &lt; all-databases.sql
</span></code></pre></td></tr></table></div></figure>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[GNU Parallel ]]></title>
    <link href="http://noqqe.de/blog/2012/01/08/gnu-parallel/"/>
    <updated>2012-01-08T14:47:14+01:00</updated>
    <id>http://noqqe.de/blog/2012/01/08/gnu-parallel</id>
    <content type="html"><![CDATA[<p>Vom <a href="http://www.gnu.org/software/parallel/">GNU Parallel Projekt</a> habe ich vor einiger Zeit in der Arbeit so am Rande etwas mitbekommen. Nachdem ich mir die gute <a href="http://www.gnu.org/software/parallel/man.html">Dokumentation</a> etwas angeschaut habe, hab ich Lust bekommen das mal selbst auszuprobieren.</p>

<p><a href="http://noqqe.de/uploads/2012/01/logo-gray+black300.png"><img src="http://noqqe.de/uploads/2012/01/logo-gray+black300.png" alt="" /></a></p>

<p>Ich dachte es wäre eine gute Idee einfach ein paar md5 Summen zu bilden.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ time seq 1 10000 | parallel 'echo {}| md5sum &&gt; /dev/null '
</span><span class='line'>real  0m20.102s
</span><span class='line'>user  0m35.082s
</span><span class='line'>sys   0m24.918s</span></code></pre></td></tr></table></div></figure>


<p>Nun. Ich bilde nicht so oft 10.000 md5 Summen. War das jetzt viel? Oder wenig? Um einen Vergleichswert zu haben sollte ich wohl auch mal nachsehen, wie das ohne Parallel so aussieht.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ time for x in $(seq 1 10000); do echo $x | md5sum &&gt; /dev/null; done
</span><span class='line'>real  0m13.504s
</span><span class='line'>user  0m2.368s
</span><span class='line'>sys   0m3.948s</span></code></pre></td></tr></table></div></figure>


<p>Ziemlich seltsam. Obwohl ich 10.000 md5 Summen gebildet habe war die sequenzielle Methode schneller als die Parallele. Zumindest dachte ich zu dem Punkt noch das es seltsam ist. Aber an was lag das. Ich hab mir dann überlegt ob ich nicht vielleicht doch noch eine andere Aufgabe als md5 Summenbildung abbilden sollte. Ich entschied mich dazu 1000 mal eine 100.000 Zeichen lange Zeichenkette durch gzip zu schubsen.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ time seq 1 1000 | parallel 'cat /dev/urandom | head -c 100000 | gzip &&gt; /dev/null'
</span><span class='line'>real  0m7.845s
</span><span class='line'>user  0m4.064s
</span><span class='line'>sys   0m20.485s</span></code></pre></td></tr></table></div></figure>


<p>7 Sekunden. Sieht eigentlich ganz nett aus. Und in der Schleife sequenziell?</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>$ time for x in $(seq 1 1000); do cat /dev/urandom | head -c 100000 | gzip &&gt; /dev/null; done
</span><span class='line'>real  0m31.869s
</span><span class='line'>user  0m8.301s
</span><span class='line'>sys   0m33.658s</span></code></pre></td></tr></table></div></figure>


<p>Okay. Jetzt weiss ich, das GNU Parallel eher was für (rechen-)intensivere Aufgaben ist als für viele kleine Prozesse. Anscheinend braucht das Parsing des zusätzlichen Binaries doch etwas zu lange um einen Prozess zu ordnen der sowieso nach sehr kurzer Zeit wieder beendet ist. Alles in allem gefällt mir GNU Parallel aber sehr gut wenn man weiss für was man es einsetzen muss :)</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Arduino | Ich bau mir einen Synthesizer]]></title>
    <link href="http://noqqe.de/blog/2011/12/21/arduino-ich-bau-mir-einen-synthesizer/"/>
    <updated>2011-12-21T17:30:58+01:00</updated>
    <id>http://noqqe.de/blog/2011/12/21/arduino-ich-bau-mir-einen-synthesizer</id>
    <content type="html"><![CDATA[<p>Vor ca. 2 Wochen habe ich auf der <a href="http://k4cg.soup.io">Suppe vom K4CG</a> ein <a href="http://vimeo.com/2266458">Video</a> über einen auf Arduino basierten Synthesizer. Die &#8220;Firmware&#8221; die darauf läuft nennt sich &#8220;Auduino&#8221;.</p>

<p>Auf deren <a href="http://code.google.com/p/tinkerit/wiki/Auduino">Projektseite</a> habe ich mich dann etwas schlau gelesen und wie auch schon bei dem <a href="http://noqqe.de/archives/1751">Megabitmeter</a> über tinkersoup.de meine Teile bestellt. Auf der Projektseite ist die Konstruktion des ganzen finde ich zwar nicht sonderlich gut beschrieben, aber man kommt mit ein bisschen Googeln und Reverse Engineering schon weiter.</p>

<p>Habe dabei aber einen <a href="http://arduino.cc/en/Main/ArduinoBoardNano">Arduino Nano</a> benutzt, weil mir die Anschlüsse bzw &#8220;Architektur&#8221; besser gefällt und ich nicht erst ein Breakout Board von Seriell auf USB nachkaufen musste. Entgegen aller Erwartungen musste ich die Firmware dafür nichtmal modifizieren, da auch bei diesem Board ein ATMega328 verbaut ist.</p>

<p>Ich habe mir wegen der einfacheren Anbringung am Nano so eine Art Halterung/Breadboard mitbestellt, in dem ich die Adern mit Schrauben einfacher verbauen konnte.</p>

<p><a href="http://noqqe.de/uploads/2011/12/IMG_0604.jpg"><img src="http://noqqe.de/uploads/2011/12/IMG_0604.jpg" alt="" /></a></p>

<p>Die Potenziometer (wieder was, das ich gelernt habe) sind in Reihe an den Ground und den 5V Pin geschlossen. Der jeweils mittlere Pin der Drehschalter kommt an die Analog Pins 0 bis 4.</p>

<p><a href="http://noqqe.de/uploads/2011/12/IMG_0606.jpg"><img src="http://noqqe.de/uploads/2011/12/IMG_0606.jpg" alt="" /></a></p>

<p>Danach kam der (für mich) kniffligere Teil. Der Audio Jack (bzw. Klinke Buchse) hat von Haus aus 5 Pins. Auf der Projekte Seite von Auduino nur Input und Ground. Nach bisschen schlaulesen in Wikis und Foren scheint es, als würden die verschiedenen Revisionen von Klinke andere Features mit sich bringen. für den Mini Synthesizer hätte vollkommen Klinke Mono ausgereicht. Diverse Zusatzfunktionskanäle sind da eigentlich überflüssig aber im <a href="http://www.tinkersoup.de/product_info.php?products_id=74&amp;osCsid=3c2172e4114e78d30b2788b3cd0d6077">Audio Jack bei TinkerSoup</a> integriert.</p>

<p>Nach etwas Trial and Error Verfahren den weg für Doofe gewählt. Ich hab ehrlichgesagt einfach ein altes Klinke Stecker auf Buchse Kabel aufgeschnitten und mir die Belegung auf der Steckerseite angesehen.</p>

<p><a href="http://noqqe.de/uploads/2011/12/IMG_0609.jpg"><img src="http://noqqe.de/uploads/2011/12/IMG_0609.jpg" alt="" /></a></p>

<p>Bei 3poligen Klinken Steckern sind die vorderen beiden Kontakte fürs Signal (Links, Rechts) und hinten für Ground. Habe dann die beiden Signaladern auf der Buchsenseite verdrillt und wie vorgesehen in den Digitalen Pin 3 geklemmt. Ground natürlich an seine Stelle.</p>

<p><a href="http://noqqe.de/uploads/2011/12/IMG_0611.jpg"><img src="http://noqqe.de/uploads/2011/12/IMG_0611.jpg" alt="" /></a></p>

<p>Im Endeffekt wars dann schon fertig. Firmware mit dem Arduino IDE auf den Chip geladen und hat auch schon funktioniert.  Aber weil ich dann ständig die Potenziometer durcheinander gebracht habe, hab ich noch eine alte Plastikbox aus dem Baumarkt meiner Wahl benutzt, die entsprechenden Löcher gebohrt dort das ganze eingebaut.</p>

<p><a href="http://noqqe.de/uploads/2011/12/IMG_0616.jpg"><img src="http://noqqe.de/uploads/2011/12/IMG_0616.jpg" alt="" /></a></p>

<p>Etwas smoother ;) Noch ein paar kleine Kostproben von einem wirklich unbegabten Synthesizer-Bediener. Beim hören etwas aufpassen, ab und zu ist mir da ein Ton entglitten.</p>

<p><a href="http://noqqe.de/uploads/2011/12/record.mp4">Auduino Sample Mp4</a>
<a href="http://noqqe.de/uploads/2011/12/record16bit-22kkhz.wav">Auduino Sample WAV 16 bit 22 Kkhz</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[fbcmd | Nie wieder Geburtstage vergessen via Shell. ]]></title>
    <link href="http://noqqe.de/blog/2011/12/11/fbcmd-nie-wieder-geburtstage-vergessen-via-shell/"/>
    <updated>2011-12-11T20:45:18+01:00</updated>
    <id>http://noqqe.de/blog/2011/12/11/fbcmd-nie-wieder-geburtstage-vergessen-via-shell</id>
    <content type="html"><![CDATA[<p>Die nachfolgende Beschreibung eines technischen Vorgangs würde die Mehrheit der Gesellschaft wahrscheinlich als soziologisch fragwürdig abstempeln. Jedoch beschreibe ich den Hergang trotzdem und gerade deswegen.</p>

<p><a href="http://noqqe.de/uploads/2011/12/112817814_facebook-birthday1.jpg"><img src="http://noqqe.de/uploads/2011/12/112817814_facebook-birthday1.jpg" alt="" /></a></p>

<p>Ich weiß gar nicht mehr wie genau ich auf <a href="http://fbcmd.dtompkins.com/">fbcmd</a> gekommen bin.  Im Zweifel über einen XML basierten Medienkanal. Jedenfalls ist fbcmd ein äußerst schönes Tool um die gängigen Informationen zum eigenen Facebook Account auf der Kommandozeile abzufragen. Dazu bietet es wahnsinnig trickreiche Queries und &#8220;Vergruppungen&#8221; der Facebook Bekanntschaften. Alles dazu <a href="http://fbcmd.dtompkins.com/syntax">hier</a> und besonders <a href="http://fbcmd.dtompkins.com/parameters/flist">hier</a>.</p>

<p>Somit lässt sich wunderbar ein automatisches &#8220;Alles Gute zum Geburtstag!&#8221; bauen. Vorraussetzung ist hierfür eine funktionierende <a href="http://fbcmd.dtompkins.com/installation">Installation von fbcmd</a>.</p>

<p>Der von fbcmd vorgeschlagene Query um eine Geburstagsnachricht an die Pinnwand von jenen zu senden, deren Geburtstag sich heute jährt lautet:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>fbcmd WALLPOST =bday 'Alles Gute zum Geburstag!'</span></code></pre></td></tr></table></div></figure>


<p>Das lässt sich natürlich wunderbar in einen Cronjob verbauen, der einmal täglich um 15:00 eben diesen Query ausführt:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>0 15 * * *   fbcmd WALLPOST =bday 'Alles Gute zum Geburstag!' &gt; /dev/null</span></code></pre></td></tr></table></div></figure>


<p>Weil ich aber wissen möchte, wem mein Rechner alles in meinem Namen zum Geburtstag graturliert hab ich das noch leicht modifiziert und lasse mich via Mail darüber benachrichtigen:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>0 15 * * *   fbcmd WALLPOST =bday 'Alles Gute zum Geburstag!'  | grep -v "^No Friends With Birthday Matches$" | mail -s "fbcmd Gratulation" user@domain.de</span></code></pre></td></tr></table></div></figure>


<p>Eigentlich ist der Titel des Posts gar nicht richtig. Man vergisst Sie trotzdem. Aber ein Device erledigt die Arbeit für einen :)</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Loading | Eine Bash-Progress-Bar]]></title>
    <link href="http://noqqe.de/blog/2011/11/26/loading-eine-bash-progress-bar/"/>
    <updated>2011-11-26T14:53:21+01:00</updated>
    <id>http://noqqe.de/blog/2011/11/26/loading-eine-bash-progress-bar</id>
    <content type="html"><![CDATA[<p>Für ein kleines Projekt, an dem ich so nebenher immer etwas schreibe habe ich eine Art Ladebalken gebraucht. Habe ein paar wirklich coole Lösungsansätze gefunden, aber es läuft meistens auf Depencies raus (pv z.B.) oder nicht wirklich mein Anwendungsfall.</p>

<p><a href="http://noqqe.de/uploads/2011/11/not-sure-if-loading.png"><img src="http://noqqe.de/uploads/2011/11/not-sure-if-loading.png" alt="" /></a></p>

<p>Ich hab mir dann kurzerhand was selber gebastelt. Ich gebe zu ich hätte es auch so gestaltet können das es einfach nur für meinen Use-Case gereicht hätte, aber das erschien mir unsinnig. Wenn ich mich schon einen halben Abend hinsetze, dann können ja evtl. auch mehr Menschen was davon haben. So entstand dann die <a href="https://github.com/noqqe/bash-progress-bar">bash-progress-bar</a>.</p>

<p>Zu allererst besteht der Ladebalken aus einer while true Schleife. Sollte die Bar in ein Skript einbaut werden wäre die Bedingung dem Skript anzupassen. Ob das jetzt ein test -e auf ein File ist das getouched wird oder eine Art Counter bleibt jedem selbst überlassen.</p>

<pre><code>$ git clone git://github.com/noqqe/bash-progress-bar.git
$ cd /bash-progress-bar/
$ ./loading.sh
&gt; [            #####       ]
</code></pre>

<p>Alle Parameter sind natürlich anpassbar. Ich habe versucht so gut wie alles anpassbar zu halten. Ich hoffe das ist mir gelungen ;)</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>./loading.sh Groesse Geschwindigkeit Rahmen-Anfang Füllcharacter Rahmen-Ende
</span><span class='line'>./loading.sh 50 0.02 [ "######" ]</span></code></pre></td></tr></table></div></figure>


<p>Ohne irgendwie ein GIF-File zu erstellen kann ich das jetzt leider schlecht im Blog demonstrieren. Deshalb: ausprobieren :) Mehr Infos auf der Github Page.</p>

<p>Fragen, Anregungen, Kritik erwünscht!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Taskwarrior | The better-task-shell]]></title>
    <link href="http://noqqe.de/blog/2011/10/22/taskwarrior-the-better-task-shell/"/>
    <updated>2011-10-22T14:05:57+02:00</updated>
    <id>http://noqqe.de/blog/2011/10/22/taskwarrior-the-better-task-shell</id>
    <content type="html"><![CDATA[<p>Eigentlich wollte ich das Projekt task-shell-ng nennen. Aber so gut ist es dann doch nicht geworden. Stattdessen hat es sich aber den Prefix better verdient ;)</p>

<p>Als ich vor ca. einem Monat Taskwarrior für mich entdeckt habe, war eigentlich alles gut. Ich hab mich über den integrierten interactive Mode wirklich gefreut. Anfangs. Mit der Zeit habe ich aber festgestellt, dass mich dieses &#8220;Ding&#8221; fast in den Wahnsinn treibt. Mir persönlich fehlen einfach elementare Features wie einfaches Cursor bewegen nach vorne und zurück. Überhaupt eine History zu haben wäre schon ein enormer Vorteil.</p>

<p><a href="http://noqqe.de/uploads/2011/10/1733_f644.gif"><img src="http://noqqe.de/uploads/2011/10/1733_f644.gif" alt="" /></a></p>

<p>Ich hab mir dann kurzer Hand selber eine Taskwarrior Shell Variante gebaut, die im großen und ganzen auf einer Bash basiert.</p>

<p><strong>Features:</strong></p>

<ul>
<li><p>History vorwärts und rückwärts via Pfeiltasten</p></li>
<li><p>Cursorbewegung vorwärts und rückwerts in der aktuellen Zeile</p></li>
<li><p>Alle Kommandos nativ benutzbar ( $ add pri:H pro:Living Miete zahlen )</p></li>
<li><p>ID&#8217;s direkt nutzbar ( $ 34 edit oder $ 12 pri:H )</p></li>
<li><p>separate Logging Funktion in $HOME/.better-task-shell_history</p></li>
<li><p>OS Befehle weiterhin nutzbar! ( $ vim /home/user/foobar.txt )</p></li>
<li><p>Automatische Erkennung von doppelten Aliases</p></li>
<li><p>Automatische Alias Generierung fuer os-binaries ( $ ls  = task ls  ; os-ls = /bin/ls )</p></li>
<li><p>Auto-Komplettierung aller Taskwarrior Befehle und definierte Aliase</p></li>
</ul>


<p><strong>Known Bugs:</strong></p>

<ul>
<li><p>Neu angelegt tasks  können derzeit noch nicht via ID aufgerufen werden.
$ add Uberweisung einwerfen
Created Task 45
$ 45 pri:H
bash: 45: Kommando nicht gefunden
Für beim Start bestehende Einträge funktioniert dies allerdings problemlos.</p></li>
<li><p>Mode -v ist bis jetzt noch nicht benutzbar aber bereits implementiert.</p></li>
</ul>


<p>Das ganze gibts jetzt unter <a href="http://github.com/noqqe/better-task-shell">http://github.com/noqqe/better-task-shell</a></p>

<p><strong>Usage:</strong></p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git clone git@github.com:noqqe/better-task-shell.git
</span><span class='line'>$ cd better-task-shell
</span><span class='line'>$ ./better-task-shell</span></code></pre></td></tr></table></div></figure>



]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Git and the Unix philosophy]]></title>
    <link href="http://noqqe.de/blog/2011/10/15/git-and-the-unix-philosophy/"/>
    <updated>2011-10-15T16:02:46+02:00</updated>
    <id>http://noqqe.de/blog/2011/10/15/git-and-the-unix-philosophy</id>
    <content type="html"><![CDATA[<p>Mein Feedreader hat heute einen <a href="http://blog.plenz.com/2011-10/git-and-the-unix-philosophy.html">Post von Julius</a> ausgespuckt, den ich so gut fand, dass ich ihn hier rezitieren möchte.</p>

<blockquote><p>Git follows Linux&#8217;s philosophy of refusing to protect you from yourself. Much
like Linux, Git will sit back and watch you fuck your shit right up, and then
laugh at you as you try to get your world back to a state where up is up and
down is down. As far as source control goes, not a lot of people are used to
this kind of free love.</p></blockquote>

<p>Ich rezitierte also <a href="http://teddziuba.com/2010/08/too-smart-for-git.html">Julius Zitat</a>. Blogpost-Inception?</p>
]]></content>
  </entry>
  
</feed>

