
INSERT INTO posts (
    id,
    -- draft,
    title,
    body,
    created_at,
    updated_at
)
VALUES

(
    'd1bd1918-4cc3-425f-ad83-13f58300301a',
    'Succinct Description of UTF-8 Encoding',
    'UTF-8 is actually a pretty neat way to encode text. Its clever design leads to several interesting
properties. Notably of which, at least to me, is that all ASCII files are already UTF-8 encoded.

      Unicode code points    |       UTF-8 encoding (binary)
    --------------------------------------------------------------
            00-7F ( 7 bits)  |                            0tuvwxyz
        0080-07FF (11 bits)  |                   110pqrst 10uvwxyz
        0800-FFFF (16 bits)  |          1110jklm 10npqrst 10uvwxyz
    010000-10FFFF (21 bits)  | 11110efg 10hijklm 10npqrst 10uvwxyz',
    '2011-04-26 00:00:00',
    '2011-04-26 00:00:00'
)
,
(
    '6d011855-6b0d-4202-a243-4d9db9807f14',
    'A Solid Breakdown of the Linux Font Rendering Stack',
    '[This](https://freddie.witherden.org/pages/font-rasterisation "A Treatise on Font Rasterisation With an Emphasis on Free Software")
article saved me. Explains hinting and anti-aliasing quite well, also includes an excellent description of the Linux 
font rendering stack.',
    '2011-04-26 00:00:00',
    '2011-04-26 00:00:00'
)
,
(
    '045b62f8-6763-44e5-9859-976b5783725a',
    'gvim + ibus woes / building gvim from source',
    'My main development machine is running Ubuntu 12.04 and for a while now I''ve had issues with using gvim 7.3.x in 
conjunction with ibus. Specifically upon starting gvim there''s a long start up latency (30s+) while the ibus daemon
is running. Shutdown the ibus daemon and gvim starts up near instantly. 
[Here](https://bugs.launchpad.net/ubuntu/+source/vim/+bug/987707) is the ticket describing the issue in more 
detail in [Launchpad](https://launchpad.net/)

Yesterday vim 7.4 was just released and according to the aforementioned ticket the issue was resolved in 7.3.530.
Unfortunately neither vim 7.4 nor 7.3.530 are yet in the Ubuntu repos, so I decided to build 7.4 from source. 
Along the way I''ll attempt to jot down some notes here for my future self.

I didn''t know before I began, but gvim is actually built from the same source tree as vim source. Before we start, we''ll need 
to make sure we have all the necessary development libraries required to build gvim. Ubuntu docs suggest the following 
command should work -- I can''t say for sure as I had a lot of requisite development libraries installed as other projects 
I''m working on depend on them as well.

    ~ $ sudo apt-get build-dep vim

We''ll need mercurial to pull down the latest vim sources. I''m going to build the sources in my `~/working` directory.
Since I doubt I''ll need the repo metadata (the included `.hg` directory) so I''ll remove that to reclaim a little space.

    ~ $ sudo apt-get install mercurial
    ~ $ cd ~/working/
    ~/working $ hg clone https://vim.googlecode.com/hg/ vim
    ~/working $ cd vim
    ~/working/vim $ du -sh
    139M	.
    ~/working/vim $ rm -rf .hg
    ~/working/vim $ du -sh
    65M	.

Then to build, change into the `src` directory and run configure with the options below. I want to build with pretty 
much all the features so I''ll go with the option `--with-features=huge`; optionally you can use tiny, small, normal, or big
instead; a breakdown of the differences is given [here](http://www.drchip.org/astronaut/vim/vimfeat.html). The options 
of the form `--enable-XXXinterp` are support for vim plugins written in XXX. The `--enable-gui=gtk2` option is 
obviously for gvim support.

    ~/working/vim $ cd src
    ~/working/vim $ ./configure --with-features=huge --enable-rubyinterp  \
                               --enable-pythoninterp --enable-perlinterp \
                               --enable-luainterp --enable-gui=gtk2

Once the configuration script runs without errors, we can then build with make. Note the `VMRUNTIMEDIR` variable passed
to make. This is the location of default system runtime director for vim plugins, docs, dictionaries, etc... for Ubuntu.

    ~/working/vim $ make VIMRUNTIMEDIR=/usr/share/vim/vim73

At this point one could optionally install vim on their system using the typical `make install` target. But 
this feels dirty to me. Plus I prefer to keep all my development tools installed within my home directory. This makes migrating my 
my development environment much less painful. So I''ll define an alias in my `~/.bashrc` and be good to go.

    ~/working/vim $ alias | grep gvim
    alias gvim=''~/working/vim/src/vim -g -p''

やった！',
    '2013-08-11 00:00:00',
    '2013-08-11 00:00:00'
)
,
(
    '4cc0c8a1-50a7-4896-9ff7-4bd1e5f93468',
    'Shell Wildcard Channel Attacks',
    'Using wildcards with a shell can open you up to channeling attacks (for example, sql injection is a type of channeling attack).
When using the `*` wildcard in particular in a directory containing argument-like-filenames (e.g. `-rf`) can lead to wild results.

zum Beispiel:

    [root@defensecode public]# ls -al
    total 20
    drwxrwxr-x.  5 leon   leon   4096 Oct 28 17:04 .
    drwx------. 22 leon   leon   4096 Oct 28 16:15 ..
    drwxrwxr-x.  2 leon   leon   4096 Oct 28 17:04 DIR1
    drwxrwxr-x.  2 leon   leon   4096 Oct 28 17:04 DIR2
    drwxrwxr-x.  2 leon   leon   4096 Oct 28 17:04 DIR3
    -rw-rw-r--.  1 leon   leon      0 Oct 28 17:03 file1.txt
    -rw-rw-r--.  1 leon   leon      0 Oct 28 17:03 file2.txt
    -rw-rw-r--.  1 leon   leon      0 Oct 28 17:03 file3.txt
    -rw-rw-r--.  1 nobody nobody    0 Oct 28 16:38 -rf

    [root@defensecode public]# rm *
    [root@defensecode public]# ls -al
    total 8
    drwxrwxr-x.  2 leon   leon   4096 Oct 28 17:05 .
    drwx------. 22 leon   leon   4096 Oct 28 16:15 ..
    -rw-rw-r--.  1 nobody nobody    0 Oct 28 16:38 -rf

Because `rm *` expands to:

    [user@defensecode WILD]$ rm DIR1 DIR2 DIR3 file1.txt file2.txt file3.txt -rf

This type of attack used in conjunction with seemingly innocuous utilities like `tar` can lead to execution of arbitrary commands.',
    '2014-08-21 00:00:00',
    '2014-08-21 00:00:00'
)
,
(
    '7b9ab699-5cf6-4f3f-9ac8-b3cece0732a8',
    'Debugging CGI / CGit',
    'I''ve been using CGit as a [git web front-end](http://bunkergate.org/cgit) for a bit now and just recently started
looking into customizing the root header. Assuming I''d have to hack the code to do so, I decided to pull down the source and build it.

    ~ $ git clone http://git.zx2c4.com/cgit/
    ~ $ cd cgit/
    ~/cgit $ make get-git && make

After perusing
`cgit.c` and `ui-shared.c` I was pleasantly surprised to find I wouldn''t have to hack anything; it seems
that just about everything I wanted to change was configurable via the cgit config file (default: `/etc/cgitrc`).
For example for changing the root title and description, just set `root-title` and `root-desc`:

    ~ $ grep ''root'' /etc/cgitrc
    root-title=bunkergate.org
    root-desc=git repository browser

This worked fine, but what about changing the logo? Just overwriting the `logo.png` in the resources directory should work,
but I want to use an animated gif. The file extension then would be technically incorrect, the worst kind of incorrect. Fortunately, it
too looks like this could be set with `logo` in `cgitrc` as well. But this didn''t seem to work. What''s going on?

To run cgit from the CLI, simply do the following. HTML output is printed to stdout and errors are printed to stderr.
This will generate the root index content.

    ~/cgit $ CGIT_CONFIG="./cgitrc" ./cgit 1>stdout.html 2>stderr.log

As an example, to see the content generated for a specific repo, do the following:

    ~/cgit $ CGIT_CONFIG="./cgitrc" QUERY_STRING="url=bunkergate" ./cgit 1>stdout.html 2>stderr.log
    ~/cgit $ CGIT_CONFIG="./cgitrc" QUERY_STRING="url=bunkergate/tree/index.html" ./cgit 1>stdout.html 2>stderr.log

It''s worth noting that this is probably a basic template for debugging any CGI.

Setting `logo` in the configuration file
didn''t seem to have the desired effect. How can we see what''s going on? Simple, run it in GDB:

    ~/cgit $ CGIT_CONFIG="./cgitrc" QUERY_STRING="url=bunkergate/tree/index.html" gdb ./cgit

So what was happening? Well after setting a watchpoint on `ctx.cfg.logo` I noticed something peculiar. The variable was getting set to
the value I expected, but then later it was getting set yet again to the undesired value. Turns out that the problem was that I had set
`logo` twice in the configuration file. Ugh.',
    '2014-08-26 00:00:00',
    '2014-08-26 00:00:00'
)
,
(
    '8f681716-6eed-4f26-868c-f334377dfe12',
    'Sideloading Nexus Devices with the Android SDK',
    'Android 5.0 "Lollipop" was released yesterday and I wanted to check it out on my Nexus 7 2013 WiFi tablet without having to wait for the update to be pushed.
I''ve done this several times with various Nexus devices now, but so infrequently that I always have to look up how to do it. So this time I''m taking
some notes. It should be noted that most of this information is just scraped from the `flash-all.{bat,sh}` included in the factory image.

First off, Nexus factory images are listed [here](https://developers.google.com/android/nexus/images). Start off by pulling the proper
one down, verifying the integrity, and then extracting the tarball:

    ~ $ mkdir tmp && cd tmp && wget -q https://dl.google.com/dl/android/aosp/razor-lrx21p-factory-ba55c6ab.tgz
    ~/tmp $ md5sum razor-lrx21p-factory-ba55c6ab.tgz 
    fd868b03bd00074dd7f70e31ad73b25a  razor-lrx21p-factory-ba55c6ab.tgz
    ~/tmp $ tar xf razor-lrx21p-factory-ba55c6ab.tgz 
    ~/tmp $ ls razor-lrx21p
    bootloader-flo-flo-04.04.img  flash-all.bat  flash-all.sh  flash-base.sh  image-razor-lrx21p.zip

To start the bootloader will need to be unlocked. This will wipe the data on the device, but once unlocked this is no longer an issue when flashing
in the future. Sideloading the image requires the [Android SDK platform tools](http://developer.android.com/tools/sdk/tools-notes.html).

First thing''s first: get into the bootloader. Begin by plugging the tablet into the PC and verifying that it''s connected.

    ~/android-studio/sdk/platform-tools $ ./adb devices -l
    List of devices attached 
    0a16e983               device usb:1-1.2 product:razor model:Nexus_7 device:flo

Now reboot into the bootloader:

    ~/android-studio/sdk/platform-tools $ ./adb reboot bootloader

Once in the bootloader make sure the device is connected/detected:

    ~/android-studio/sdk/platform-tools $ sudo ./fastboot devices -l
    0a16e983               fastboot usb:1-1.2

If the bootloader is not already unlocked this will need to be done first (note: this wipes the device, so be sure to back things up beforehand).
Unlock the bootloader with the following command (follow the prompts on the device; it''ll warn about wiping the device clean):

    ~/android-studio/sdk/platform-tools $ sudo ./fastboot oem unlock
    ...
    (bootloader) Unlocking bootloader...
    (bootloader) erasing userdata...
    (bootloader) erasing userdata done
    (bootloader) erasing cache...
    (bootloader) erasing cache done
    (bootloader) Unlocking bootloader done!
    OKAY [ 65.559s]
    finished. total time: 65.559s

Now flash the bootloader image downloaded earlier:

    ~/android-studio/sdk/platform-tools $ sudo ./fastboot  flash bootloader ~/tmp/razor-lrx21p/bootloader-flo-flo-04.04.img 
    sending ''bootloader'' (3911 KB)...
    OKAY [  0.192s]
    writing ''bootloader''...
    OKAY [  1.936s]
    finished. total time: 2.128s

And reboot into the bootloader again:

    ~/android-studio/sdk/platform-tools $ sudo ./fastboot reboot-bootloader
    rebooting into bootloader...
    OKAY [  0.006s]
    finished. total time: 0.006s

Next flash the zip image:

    ~/android-studio/sdk/platform-tools $ sudo ./fastboot -w update ~/tmp/razor-lrx21p/image-razor-lrx21p.zip 
    archive does not contain ''boot.sig''
    archive does not contain ''recovery.sig''
    archive does not contain ''system.sig''
    --------------------------------------------
    Bootloader Version...: FLO-04.04
    Baseband Version.....: none
    Serial Number........: 0a16e983
    --------------------------------------------
    checking product...
    OKAY [  0.003s]
    checking version-bootloader...
    OKAY [  0.004s]
    sending ''boot'' (7154 KB)...
    OKAY [  0.347s]
    writing ''boot''...
    OKAY [  0.420s]
    sending ''recovery'' (7740 KB)...
    OKAY [  0.369s]
    writing ''recovery''...
    OKAY [  0.297s]
    erasing ''system''...
    OKAY [  1.510s]
    sending ''system'' (799121 KB)...
    OKAY [ 37.893s]
    writing ''system''...
    OKAY [ 35.392s]
    erasing ''userdata''...
    OKAY [ 23.679s]
    formatting ''userdata'' partition...
    Creating filesystem with parameters:
        Size: 28856791040
        Block size: 4096
        Blocks per group: 32768
        Inodes per group: 8192
        Inode size: 256
        Journal blocks: 32768
        Label: 
        Blocks: 7045115
        Block groups: 215
        Reserved block group size: 1024
    Created filesystem with 11/1761280 inodes and 154578/7045115 blocks
    sending ''userdata'' (139085 KB)...
    writing ''userdata''...
    OKAY [ 13.485s]
    erasing ''cache''...
    OKAY [  0.406s]
    formatting ''cache'' partition...
    Creating filesystem with parameters:
        Size: 587202560
        Block size: 4096
        Blocks per group: 32768
        Inodes per group: 7168
        Inode size: 256
        Journal blocks: 2240
        Label: 
        Blocks: 143360
        Block groups: 5
        Reserved block group size: 39
    Created filesystem with 11/35840 inodes and 4616/143360 blocks
    sending ''cache'' (10984 KB)...
    writing ''cache''...
    OKAY [  1.033s]
    rebooting...

    finished. total time: 114.857s

And now it''s finished. If the bootloader was already locked previously, then you can remove the `-w` flag in the last
command to avoid wiping the device (note: I''ve not tried this yet).',
    '2014-11-13 00:00:00',
    '2014-11-13 00:00:00'
)
,
(
    '6e574a3a-b5bd-4457-afa6-9d41a5b4b3bf',
    'Flask Development on a Raspberry Pi',
    'Currently the [`flog`](http://bunkergate.org/git/flog "flog git repo") project requires lxml as a dependency. I had some issues pulling this in.

    ~ $ cd py_toy/
    ~/py_toy $ cat dependencies.txt
    lxml
    ~/py_toy $ virtualenv -p `which python3` venv
    Already using interpreter /usr/bin/python3
    Using base prefix ''/usr''
    New python executable in venv/bin/python3
    Also creating executable in venv/bin/python
    Installing setuptools, pip...done.
    ~/py_toy $ . venv/bin/activate
    (venv)~/py_toy $ time pip install -r dependencies.txt
    [ output truncated ]
        creating build/temp.linux-armv6l-3.4/src/lxml

        gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-3ikmlcvh/lxml/src/lxml/includes -I/usr/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-armv6l-3.4/src/lxml/lxml.etree.o -w

        gcc: internal compiler error: Killed (program cc1)

        Please submit a full bug report,

        with preprocessed source if appropriate.

        See <https://github.com/archlinuxarm/PKGBUILDs/issues> for instructions.

        /usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: ''bugtrack_url''

          warnings.warn(msg)

        error: command ''gcc'' failed with exit status 4

        ----------------------------------------
        Command "/root/py_toy/venv/bin/python3 -c "import setuptools, tokenize;__file__=''/tmp/pip-build-3ikmlcvh/lxml/setup.py'';exec(compile(getattr(tokenize, ''open'', open)(__file__).read().replace(''\r\n'', ''\n''), __file__, ''exec''))" install --record /tmp/pip-ytt52_hh-record/install-record.txt --single-version-externally-managed --compile --install-headers /root/py_toy/venv/include/site/python3.4" failed with error code 1 in /tmp/pip-build-3ikmlcvh/lxml

    real    27m18.069s
    user    26m55.390s
    sys     0m11.620s
    (venv)~/py_toy $

I was exhausting all 512 MB of memory. As a workaround, I temporarily employed a 512 MB swapfile on the SD card.

    (venv)~/py_toy $ sudo dd if=/dev/zero of=/swapfile bs=1M count=512
    512+0 records in
    512+0 records out
    536870912 bytes (537 MB) copied, 132.228 s, 4.1 MB/s
    (venv)~/py_toy $ sudo mkswap /swapfile
    Setting up swapspace version 1, size = 524284 KiB
    no label, UUID=c45c43c4-00dd-463b-a5ca-30ddeb0b102e
    (venv)~/py_toy $ sudo chmod 600 /swapfile
    (venv)~/py_toy $ sudo swapon /swapfile
    (venv)~/py_toy $ time pip install -r dependencies.txt 
    Collecting lxml (from -r dependencies.txt (line 1))
      Using cached lxml-3.4.2.tar.gz
        Building lxml version 3.4.2.
        Building without Cython.
        Using build configuration of libxslt 1.1.28
        Building against libxml2/libxslt in the following directory: /usr/lib
        /usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: ''bugtrack_url''
          warnings.warn(msg)
    Installing collected packages: lxml
      Running setup.py install for lxml
        Building lxml version 3.4.2.
        Building without Cython.
        Using build configuration of libxslt 1.1.28
        Building against libxml2/libxslt in the following directory: /usr/lib
        building ''lxml.etree'' extension
        gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-8m8hfu47/lxml/src/lxml/includes -I/usr/include/python3.4m -c src/lxml/lxml.etree.c -o build/temp.linux-armv6l-3.4/src/lxml/lxml.etree.o -w
        gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro build/temp.linux-armv6l-3.4/src/lxml/lxml.etree.o -L/usr/lib -L/usr/lib -lxslt -lexslt -lxml2 -lz -lm -lpython3.4m -o build/lib.linux-armv6l-3.4/lxml/etree.cpython-34m.so
        building ''lxml.objectify'' extension
        gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=armv6 -mfloat-abi=hard -mfpu=vfp -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fPIC -I/usr/include/libxml2 -I/tmp/pip-build-8m8hfu47/lxml/src/lxml/includes -I/usr/include/python3.4m -c src/lxml/lxml.objectify.c -o build/temp.linux-armv6l-3.4/src/lxml/lxml.objectify.o -w
        gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro build/temp.linux-armv6l-3.4/src/lxml/lxml.objectify.o -L/usr/lib -L/usr/lib -lxslt -lexslt -lxml2 -lz -lm -lpython3.4m -o build/lib.linux-armv6l-3.4/lxml/objectify.cpython-34m.so
        /usr/lib/python3.4/distutils/dist.py:260: UserWarning: Unknown distribution option: ''bugtrack_url''
          warnings.warn(msg)
    Successfully installed lxml-3.4.2

    real	33m46.351s
    user	32m43.210s
    sys	0m16.700s
    (venv)~/py_toy $

Success!',
    '2015-03-20 00:00:00',
    '2015-03-20 00:00:00'
)
,
(
    '7d5c1e2f-f54f-471a-8cd7-e0c05abc3285',
    'SSH Tunneling for Fun and Profit',
    'First, to test, set up temporary Python http server on the remote host:

    [user@remotehost ~]$ mkdir tmp && cd tmp
    [user@remotehost tmp]$ echo "HELLO WORLD" > index.html
    [user@remotehost tmp]$ python -m http.server 8080 # python3
    Serving HTTP on 0.0.0.0 port 8080 ...
    [user@remotehost tmp]$ python -m SimpleHTTPServer 8080 #python2
    Serving HTTP on 0.0.0.0 port 8080 ...


Then on the localhost use ssh to set up a tunnel. Here port 8081 on the local machine will tunnel through to 8080 on the remote host:
    
    user@localhost ~ $ ssh -p 443 -f user@remotehost.com -L 8081:127.0.0.1:8080 -N
    user@remotehost.com''s password: 

* `-p` for remote sshd port (default is 22).
* `-f` tells ssh to go into the background just before it executes the command. This is followed by the username and server you are logging into. 
* The `-L` 8081:127.0.0.1:8080 is in the form of -L local-port:host:remote-port. Here the I''m using the loopback for the host, this refers to the remote host''s loopback interface.
* Finally the `-N` instructs OpenSSH to not execute a command on the remote system.

Test the tunnel with telnet on local machine.

    user@localhost ~ $ telnet 127.0.0.1 8081
    Trying 127.0.0.1...
    Connected to 127.0.0.1.
    Escape character is ''^]''.
    GET /

    HELLO WORLD
    Connection closed by foreign host.',
    '2015-04-06 00:00:00',
    '2015-04-06 00:00:00'
)
,
(
    '2a8620f0-1a88-4732-9386-8515f65ae671',
    'RPM Packaging Environment for an Arbitrary User',
    'Recently I had to roll my own package on CentOS 7. It''s been a while since I''ve done this and so I had to dig around online to remember how to set up an environment for packaging. So this time around I''ll jot down some notes.

First thing''s first, to build as an arbitrary user we''ll need to set up a space for RPMs to be packaged in. Start by defining the location with this via the RPM Macro `_topdir`:

    [mcvady@centos7 ~]$ cat ~/.rpmmacros
    %_topdir /home/mcvady/working/rpm

Once set this value should be picked up immediately. Test the value from shell like so:

    [mcvady@centos7 ~]$ rpm --eval ''%_topdir''
    /home/mcvady/working/rpm

Now create the RPM top-level directory:

    [mcvady@centos7 ~]$ mkdir -p `rpm --eval ''%_topdir''` # create RPM output directory

Here''s a helper script I drop in `~/bin/` to flesh out the structure of the RPM packaging top-level directory (Note that `~/bin/` is automatically added to `$PATH` in the default `~/.bash_profile`):

    #!/bin/bash

    set -e

    RM_BIN="/usr/bin/rm"
    RPM_BIN="/usr/bin/rpm"
    MKDIR_BIN="/usr/bin/mkdir"

    rpmtopdir=`$RPM_BIN --eval ''%_topdir''`

    pushd $rpmtopdir 2>&1 > /dev/null

    $RM_BIN -rf BUILD/*
    $RM_BIN -rf BUILDROOT/*
    $RM_BIN -rf RPMS/*
    $RM_BIN -rf SOURCES/*
    $RM_BIN -rf SPECS/*
    $RM_BIN -rf SRPMS/*

    $MKDIR_BIN -p BUILD
    $MKDIR_BIN -p BUILDROOT
    $MKDIR_BIN -p RPMS/x86_64
    $MKDIR_BIN -p SOURCES
    $MKDIR_BIN -p SPECS
    $MKDIR_BIN -p SRPMS

    popd 2>&1 > /dev/null

And now to test that packaging works by packaging a project:

    [mcvady@centos7 ~]$ cd working/
    [mcvady@centos7 working]$ git clone http://git.bunkergate.org/chunker
    Cloning into ''chunker''...
    [mcvady@centos7 working]$ cd chunker/
    [mcvady@centos7 chunker]$ ./package.sh 0.9.1
    srcdir /home/mcvady/working/rpm/SOURCES
    ~/working/chunker ~/working/chunker
    rm -f chunker test-overflow test-cleanMarkerKeepLast test-handshake ./src/stats.o ./src/connection.o
    -rw-rw-r-- mcvady/mcvady  3654 2015-05-13 15:59 chunker.spec
    -rw-rw-r-- mcvady/mcvady   474 2015-05-13 15:59 INSTALL
    drwxrwxr-x mcvady/mcvady     0 2015-05-13 15:59 lib/
    -rw-rw-r-- mcvady/mcvady  6551 2015-05-13 15:59 lib/dictionary.h
    -rw-rw-r-- mcvady/mcvady 39097 2015-05-13 15:59 lib/iniparser-3.1.tar.gz
    -rw-rw-r-- mcvady/mcvady 11574 2015-05-13 15:59 lib/iniparser.h
    -rw-rw-r-- mcvady/mcvady 17594 2015-05-13 15:59 lib/libiniparser.a
    -rwxrwxr-x mcvady/mcvady 18867 2015-05-13 15:59 lib/libiniparser.so.0
    -rw-rw-r-- mcvady/mcvady  2221 2015-05-13 15:59 makefile
    -rwxrwxr-x mcvady/mcvady  1035 2015-05-13 15:59 package.sh
    -rw-rw-r-- mcvady/mcvady   236 2015-05-13 15:59 README
    drwxrwxr-x mcvady/mcvady     0 2015-05-13 15:59 src/
    -rwxrwxr-x mcvady/mcvady  3718 2015-05-13 15:59 src/chunker-init
    -rw-rw-r-- mcvady/mcvady 22744 2015-05-13 15:59 src/chunker.c
    -rw-rw-r-- mcvady/mcvady  1066 2015-05-13 15:59 src/chunker.conf
    -rw-rw-r-- mcvady/mcvady  2409 2015-05-13 15:59 src/chunker.h
    -rwxrwxr-x mcvady/mcvady  2628 2015-05-13 15:59 src/chunker2s3.sh
    -rw-rw-r-- mcvady/mcvady    98 2015-05-13 15:59 src/chunker_health-cron
    -rwxrwxr-x mcvady/mcvady   969 2015-05-13 15:59 src/chunker_health.sh
    -rw-rw-r-- mcvady/mcvady 12154 2015-05-13 15:59 src/connection.c
    -rw-rw-r-- mcvady/mcvady  1325 2015-05-13 15:59 src/connection.h
    -rw-rw-r-- mcvady/mcvady  5014 2015-05-13 15:59 src/stats.c
    -rw-rw-r-- mcvady/mcvady   382 2015-05-13 15:59 src/stats.h
    drwxrwxr-x mcvady/mcvady     0 2015-05-13 15:59 test/
    -rw-rw-r-- mcvady/mcvady  2978 2015-05-13 15:59 test/test-cleanMarkerKeepLast.c
    -rw-rw-r-- mcvady/mcvady  3159 2015-05-13 15:59 test/test-handshake.c
    -rw-rw-r-- mcvady/mcvady  1923 2015-05-13 15:59 test/test-overflow.c
    -rw-rw-r-- mcvady/mcvady   464 2015-05-13 15:59 TODO
    ~/working/chunker
    SPEC [/home/mcvady/working/rpm/SPECS/chunker_0.9.1.spec]
    ~/working/rpm/SPECS ~/working/chunker
    Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.FV0fiB
    + umask 022
    + cd /home/mcvady/working/rpm/BUILD
    + cd /home/mcvady/working/rpm/BUILD
    + rm -rf chunker-0.9.1
    + /usr/bin/mkdir -p chunker-0.9.1
    + cd chunker-0.9.1
    + /usr/bin/gzip -dc /home/mcvady/working/rpm/SOURCES/chunker-0.9.1.tgz
    + /usr/bin/tar -xvvf -
    -rw-rw-r-- mcvady/mcvady  3654 2015-05-13 15:59 chunker.spec
    -rw-rw-r-- mcvady/mcvady   474 2015-05-13 15:59 INSTALL
    drwxrwxr-x mcvady/mcvady     0 2015-05-13 15:59 lib/
    -rw-rw-r-- mcvady/mcvady  6551 2015-05-13 15:59 lib/dictionary.h
    -rw-rw-r-- mcvady/mcvady 39097 2015-05-13 15:59 lib/iniparser-3.1.tar.gz
    -rw-rw-r-- mcvady/mcvady 11574 2015-05-13 15:59 lib/iniparser.h
    -rw-rw-r-- mcvady/mcvady 17594 2015-05-13 15:59 lib/libiniparser.a
    -rwxrwxr-x mcvady/mcvady 18867 2015-05-13 15:59 lib/libiniparser.so.0
    -rw-rw-r-- mcvady/mcvady  2221 2015-05-13 15:59 makefile
    -rwxrwxr-x mcvady/mcvady  1035 2015-05-13 15:59 package.sh
    -rw-rw-r-- mcvady/mcvady   236 2015-05-13 15:59 README
    drwxrwxr-x mcvady/mcvady     0 2015-05-13 15:59 src/
    -rwxrwxr-x mcvady/mcvady  3718 2015-05-13 15:59 src/chunker-init
    -rw-rw-r-- mcvady/mcvady 22744 2015-05-13 15:59 src/chunker.c
    -rw-rw-r-- mcvady/mcvady  1066 2015-05-13 15:59 src/chunker.conf
    -rw-rw-r-- mcvady/mcvady  2409 2015-05-13 15:59 src/chunker.h
    -rwxrwxr-x mcvady/mcvady  2628 2015-05-13 15:59 src/chunker2s3.sh
    -rw-rw-r-- mcvady/mcvady    98 2015-05-13 15:59 src/chunker_health-cron
    -rwxrwxr-x mcvady/mcvady   969 2015-05-13 15:59 src/chunker_health.sh
    -rw-rw-r-- mcvady/mcvady 12154 2015-05-13 15:59 src/connection.c
    -rw-rw-r-- mcvady/mcvady  1325 2015-05-13 15:59 src/connection.h
    -rw-rw-r-- mcvady/mcvady  5014 2015-05-13 15:59 src/stats.c
    -rw-rw-r-- mcvady/mcvady   382 2015-05-13 15:59 src/stats.h
    drwxrwxr-x mcvady/mcvady     0 2015-05-13 15:59 test/
    -rw-rw-r-- mcvady/mcvady  2978 2015-05-13 15:59 test/test-cleanMarkerKeepLast.c
    -rw-rw-r-- mcvady/mcvady  3159 2015-05-13 15:59 test/test-handshake.c
    -rw-rw-r-- mcvady/mcvady  1923 2015-05-13 15:59 test/test-overflow.c
    -rw-rw-r-- mcvady/mcvady   464 2015-05-13 15:59 TODO
    + STATUS=0
    + ''['' 0 -ne 0 '']''
    + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + exit 0
    Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.MTVkPK
    + umask 022
    + cd /home/mcvady/working/rpm/BUILD
    + cd chunker-0.9.1
    + make chunker
    gcc -std=gnu99 -O2 -Wall -c ./src/connection.c -o ./src/connection.o
    gcc -std=gnu99 -O2 -Wall -c ./src/stats.c -o ./src/stats.o
    gcc -std=gnu99 -O2 -Wall ./src/chunker.c ./src/connection.o ./src/stats.o -o chunker -I./lib -L./lib -liniparser
    + exit 0
    Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.BluP5U
    + umask 022
    + cd /home/mcvady/working/rpm/BUILD
    + ''['' /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64 ''!='' / '']''
    + rm -rf /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64
    ++ dirname /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64
    + mkdir -p /home/mcvady/working/rpm/BUILDROOT
    + mkdir /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64
    + cd chunker-0.9.1
    + rm -rf /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64
    + make PFX=/home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64 install
    gcc -std=gnu99 -O2 -Wall -c ./src/connection.c -o ./src/connection.o
    gcc -std=gnu99 -O2 -Wall -c ./src/stats.c -o ./src/stats.o
    gcc -std=gnu99 -O2 -Wall ./src/chunker.c ./src/connection.o ./src/stats.o -o chunker -I./lib -L./lib -liniparser
    install -m 775 chunker /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64/opt/tsdb/bin
    install -m 755 ./src/chunker-init /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64/etc/init.d/chunker
    install -m 644 ./src/chunker.conf /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64/etc
    install -m 755 ./src/chunker2s3.sh /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64/opt/tsdb/scripts
    install -m 755 ./src/chunker_health.sh /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64/opt/tsdb/scripts
    install -m 644 ./src/chunker_health-cron /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64/opt/tsdb/scripts
    + /usr/lib/rpm/find-debuginfo.sh --strict-build-id -m --run-dwz --dwz-low-mem-die-limit 10000000 --dwz-max-die-limit 110000000 /home/mcvady/working/rpm/BUILD/chunker-0.9.1
    extracting debug info from /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64/opt/tsdb/bin/chunker
    dwz: Too few files for multifile optimization
    /usr/lib/rpm/sepdebugcrcfix: Updated 0 CRC32s, 1 CRC32s did match.
    + /usr/lib/rpm/check-buildroot
    + /usr/lib/rpm/redhat/brp-compress
    + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
    + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
    + /usr/lib/rpm/redhat/brp-python-hardlink
    + /usr/lib/rpm/redhat/brp-java-repack-jars
    Processing files: chunker-0.9.1-1.el7.centos.x86_64
    Provides: chunker = 0.9.1-1.el7.centos chunker(x86-64) = 0.9.1-1.el7.centos config(chunker) = 0.9.1-1.el7.centos
    Requires(interp): /bin/sh /bin/sh /bin/sh /bin/sh
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Requires(pre): /bin/sh
    Requires(post): /bin/sh
    Requires(preun): /bin/sh
    Requires(postun): /bin/sh
    Requires: /bin/bash /bin/sh libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.2)(64bit) libc.so.6(GLIBC_2.9)(64bit) rtld(GNU_HASH)
    Processing files: chunker-debuginfo-0.9.1-1.el7.centos.x86_64
    Provides: chunker-debuginfo = 0.9.1-1.el7.centos chunker-debuginfo(x86-64) = 0.9.1-1.el7.centos
    Requires(rpmlib): rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
    Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64
    Wrote: /home/mcvady/working/rpm/SRPMS/chunker-0.9.1-1.el7.centos.src.rpm
    Wrote: /home/mcvady/working/rpm/RPMS/x86_64/chunker-0.9.1-1.el7.centos.x86_64.rpm
    Wrote: /home/mcvady/working/rpm/RPMS/x86_64/chunker-debuginfo-0.9.1-1.el7.centos.x86_64.rpm
    Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.vSpeIF
    + umask 022
    + cd /home/mcvady/working/rpm/BUILD
    + cd chunker-0.9.1
    + rm -rf /home/mcvady/working/rpm/BUILDROOT/chunker-0.9.1-1.el7.centos.x86_64
    + exit 0
    ~/working/chunker
    [mcvady@centos7 chunker]$ ls -Ahl chunker-0.9.1-1.el7.centos.x86_64.rpm 
    -rw-rw-r--. 1 mcvady mcvady 21K May 13 16:00 chunker-0.9.1-1.el7.centos.x86_64.rpm

やった！',
    '2015-05-09 00:00:00',
    '2015-05-09 00:00:00'
)
,
(
    'b2fa3458-5457-4ade-8ce4-bd973bce7da5',
    'SQLite Cheat Sheet',
    'Some notes on using SQLite

Opening a database

        mcvady@b:/tmp$ sqlite3 sqlite.db

Show tables

    sqlite> .tables
    seq  name             file                                                      
    ---  ---------------  ----------------------------------------------------------
    0    main             /tmp/sqlite.db                                            
    sqlite> .tables
    acc                  globalblacklist      purplemap          
    active_watchers      grp                  re_grp             
    address              htable               rls_presentity     
    aliases              imc_members          rls_watchers       
    carrier_name         imc_rooms            sca_subscriptions  
    carrierfailureroute  lcr_gw               silo               
    carrierroute         lcr_rule             sip_trace          
    cpl                  lcr_rule_target      speed_dial

Describe a table

    sqlite> .schema TABLENAME

Create a table

    sqlite> CREATE TABLE connection(connection_id BIGINT, username STRING);

Insert into a table

    sqlite> INSERT INTO connection (connection_id, username) VALUES (1, ''mcvady'');

Dump output into a file

    sqlite> .output SCHEMA_DUMP
    sqlite> .schema

Run SQL commands from file into a DB

    $ sqlite3 sqlite3.db < schema.sql',
    '2015-10-14 00:00:00',
    '2015-10-14 00:00:00'
)
,
(
    '28110e5f-fba9-47a2-9d0d-4658bb31e5ba',
    'Hello Markdown + MermaidJS!',
    '```mermaid
sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John: Hello John, how are you?
    loop Healthcheck
        John->>John: Fight against hypochondria
    end
    Note right of John: Rational thoughts<br/>prevail...
    John-->>Alice: Great!
    John->>Bob: How about you?
    Bob-->>John: Jolly good!
```',
    '2023-04-12 18:20:35.031413',
    '2023-04-12 18:20:35.031413'
)

;
