This file contains 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 h5py | |
import os | |
myfile = 'myfile.hdf5' | |
print "remove %s" % myfile | |
if os.path.exists(myfile): | |
os.remove(myfile) | |
print "write to %s" % myfile |
This file contains 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 h5py | |
ispace = ' ' * 2 | |
def see_dataset(dset, indent=0): | |
sp = ispace * (indent+1) | |
vstr = str(dset.value) | |
print "\n".join([sp + vi for vi in vstr.split('\n')]) | |
def see_group(group, indent=0): | |
sp = ispace * indent |
This file contains 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
class FinStMch: | |
gendct = {} | |
state = None | |
def scheduler(self, start): | |
self.state = start | |
while 1: | |
yield self.gendct[self.state].next() | |
def set_gen(self, **kwds): |
This file contains 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
class Super: | |
secret = {} | |
class Say1(Super): | |
def __init__(self): | |
self.secret[0] = 'this is my secret' | |
print "Say1:", self.secret | |
class Say2(Super): | |
def __init__(self): |
This file contains 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
""" | |
- rst2latex : rst2latex | |
- latex2platex : convert using sed | |
- platex2pdf : compile .tex -> .dvi -> .pdf | |
""" | |
from distutils.cmd import Command | |
from distutils.errors import * | |
import os |
This file contains 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
s/\\usepackage\[.*\]{inputenc}/%& %% for platex/ | |
s/\\usepackage{babel}/%& %% for platex/ | |
# s/\(\\usepackage\[\)\(.*\]{hyperref}\)/\1dvipdfmx,\2/ | |
s/\\usepackage\[.*\]{hyperref}/& \\AtBeginDvi{\\special{pdf:tounicode SHIFT_JIS}}/ | |
# s/\\usepackage\[.*\]{hyperref}/& \\AtBeginDvi{\\special{pdf:tounicode EUC-UCS2}}/ |
This file contains 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
[rst2latex] | |
rst2latex-command = c:/Python24/Scripts/rst2latex.py | |
rst2latex-options = --template=D:\freeware\docutils\docutils\writers\latex2e\default.tex -i utf-8 -o shift_jis | |
[latex2platex] | |
sed-command=d:/freeware/winsed12/WINSED.EXE -o $ofile -f $script $ifile | |
# sed-command=sed -f $script $ifile > $ofile |
This file contains 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 python | |
import os | |
import sys | |
HOWM_PATH = os.path.join(os.getenv('HOME'), "howm") | |
HOWM_PUB = os.path.join(os.getenv('HOME'), "misc/pub_memo/howm") | |
RST2HTML_PATH = '/usr/bin/rst2html.py' | |
def get_dir_and_file_list(path): | |
dlst = [] |
This file contains 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
def isint(i): | |
try: | |
if int(i) == i: | |
return True | |
except: | |
pass | |
return False |