Miura Fold

This is mostly for my own reminder.

  1. Google “miura fold”
  2. Read some articles, watch some videos
  3. Remember this:
    1. Long/initial fold must be odd-numbered.
    2. Short/following fold must have approximately same degree.
    3. Open up, fold following the short, zigzagged lines.
    4. ???
    5. Profit?

Not sure if useful.

PHP 7!

Panzer vor! (☞゚∀゚)☞

Panzer vor! (☞゚∀゚)☞

# (build machine since the server itself doesn't have enough memory to build PHP)
root@openbsd:/var# /opt/php7/bin/php --version
PHP 7.0.0 (cli) (built: Dec  4 2015 21:50:31) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
root@openbsd:/var# uname -a
OpenBSD openbsd.myconan.net 5.8 GENERIC#1170 amd64

Oh look, this blog is now running on PHP 7 (under OpenBSD). Apart of OpenBSD-specific mysql socket path, everything seems to be working fine out of box. It seems to be slightly faster as well? Or maybe not, I guess WordPress is just so slow and no amount of speed ups can fix it.

Hopefully OpenBSD 5.9 will have it by default. Still no ports in sight though.

Configure parameters:

./configure --prefix=/opt/php7 --enable-fpm --with-openssl --with-pcre-regex --with-zlib --enable-bcmath --enable-calendar --with-curl --enable-exif --enable-ftp --with-gd --with-gettext --with-gmp --with-mhash --enable-intl --enable-mbstring --with-mysqli --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-mysqlnd --with-webp-dir=/usr/local --with-jpeg-dir=/usr/local --with-freetype-dir=/usr/X11R6 --with-png-dir=/usr/local

Rails and Bootstrap

This hit me when I was rewriting front-end part of Zeropaste. Of course later I found out that there’s gem for it.

But anyway, if you don’t want to add another gem and feel like writing crapload of divs, it’s not that difficult. It breaks Rails standard form error handling though.

First, change the default error field handling to do nothing instead of wrapping it in a div:

config.action_view.field_error_proc = proc { |html| html }

(put in application.rb)

And then create this helper:

def error_class(object, attribute)
  "has-error" if object.errors.include? attribute

Finally, here’s how to use it (for attribute key of a model):

<div class="form-group <%= error_class f.object, :key %>">
  <%= f.label :key %>
  <%= f.text_field :key, :class => "form-control" %>

…and done.

Compiling xpdf (pdfimages) for Windows

…on a FreeBSD system. I recently needed a modified version of it for a good reason. Only tried for its pdfimages. Probably works for other components as well.

  1. Install these packages:
    • mingw32-bin-msvcrt
    • mingw32-binutils
    • mingw32-gcc
  2. Download, extract, go to xpdf source.
  3. ./configure --host=mingw32 --target=i686-mingw32msvc --build=i686-linux
  4. make pdfimages
  5. ???
  6. Profit!

Whoops, almost forgot one last step. Produced binary from steps above will require additional libraries to start. To make it run with just the binary, rerun the last compile command (from output of make) with additional arguments: -static-libgcc and -static-libstdc++.

[ Reference for configure script arguments | Reference for static build ]

Network performance checklist: TSO/LSO

Took me good few hours to find out why specific combination of task performs incredibly slowly on my server.

For reference, in my case it’s port-forwarded ssh/https connection over openvpn.

[ Client ] --(Internet)--> [ Gateway ] --(OpenVPN)--> [ Server (SSH) ]

Doing anything which takes up bandwidth (displaying log files, etc) will shoot the cpu load (at interrupt) up by a lot. By a lot I mean over 50% of one core.

This guy have the reasoning why it’s happening but I don’t know how much of it is correct. VMware support page also suggesting disabling it if network performance is slow.

In FreeBSD it’s:

echo 'net.inet.tcp.tso=0' >> /etc/sysctl.conf

In Windows it’s this .reg file:

Windows Registry Editor Version 5.00


It seems to involve a shell script in Linux so I won’t bother writing it off here since it differs by system.

As usual, YMMV.

…and there goes my time 🙁

Amaburi OP Single

Not doing a release because it’s already released by many other groups.

2014-10-26 22.24.52

On related news, there isn’t any other outstanding opening/ending themes this season so far.

Here my current “considering” list:

  • F/sn UBW ED
  • OreTwi OP
  • OreTwi ED
  • Tsukame Pride
  • Wixoss 2 OP
  • Cross Ange OP


A few years ago I wrote a php script to provide better autoindex within nginx. I used it for quite a long period until I rewrote it in Ruby/Sinatra. But then I figured the setup for it is overly complicated just for simple task. And takes additional memory. I always have php-fpm running anyway so it’s free.

And so I decided to take up the old php script and fix it up. Unfortunately there isn’t other language as easy to setup for web as php which is why I fixed it instead of rewriting in some other languages (or keeping it ruby). The “fixed” version is still pretty much imperative-style but hey, it works.

Only tested with nginx.