Skip to content

Instantly share code, notes, and snippets.

Avatar

Yoshinari Takaoka mumumu

View GitHub Profile
View zrange_benchmark.py
#!/usr/bin/env python
import redis
from optparse import OptionParser
from benchmarker import Benchmarker
parser = OptionParser()
parser.add_option("-n", "--num", dest="num", action="store",
help="iterate number", type="int", default=10000)
View gist:8949703
PING digitalocean.mumumu.org (128.199.255.63) 56(84) bytes of data.
64 bytes from digitalocean.mumumu.org (128.199.255.63): icmp_req=1 ttl=51 time=104 ms
64 bytes from digitalocean.mumumu.org (128.199.255.63): icmp_req=2 ttl=50 time=86.4 ms
64 bytes from digitalocean.mumumu.org (128.199.255.63): icmp_req=3 ttl=51 time=92.6 ms
64 bytes from digitalocean.mumumu.org (128.199.255.63): icmp_req=4 ttl=51 time=81.4 ms
64 bytes from digitalocean.mumumu.org (128.199.255.63): icmp_req=5 ttl=51 time=91.3 ms
64 bytes from digitalocean.mumumu.org (128.199.255.63): icmp_req=6 ttl=51 time=99.2 ms
64 bytes from digitalocean.mumumu.org (128.199.255.63): icmp_req=7 ttl=51 time=91.9 ms
64 bytes from digitalocean.mumumu.org (128.199.255.63): icmp_req=8 ttl=50 time=82.2 ms
View next_generation_server_estimate.markdown

次世代サーバ見積もり

パーツ項目 品名 価格
CPU Xeon E5-2618Lv2 (2.0G) 6core/12thread TDP50W 69,929
マザーボード GIGABYTE GA-6PXSV4 41,999
RAM 既存のモノを使う -
ケース Coolermaster Silencio 652 18,900
電源 玄人志向 SSシリーズ 350W 80PLUS GOLD KRPW-SS350W/90+ 6,234
CPUクーラー [SCYTHE] 刀4 KATANA4 SCKTN-4000 3,980
View cat_and_bzip2_by_external_cmd.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from benchmarker import Benchmarker
import os
import glob
import fnmatch
import subprocess
View cat_and_bzip2_by_pure_python.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from benchmarker import Benchmarker
import os
import bz2
import glob
import fnmatch
from shutil import copyfileobj
View cat_and_bzip2_benchmark.markdown

はじめに

ファイルと結合 + bzip2 の最速の実行手段を試すべく、以下の二つを比較してみた

  • 外部コマンド(/bin/cat, /bin/bzip2) で実行した場合
  • pure python で実行した場合

前提

タブ区切りのテキストが数十万行入ったテキストファイルを6つ持ってきて、それを結合して bzip2 する、というシナリオを使う。

View parent_constructor_invoke_test.py
class First(object):
def __init__(self, a, b):
self.x = "first init %s" % a
self.y = "first init %s" % b
print "invoked!"
class Second(First):
pass
View planex_gw450_katana_linux_3_13_driver.patch
diff -ur mt7610u_wifi_sta_v3002_dpo_20130916.orig/include/os/rt_linux.h mt7610u_wifi_sta_v3002_dpo_20130916/include/os/rt_linux.h
--- mt7610u_wifi_sta_v3002_dpo_20130916.orig/include/os/rt_linux.h 2013-09-16 23:03:08.000000000 +0900
+++ mt7610u_wifi_sta_v3002_dpo_20130916/include/os/rt_linux.h 2014-04-29 23:26:16.254488178 +0900
@@ -277,8 +277,8 @@
typedef struct _OS_FS_INFO_
{
- int fsuid;
- int fsgid;
+ kuid_t fsuid;
View get_bucket_folder_size.py
#!/usr/bin/env python
import boto
conn=boto.connect_s3('api_key','api_secret')
bucket=conn.get_bucket('bucket_name');
keys=bucket.list('path/to/folder')
size=0
for key in keys:
print "%s:%d" % (key, key.size)
size+= key.size
View multiprocess_incr_atomic_test.py
#!/usr/bin/env python
from multiprocessing import Pool
import redis
MAX_LOOP_COUNT = 100
db = redis.StrictRedis(host='localhost', port=6379, db=0)
db.delete('hoge')