Skip to content

Instantly share code, notes, and snippets.

View yuokada's full-sized avatar

Yukihiro Okada (Yuki) yuokada

  • Tokyo, Japan
  • 14:57 (UTC +09:00)
View GitHub Profile
@yuokada
yuokada / Hoge.py
Last active February 8, 2020 18:21
script collections for python and perl
#!/usr/bin/env python2.7
import multiprocessing
import os.path
import gzip
import re
ABYSS_DELIMITOR =""
class Hoge(object):
@yuokada
yuokada / algorithm.py
Created November 5, 2011 18:17
consistent-hashing in python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import binascii
import md5
def search(nodelist, key):
max_len = len(nodelist)
keys = sorted( nodelist.keys() )
for i , nodekey in enumerate(keys):
@yuokada
yuokada / Makefile
Created December 4, 2011 16:49
python-Hello.c
.PHONY all:
gcc -m64 -fPIC -Wall -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c hello.c
gcc -m64 -shared -o hello.so -lpython hello.o
@yuokada
yuokada / README.md
Created February 27, 2012 01:44
Cassandra Memo

Cassandraとは

オープンソースの分散データベース管理システムである。 元はFacebook社において大規模データの格納のために開発されたものである。 Facebookのデータチームを率いるJeff HammerbacherはCassandraをDynamoのようなインフラストラクチャ上で動作するBigTableデータモデルであると表現している。

Cassandraはイベンチュアル・コンシステンシーにより構造化されたキー・バリュー型データストアを提供する。 キーは複数の値にマッピングされ、これらはcolumn familyとしてグルーピングされる。 column familyはCassandraデータベースが作成される際は固定されているが、後にfamilyに対し列を追加することは可能である。

@yuokada
yuokada / ZZ_result.out
Created April 8, 2012 15:37
msgpackrpc and etc
% python2.7 -mcProfile -s time client.py
360
12
(5, (1, 11, 120))
66628 function calls (65989 primitive calls) in 0.391 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.017 0.017 0.018 0.018 __init__.py:43(<module>)
@yuokada
yuokada / 2012-09-15.md
Created September 21, 2012 01:56
pyconjp 2012

Pycon jp 2012

python type and object

  • hychen
  • meta class is little bit of magic

type creates a class creates a non-type object

  • int , float, string , unicode などの非オブジェクトの話
@yuokada
yuokada / sample_1.py
Created September 23, 2012 15:59
CodeIQ:42 Pythonでタグチェックに挑戦
#!/usr/bin/env python2.7
# -*- coding:utf-8 -*-
'''
File: sample_1.py
Author: Me
Description: https://codeiq.jp/rule.php?challenge_id=42
'''
import re
@yuokada
yuokada / file0.txt
Last active April 4, 2020 05:36
SQLAlchemyでINNER JOINする方法 ref: https://qiita.com/uokada/items/d81fd930402e3be4aa62
mysql> show tables;
+---------------------+
| Tables_in_menagerie |
+---------------------+
| event |
| pet |
+---------------------+
2 rows in set (0.01 sec)
mysql> select * FROM event;
package main
import (
"bufio"
"flag"
"fmt"
"io"
"log"
"os"
"os/signal"
@yuokada
yuokada / Go.md
Created August 24, 2013 06:55 — forked from mogeta/Go.md

Go弱向け資料。

この資料はGo弱の会向けに作成中の資料です。 Go強の方がいらっしゃいましたら補足とかもらえると助かります。