>>> t = Tree()
>>> d = {}
>>> d["hoge"] = 1
>>> d["fuga"] = 2
>>> d["piyo"] = 3
>>> d
{'fuga': 2, 'piyo': 3, 'hoge': 1}
>>> t["a"]["b"]["hoge"]=1
>>> t["a"]["b"]["fuga"]=2
View tumblr.py
# -*- coding: utf-8 -*- | |
import requests | |
from pymongo import Connection | |
con = Connection("localhost", 27017) | |
db = con["tumblr"] | |
url = "http://api.tumblr.com/v2/blog/tumblr.non117.com/posts/" | |
params = {"api_key" : ""} | |
def fetch(offset): |
View zsh.rc
# history | |
HISTFILE=~/.histfile | |
HISTSIZE=10000 | |
SAVEHIST=10000 | |
setopt hist_ignore_dups | |
setopt share_history | |
zstyle :compinstall filename '$HOME/.zshrc' | |
#alias |
View recognize.py
# -*- coding: utf-8 -*- | |
import json | |
import mimetypes | |
import os | |
import urllib | |
import Image | |
import requests | |
api_key = "" |
View researchlib.py
# -*- coding: utf-8 -*- | |
import cPickle as pickle | |
import pylab | |
#from mpl_toolkits.mplot3d.axes3d import Axes3D | |
from numpy import arange, sqrt, cos, sin, matrix, identity, pi, ones, convolve | |
from scipy import signal | |
from scipy.interpolate import UnivariateSpline | |
def squarediff(x, y): |
View api.py
# -*- coding: utf-8 -*- | |
import urllib, urllib2 | |
from oauth import OAuth | |
class Api(): | |
def __init__(self, atoken="", atokensecret="", ckey="", csecret="", hostname=""): | |
self.oauth = OAuth(ckey, csecret, atoken, atokensecret) | |
self.site = "http://api.tumblr.com/v2/blog/%s/" % (hostname) | |
View test.md
View lib.py
# -*- coding: utf-8 -*- | |
import cPickle as pickle | |
import pylab | |
from mpl_toolkits.mplot3d.axes3d import Axes3D | |
from numpy import arange, sqrt, cos, sin, matrix, identity, pi | |
from scipy import signal | |
from scipy.interpolate import UnivariateSpline | |
def squarediff(x, y): |
View lpf.py
from scipy import signal | |
def lpf(x, cutoff_freq, samp_rate): | |
norm_pass = cutoff_freq/(samp_rate/2) | |
norm_stop = 1.5*norm_pass | |
N, Wn = signal.buttord(wp=norm_pass, ws=norm_stop, gpass=2, gstop=30, analog=0) | |
b, a = signal.butter(N, Wn, btype='low', analog=0, output='ba') | |
y = signal.lfilter(b, a, x) | |
return y |
View dtw.cpp
#include<Python/Python.h> | |
#include<vector> | |
#include<map> | |
#include<queue> | |
#include<functional> | |
using namespace std; | |
struct Point{ | |
short x,y; |
View angelworm.py
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Copyright 2007 Google Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |