Skip to content

Instantly share code, notes, and snippets.

View max747's full-sized avatar

max747 max747

  • Xross Soft, LLC.
  • Osaka, Japan
View GitHub Profile
@max747
max747 / Dockerfile
Created March 1, 2018 03:48
build python 3.6 on Docker-centos7
FROM centos:7
ARG PYTHON_VERSION=3.6.4
ARG BUILD_DIR=/usr/local/src
RUN yum -y update && \
yum -y install vim wget xz make gcc zlib-devel bzip2 bzip2-devel \
xz-devel readline-devel sqlite sqlite-devel openssl-devel tk-devel \
libffi-devel ncurses-devel gdbm-devel
WORKDIR ${BUILD_DIR}
@max747
max747 / presentation.md
Last active January 21, 2018 04:21
発表資料

「Python言語」二歩目を踏み出そう!」発表資料

自己紹介

  • 児島 孝典
  • (株) 144Lab
  • ソフトウェア開発のお仕事
  • Go, Python
  • Twitter: max747
@max747
max747 / execution.txt
Created April 16, 2016 03:09
URL escape test
max747@Kojima-no-MacBook-Pro|~/devel/go/src/github.com/max747/httptest
) go test -v
=== RUN Test1
2016/04/16 12:07:17.358588 [Kojima-no-MacBook-Pro.local/qhEp2eAttw-000001] Started GET "/%E3%81%82%E3%81%84%E3%81%86" from 127.0.0.1:55148
2016/04/16 12:07:17.358674 [Kojima-no-MacBook-Pro.local/qhEp2eAttw-000001] Returning 200 in 61.58µs
--- PASS: Test1 (0.00s)
main_test.go:36: map[foo:あいう]
Path: /あいう
RawPath:
EscapedPath: /%E3%81%82%E3%81%84%E3%81%86
@max747
max747 / struct_bench_test.go
Last active December 11, 2015 16:54
Go 構造体のパフォーマンス
package main
import (
"testing"
)
type Foo struct {
a int
b int
}
@max747
max747 / client.py
Last active December 17, 2015 12:09
pyzmq のクライアント側を multiprocessing でぶん回す実験
import zmq
import functools
import random
import sys
from multiprocessing import Pool
class Client(object):
def __init__(self, client_id, addr):
self.ctx = zmq.Context()

Fabric, fabtools

fabtools.rpm.upgrade(kernel=False)
sudo yum -y --color=never --exclude=kernel* upgrade と同等

fabtools.user

@max747
max747 / gist:4174362
Created November 30, 2012 07:43
scala memo
// 日付フォーマット
"%04d/%02d/%02d".format(2012, 11, 1)
"%04d/%02d/%02d" format (2012, 11, 1)
@max747
max747 / flask-memorandum.md
Created November 21, 2012 02:06
Flask備忘録

URLの取得

flask.request のプロパティとして取得できる。

from flask import request
print request.url_root
path
@max747
max747 / mapper.py
Last active October 12, 2015 17:58
SQLAlchemy Examples
# coding: utf-8
import os
from sqlalchemy import create_engine, Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, relationship
basedir = os.path.dirname(os.path.abspath(__file__))
url = "sqlite:///{}".format(os.path.join(basedir, "db.sqlite"))
engine = create_engine(url, echo=True, encoding="utf-8")
@max747
max747 / pyzhist
Created November 7, 2012 05:39
zsh history file decoder
#!/usr/bin/env python
# coding: utf8
def decodehist(_in, out):
change = False
for _c in _in.read():
c = ord(_c)
if c != 0x83:
d = c^32 if change else c
out.write(chr(d))