Skip to content

Instantly share code, notes, and snippets.

View hhatto's full-sized avatar
⛰️
enjoy

Hideo Hattori hhatto

⛰️
enjoy
View GitHub Profile
include header path: /usr/include/GraphicsMagick/
boost lib: boost_python
library path: /usr/lib64/libGraphicsMagick++
GraphicsMagick version: 1.3.23
running install
running bdist_egg
running egg_info
creating pgmagick.egg-info
writing pgmagick.egg-info/PKG-INFO
writing top-level names to pgmagick.egg-info/top_level.txt
@hhatto
hhatto / pprofsort.py
Last active January 10, 2016 13:53
sort of /debug/pprof/goroutine?debug=1
#!/usr/bin/env python
import sys
import re
import argparse
RE_STARTLINE = re.compile("[0-9]? @ 0x")
RE_STACKINFO_LINE = re.compile("#\t0x")
GOROUTINE_NUM_COLOR = 11
COLOR_LEVELS = [196, 202, 208, 214, 248, 250, 252]
package main
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/service/cloudfront"
)
import os
from fnmatch import fnmatch
import autopep8
root = '.'
cmd_args = ['dummy', '-d']
args = autopep8.parse_args(cmd_args)
for dirname, dirs, files in os.walk(root):
print(dirname, dirs, files)
package main
import (
"flag"
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/service/s3"
@hhatto
hhatto / gen_polyline.py
Created April 30, 2015 01:37
generate image for stroke width 2.0 and 3.0 on Python (pgmagick)
import pgmagick as pg
def gen_line_png(line_width):
img = pg.Image(pg.Geometry(200, 200), "white")
img.type(pg.ImageType.TrueColorMatteType)
coords = pg.CoordinateList()
drawables = pg.DrawableList()
blankColor = pg.Color()
@hhatto
hhatto / gen_polyline.cpp
Created April 3, 2015 11:32
generate image for stroke width 2.0 and 3.0 on C++
#include <stdio.h>
#include <Magick++.h>
using namespace Magick;
void gen_line_png(float line_width)
{
Image image = Image(Geometry(200, 200), Color("white"));
char filename[50];
CoordinateList coords;
@hhatto
hhatto / reverse-reverse-proxy.go
Last active August 29, 2015 14:17
reverse-reverse-proxy, that image rotate proxy.
//
// ## reverse-reverse-proxy
// This is reverse(rotate) image proxy server.
// This is my toy Go project:-)
//
// ```
// +-----------+ request +--------------+ request +-------------+
// | client |----------->| rrp |----------->| target host |
// | (browser) |<-----------| |<-----------| |
// +-----------+ response +--------------+ response +-------------+
@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):
@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