Skip to content

Instantly share code, notes, and snippets.

View hhatto's full-sized avatar
⛰️
enjoy

Hideo Hattori hhatto

⛰️
enjoy
View GitHub Profile
@hhatto
hhatto / fixmake.vim
Last active December 22, 2015 00:49
check invalid Go source format with vim
" ~/.vim/ftplugin/go/fixmake.vim
set makeprg=go\ build\ %
au BufWritePost *.go make
@hhatto
hhatto / vim_gui2cterm.py
Created September 1, 2013 17:31
convert from guifg/guibg to ctermfg/ctermbg for Vim Script
import sys
from grapefruit import Color
from fabulous.xterm256 import rgb_to_xterm
new_vim_color = []
def html2xterm256(color):
r, g, b = Color.HtmlToRgb(html_color)
r = int(r * 255)
"
" Fruity Color Scheme
" ===================
"
" Author: Armin Ronacher <[email protected]>
" Version: 0.2
"
set background=dark
hi clear
@hhatto
hhatto / gist:7548246
Last active December 28, 2015 19:09
MacOSX10.8.5 Python2.7.6 (from brew) use compiler Cython0.19.2
$ gdb python
GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb 6 22:51:23 UTC 2013)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .... done
(gdb) r tests/hoedown_test.py
@hhatto
hhatto / gist:8223007
Created January 2, 2014 17:43
replaced to CachedTokenizer
[no cached generate_tokenize]
$ make benchmark (git)-[master]
---> benchmark of autopep8.py test/example.py
1.34user 0.03system 0:01.42elapsed 96%CPU (0avgtext+0avgdata 9548maxresident)k
7240inputs+0outputs (24major+2916minor)pagefaults 0swaps
---> benchmark of test_unit
...........................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 331 tests in 44.265s
@hhatto
hhatto / gist:ea6ce22403cf24e160d7
Created June 24, 2014 14:52
benchmark with scale image
## benchmarker: release 3.0.1 (for python)
## python platform: linux2 [GCC 4.8.2]
## python version: 2.7.6
## python executable: /usr/bin/python
## user sys total real
kaa.imlib2 0.8500 0.1300 0.9800 0.9883
PIL 8.6100 0.9400 9.5500 9.5611
PIL(fast) 1.0900 0.4500 1.5400 1.5460
pgmagick(blob-read) 0.2300 0.0200 0.2500 0.2500
@hhatto
hhatto / gist:423be867f462823ffd41
Created June 24, 2014 16:55
install libvips on Ubuntu14.04
- on Ubuntu 14.04
- apt-get install gtk-doc-tools swig gobject-introspection libgsf-1-dev ¥
libopenslide-dev libwebp-dev libcfitsio3-dev libmatio-dev libopenexr-dev ¥
libfftw3-dev libmagickcore-dev liborc-0.4-dev
- ./configure && make
@hhatto
hhatto / smartcropgo.go
Last active August 29, 2015 14:05
smartcrop.go cli
package main
import (
"fmt"
"image"
"image/jpeg"
_ "image/png"
"log"
"os"
@hhatto
hhatto / gist:a959428f8e8f59672bc2
Created February 25, 2015 04:37
python pow bench
===== =====
(slow) 0.481754[sec]
math.pow(13 * 0.3, 2)
math.pow(2 * 1, 0.5)
math.pow(0.2 * 0.2, 0.5)
(fast) 0.026431[sec]
(13 * 0.3) ** 2
(2 * 1) ** 0.5
@hhatto
hhatto / gist:604e066cbb6cbe26bc27
Created March 3, 2015 03:13
python "not (x in list)" vs "x not in list"
import slowfast
N = 5000000
setup = """\
t = 11
tt = [22, 11, 55]
"""
one = """\
if not (t in tt):