Skip to content

Instantly share code, notes, and snippets.

View buhii's full-sized avatar

Takahiro Kamatani buhii

View GitHub Profile
from collections import Counter
from random import sample
def try_boy():
result = []
child = sample(("Boy", "Girl"), 1)[0]
result.append(child)
if child == 'Girl':
result.extend(try_boy())
// Satoh's shoe rack OpenSCAD file
shoe_rack_height = 780 - 200;
support_width = 45;
support_thick = 15;
module shoe_rack_support(x, y) {
translate([x, y, 0]) {
cube([support_width, support_thick, shoe_rack_height]);
}
#!/bin/bash
# requirement: mecab
crfpp="CRF++-0.58"
crfpp_googlecode="https://crfpp.googlecode.com/files/"
cabocha="cabocha-0.68"
cabocha_googlecode="https://cabocha.googlecode.com/files/"
#!/bin/bash
mecab="mecab-0.996"
mecab_python="mecab-python-0.996"
mecab_googlecode="https://mecab.googlecode.com/files/"
if ! type curl > /dev/null; then
downloader='wget '
else
downloader='curl -O '
@buhii
buhii / cube_wireframe.py
Created August 14, 2011 01:14
cube graphics in nodeBox
"""
classes for vertex, rectangle
"""
class Vertex(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __add__(self, other):
@buhii
buhii / cube_hsr1.py
Created August 14, 2011 01:27
cube graphics in nodebox with hidden surface removal
"""
classes for vertex, rectangle
"""
class Vertex(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def __add__(self, other):
@buhii
buhii / wave.py
Created September 26, 2011 10:05
Waveform example with NodeBox
GRID = (40, 40)
BUS_STRIPE = 10
class Wave(object):
@classmethod
def clk(cls, num):
ret = []
for i in range(num):
ret.append((i + 1) % 2)
return ret
@buhii
buhii / drw_analyzer.py
Created January 10, 2012 18:57
drw_analyzer.py - smaller layout
GRID = (24, 16)
BUS_STRIPE = 3
class Wave(object):
@classmethod
def clk(cls, num):
ret = []
for i in range(num):
ret.append((i + 1) % 2)
return ret
@buhii
buhii / conv.py
Created January 11, 2012 04:29
verilog file's correct tool
import re
import sys
re_v = re.compile('(\s+)(reg|wire)(\s+)(\w+)\s*(\[\d+:0\]);')
for line in sys.stdin:
line = line[:-1] # to remove new line
result = re_v.search(line)
if result:
g = result.groups()
@buhii
buhii / dft1.py
Created January 19, 2012 00:53
simple dft example with NodeBox
from cmath import exp, sin, cos, pi
N = 512
PADDING = 16
global old_x, old_y
old_x, old_y = 0, N
def circle(x, y, r):
hr = r / 2
oval(x - hr, y - hr, r, r)