Dec 24, 2016

Fedora 25 (Gnome)

* Many think work out of box:

 - Japanese / Vietnamese input
 - Terminal notify when jobs done.

* Easy to create usb boot

5 stars!

Dec 23, 2016

Roof painting

Normally all rust have to be taken and the surface should be clean
But I'm lazy so I used a paint that directly suitable to paint over rust. サビの上からそのまま塗れる塗料

アサヒペン 油性高耐久アクリルトタン用塗料
Although it's oil based, the smell is weak and pleasant to work with.











1/4th of the work. to be continued.

Nov 26, 2016

資産

がんばってローンを支払い終えたら、その家は資産でしょうか?資産とは、お金を生み出す場所。お金を生み出すことなく、税金がかかり、補修費用が必要になるのであれば、それは負債です
http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1438270044

This is biggest myth about normal real estate in Japan, using 35 years "flat" loan.
At the end of loan, it will not become an asset, but a burden.

Nov 24, 2016

Blog about life in Japan

https://catforehead.com

Specialized about real easte

Daily
http://www.survivingnjapan.com/

http://foreignsalaryman.blogspot.jp/

Nov 18, 2016

Pipe



Source http://www.rakuten.ne.jp/gold/suidou/html/sunpou_neji.htm

PJ1/2 : mainly faucet
G1/2: pipe, can connect to PJ1/2
W26山20: faucet output, many water related devices use this interface. Cannot connect to PJ1/2 an G1/2. Need a converter

ホース: free-size pipe

おねじ: male part
めねじ: female part

Aug 22, 2016

Multiple SSL on same IP

