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
primes_s xs = (head xs) : primes_s (filter (not_dividable (head xs)) xs) | |
primes = primes_s [2..] |
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 timeit as _timeit | |
from math import sqrt as _sqrt | |
def timer_test(s_processing, s_pretreatment, repeat=100): | |
""" | |
print minimam, max, average, and unbiased of spend times. | |
""" | |
t = _timeit.Timer(s_processing, s_pretreatment) | |
times = t.repeat(repeat) | |
l = len(times) |
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 timeit | |
def get_average(array): | |
return sum(array) / len(array) | |
t = timeit.Timer('cond=True; cond == True') | |
print(get_average(t.repeat(100))) | |
# -> 0.04552456719000474 | |
t = timeit.Timer('cond=True; cond is True') |
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
#!/usr/bin/env python3 | |
def fizzbuzz(): | |
""" generator of fizzbuzz """ | |
i = 1 | |
while True: | |
s = '' | |
if i % 3 == 0: | |
s += 'Fizz ' |
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 random import randint | |
from inspect import isfunction | |
def get_random(): | |
return randint(0, 10**10) | |
class Cacher: | |
pass | |
DEFAULT_CACHER = Cacher() |
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
yuki@ blockdiag block.diag --debug | |
WARNING: Failed to load blockdiag.imagedraw.pdf: ImportError("No module named 'reportlab'",) | |
WARNING: Fail to convert formula: a\sin\theta (reason: dvipng command not found) |
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
blockdiag { | |
plugin math; | |
A[label="", background="math://\RR"]; | |
} |
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 pylab as p | |
p.ion() | |
x = p.arange(0, 2*p.pi, 0.01) | |
a = 10 | |
curve = lambda t: (t, p.sin(x+t/10.0)) | |
line, = p.plot(x, p.sin(x)) |
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 | |
from math import sqrt | |
from json import load as _json_load | |
import numpy as np | |
from scipy import stats # for regression line | |
import pylab | |
def get_datetime(s_date): | |
year, month ,day = s_date.split('/') |
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
""" Plugins {{{ | |
"" NeoBundle {{{ | |
set nocompatible " Be iMproved | |
filetype off " Required! | |
if has('vim_starting') | |
set runtimepath+=~/.vim/bundle/neobundle.vim/ | |
endif | |
call neobundle#rc(expand('~/.vim/bundle/')) |
OlderNewer