This file contains hidden or 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 benchmarker import Benchmarker | |
items = ['foo', 'bar', 'baz', 'hoge'] | |
import copy | |
with Benchmarker(width=40, loop=100000) as bm: | |
for _ in bm('list'): | |
x = list(items) | |
for _ in bm('slice'): |
This file contains hidden or 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 benchmarker import Benchmarker | |
items = [1, 'foo', 'bar', 0, 0, 0] | |
with Benchmarker(width=40, loop=1000000) as bm: | |
for _ in bm('map'): | |
map(str, items) | |
for _ in bm('list'): | |
[str(x) for x in items] |
This file contains hidden or 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 nose.tools import assert_equal | |
a = [] | |
b = [] | |
for i in xrange(1000): | |
a.append(i) | |
b.append(i) | |
a.append('a') |
This file contains hidden or 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 nose.tools import eq_, assert_equal | |
a = [1, 2, 3] | |
b = [1, 5, 3] | |
def test_eq(): | |
eq_(a, b) | |
def test_assert_equal(): | |
assert_equal(a, b) |
This file contains hidden or 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 benchmarker import Benchmarker | |
import collections | |
with Benchmarker(width=40, loop=100000) as bm: | |
for _ in bm('empty dict'): | |
collections.Counter({}) | |
for _ in bm('none'): | |
collections.Counter() | |
""" |
This file contains hidden or 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
<?xml version="1.0"?> | |
<root> | |
<list> | |
<item> | |
<name>nekoya</name> | |
<list> | |
<item> | |
<name>ASCII Bracket mode</name> | |
<identifier>remap.nekoya_ascii_bracket_mode</identifier> |
This file contains hidden or 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 datetime import datetime | |
import pytz | |
def dump(dt): | |
print '1. strftime : %s' % dt.strftime('%Y-%m-%d %H:%M') | |
print '2. str : %s' % dt | |
print '3. as utc : %s' % dt.astimezone(pytz.utc) | |
print '4. 3 as local : %s' % dt.astimezone(pytz.utc).astimezone(ny) | |
print '' |
This file contains hidden or 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 calendar, pytz, time | |
from datetime import datetime | |
from benchmarker import Benchmarker | |
jst = pytz.timezone('Asia/Tokyo') | |
now_utc = datetime.now(pytz.utc) | |
now_jst = datetime.now(jst) | |
with Benchmarker(width=20, loop=10000) as bm: | |
for _ in bm('utc2utc'): |
This file contains hidden or 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
function! Flake8IgnoreToggle() | |
let rule = 'E501' | |
if g:flake8_ignore == rule | |
echo 'flake8 check E501' | |
let g:flake8_ignore = '' | |
else | |
echo 'flake8 ignore E501' | |
let g:flake8_ignore = rule | |
endif | |
endfunction |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
from benchmarker import Benchmarker | |
import base64 | |
import mcrypt | |
from Crypto.Cipher import Blowfish | |
key = 'thisiskey' | |
iv = '123abc45' |