This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pgmagick import Image | |
from pgmagick import CompositeOperator as co | |
img_a = Image('a.jpg') | |
img_b = Image('b.jpg') | |
img_c = Image('c.jpg') | |
print img_a.compare(img_b) | |
print img_a.compare(img_c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pgmagick | |
import time | |
# fast read | |
b = time.time() | |
img = pgmagick.Image(pgmagick.Blob(open('org.jpg').read()), pgmagick.Geometry(180, 120)) | |
img.scale('180x120') | |
img.write('t.jpg') | |
print time.time() - b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from base64 import encodestring | |
with open(sys.argv[1]) as f: # argv[1] is 'xx.png' | |
print encodestring(f.read()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from groongaql import Context, ENC_DEFAULT, SUCCESS | |
"""groongaql test scrip | |
1. groonga -s | |
2. python script.py | |
""" | |
def main(): | |
ctx = Context(flags=0, encoding=ENC_DEFAULT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include "groonga.h" | |
static void execute_gql(grn_ctx *ctx, char *gql, int len) | |
{ | |
unsigned int result_size; | |
char *result = NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import time | |
MAX_INTERVAL = 1.0 | |
class Poller: | |
def __init__(self, files): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ easy_install -ZU pulsar | |
Searching for pulsar | |
Reading http://pypi.python.org/simple/pulsar/ | |
Reading https://github.com/quantmind/pulsar | |
Best match: pulsar 0.4.6 | |
Downloading http://pypi.python.org/packages/source/p/pulsar/pulsar-0.4.6.tar.gz#md5=9425e2110a6d2b0a6216121d52b12fc2 | |
Processing pulsar-0.4.6.tar.gz | |
Running pulsar-0.4.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-4qNzrr/pulsar-0.4.6/egg-dist-tmp-oozueS | |
warning: no files found matching '*.py' under directory 'lib' | |
warning: no files found matching '*.h' under directory 'lib' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import folium | |
# osaka | |
osaka_location = [34.702, 135.4951] | |
mapobj = folium.Map(location=osaka_location, | |
zoom_start=15) | |
mapobj.simple_marker(osaka_location, popup='Osaka Station') | |
mapobj.circle_marker(osaka_location, popup='An on foot 5-minute within the circle', | |
radius=500, fill_color='#33cccc') | |
mapobj.create_map(path='osm.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ~/.vim/ftplugin/go/fixmake.vim | |
set makeprg=go\ build\ % | |
au BufWritePost *.go make |