There is a known web server limits, make it hard to host many SSL on same server with only 1 IP address. (see http://nginx.org/en/docs/http/configuring_https_servers.html )

An SSL certificate with several names seems to be the simplest solution. Here is outline of 1 way to do it:
* Automate using https://github.com/srvrco/getssl to get certificates
* Let's encrypt with 1 main domain, other domains consider as alternative names

Steps
1. Initialize configurations: getssl -c MAIN.DOMAIN

2. Change CA to production, ACCOUNT_EMAIL in ~/.getssl/getssl.cfg

3. Enter SANS, ACL,RELOAD_CMD in ~/.getssl/MAIN.DOMAIN/getssl.cfg

ACL is path (public accessible via URL) to verify your domains.
it must have same number of lines as number of your domains.

RELOAD_CMD can be 
sudo nginx -s reload
Let's current user is deploy. visudo to allow: 
deploy ALL=NOPASSWD:/usr/sbin/nginx

4. Get certificates: getssl MAIN.DOMAIN
5. Configure nginx to use certificates in ~/.getssl/MAIN.DOMAIN
6. Automate renew using cron 

23  5 * * * /home/deploy/scripts/getssl -u -a -q

Jul 31, 2016

住宅

マイホーム投資は勝つのがとても難しくなっています。まさに、「マイホーム購入は人生最大のギャンブル」と言っていいでしょう
http://toyokeizai.net/articles/-/33609?page=3

35年ローンだと35年後に老朽化で改築でまたローンですか? そうすると、一生資産でなく負債という現実

http://oshiete.goo.ne.jp/qa/5092417.html

自己資金比率が10%未満の場合におけるデフォルト率は、20%以上30%未満の場合に比べて2倍近くに達している。自己資金比率が高まるほどデフォルト率が下がることはいうまでもないだろう。


こんな理由で家を買ってはいけない!
その4「家賃がもったいないから」
http://diamond.jp/articles/-/35405?page=2


日本の問題はこの20年間でほとんど全ての所得階層で年間100万円くらい所得が減少している「1億総貧乏化」の方がより深刻な問題となっており、これが消費を抑圧するデフレの原因にもなっている

http://matome.naver.jp/odai/2139527800338666101

Jun 22, 2016

Caddy

I've just migrated all personal websites to Caddy, a new web server. It works great, out of box as promised ( https://caddyserver.com )

May 17, 2016

Console progress bar

It's very simple:

import sys
def update_progress(iteration, total):
    percent = int(iteration * 100.0 / total)
    sys.stdout.write(
        "\r[ {0:<51} ] {1}% ~{2}".format(
            '#' * (percent / 2), percent, iteration
        )
   )

The main trick is character "\r", which clear previous line.

May 5, 2016

Linux installation

2 years using OSX gave me more insight on how Unix system work more than before. This time for new home's desktop, I decided to use a Linux.

I chosen Debian testing with XFCE

Why testing? It has latest piece of software. Seems to unstable but it works. There is a good alternative are Mint, elementaryOS, good-looking but buggy, and security faults are largely ignored www.techrepublic.com/article/why-the-linux-mint-hack-is-an-indicator-of-a-larger-problem/

XFCE gives many customization chance and very, very fast! Resources usage is also optimized.



Default fonts is unpleasant, especially for Japanese text. To have above result, there is a fix for it by setting fallback chain in /etc/fonts/local.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>Tahoma</family>
<family>TakaoPGothic</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Tahoma</family>
<family>TakaoPGothic</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Monaco</family>
<family>TakaoPGothic</family>
</prefer>
</alias>
<match target="font">
<edit mode="assign" name="hinting">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="autohint">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintslight</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="rgba">
<const>rgb</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="antialias">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="lcdfilter">
<const>lcddefault</const>
</edit>
</match>
</fontconfig>
Here I used Tahoma from Windows and Monaco from OSX, but Open Sans and Ubuntu Mono are good alternatives. Takao font is an IPA font derivatives, installed by apt-get install fonts-takao*

Font Osaka causing ugly rendering on many latin characters, better to remove it
sudo rm /usr/share/fonts/truetype/Osaka* -f

It's easy to set system wide shortcuts. There are 2 places:
* Window manager: pre-defined functions
* Keyboard setting: a function is a command





About input methods, there is "uim", better than D-bus and Scim etc I have used.

For Japanese I use Mozc. It's important to set "Default input mode" to Hiragana to make it work as expected.

For Vietnamese I use m17nlib. Add "m17n-vi-telex" to Enabled input methods. It just works.

apt-get install  uim-mozc uim-m17nlib uim-gtk2.0 uim-gtk3




Hope that using it daily can boost Linux skill :D

Additional programs:

apt-get install abiword gnumeric gnome-dictionary gnote systemd-ui keepass2 gufw caffeine ocrfeeder 

Terminal with copy on selection
http://www.linuxnov.com/the-complete-guide-to-configure-terminator-terminal-emulator-layouts/
* Valentina Studio - all in one MySQL, Postgres, MS SQL Server GUI
* komodo-edit - Generic editor
* pycharm - Python IDE
* meld - Diff / merge
* systemd-ui
* Pinta - Image editor
* Synapse - launcher
* keepassx
* gufw - Firewall GUI
* plank - a dock
* caffeine
* ocrfeeder - OCR
* gnome-dictionary
* Abiword
* Gnumeric
* gnote

Apr 2, 2016

RiotJS reading

http://www.ersinakinci.com/riot-js-gotchas/
http://happy-css.com/lessons/riotjs/
http://riotgear.js.org/
http://ricostacruz.com/cheatsheets/riot.html

Jan 5, 2016

PEP8 Fix on save

komodo.assertMacroVersion(3);
if (komodo.view.scintilla) {
    komodo.view.scintilla.focus();
} // bug 67103
var koDoc = (komodo.koDoc === undefined ? komodo.document : komodo.koDoc);
var formatter = null;
var onlyWholeFile = false;

switch (koDoc.language) {
    case 'Python':
    case 'Python3':
        formatter = 'autopep8 --aggressive -';
        break;
}

// Save cursor Position
try {
    if (formatter) {
        // Group operations in a single undo
        // Select Buffer, pipe it into formatter.
        var wholeFile = onlyWholeFile || komodo.editor.selText == '';
        var currentPos = komodo.editor.currentPos;
        komodo.editor.beginUndoAction();
        if (wholeFile) {
            komodo.doCommand('cmd_selectAll');
        }
        ko.run.runEncodedCommand(window, formatter + " {'insertOutput': True, 'operateOnSelection': True}");
        komodo.editor.gotoPos(currentPos);
    }
} catch (e) {
    alert(e);
}
finally {
    komodo.editor.endUndoAction();
}