Jan 23, 2015

Custom Komodo look and feel

Komodo's user interface can be "styled" using CSS!
Komodo is written using Mozilla framework. Internally it's HTML/CSS with Javascript/Python API.

Howto:

  • Install "DOM Inspector" add-on. Use this to find out element ID, class you want to style, similar as you inspect a website using development tool
  • Create  ~/Library/Application Support/KomodoEdit/8.5/XRE/chrome/userChrome.css
  • Write your styles ; )


Jan 21, 2015

About Cassandra

https://ria101.wordpress.com/2010/02/24/hbase-vs-cassandra-why-we-moved/

- About CAP theorem, Cassandra offers consistent level on reading/writing (selectable CAP tradeoffs)
- Level ALL
- Level QUORUM
- Level ONE
- Symmetric system: no single point of failures. Equal role for all nodes using P2P Gossip
- Simple admin and scale

Jan 18, 2015

Auto reload while development

While developing web application using Python (or Ruby), I often run web server by ourself. If a bug was introduced, web server would die. After debugged it,  I have to re-run it manually! Well, today I figure out a way to restart it automatically ^^. Basically a Bash script will loop and restart on your behalf.

To having this work for you, replace PYTHON_APP (or entire script function) to your specific needs.
Have fun!

#!/bin/bash
SLEEP_INTERVAL=2 # second
PYTHON_APP="python3 -m tasty serve:web --port=9100"
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
script () {
  cd $DIR
  PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 PYTHONDONTWRITEBYTECODE=1 PYTHONDEBUG=1 PYTHONIOENCODING=utf8 $PYTHON_APP
}
echo "Development mode."
until script; do
    echo "Crashed with exit code $?.  Respawning.." >&2
    sleep $SLEEP_INTERVAL
done

Dec 5, 2014

Misc

1. imagemagick is wonderful! Let's say we have img1.png img2.png. This command compares two images and highlight differences into diff.png:


compare -highlight-color 'rgba(255, 255, 0, 0.5)' -lowlight-color 'rgba(255, 255, 255, 0.3)' img1.png img2.png diff.png
This give number of different pixels between two:
convert img1.png img2.png -compose Difference -composite -format '%[fx:mean*100]' info:
2. terminal-notifier Get alert by using command line:
/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -message 'Hello' -title 'CI'

3. Strider

A lightweight CI server, using NodeJS, run locally.
Using terminal-notifier, we can use this to run tests and other background tasks.

4. restview

Preview while editing ReST file. Very connivence!

Install:
pip install restview
Example to customise style:
https://gist.github.com/manhg/1696afbc03282466636b

Oct 23, 2014

OS X Yosemite: How to change Japanese default font



In my opinion the default Japanese font in Yosemite is ugly!

Let's replace it with better one.

Fast way: open Terminal and run:
sudo wget http://goo.gl/8APaAA -O /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/DefaultFontFallbacks.plist

You need to enter your password.
Restart your computer and see change.

Here is more advanced changes (more customization)
Locate
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/
and make a copy of DefaultFontFallbacks.plist as a backup.
Then copy it your documents to make change using Xcode (we cannot edit it directly)

Inside that, find an entry with "ja".
For sans-serif, HiraKakuPro-W3 is good one.
For serif, HiraMinProN-W3 is nice.

Save and copy DefaultFontFallbacks.plist back to
sudo cp DefaultFontFallbacks.plist /System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreText.framework/Resources/

We done!
I made a tuned DefaultFontFallbacks.plist for download here:
http://goo.gl/8APaAA


Update:
There is an easier way to do:
https://github.com/schreiberstein/lucidagrandeyosemite