Skip to content

Instantly share code, notes, and snippets.

View shimizukawa's full-sized avatar

Takayuki SHIMIZUKAWA shimizukawa

View GitHub Profile
from colander import MappingSchema, SchemaNode, String, Invalid
import string
def combined_validator(node, value):
if value.get('name') != value.get('value'):
raise Invalid(node, 'name and value must be identical. {!r}'.format(value))
class Schema1(MappingSchema):
@shimizukawa
shimizukawa / console
Last active August 29, 2015 14:01
substanced make html log
vagrant@precise64:/tmp$ virtualenv venv
New python executable in venv/bin/python2.7
Also creating executable in venv/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
vagrant@precise64:/tmp$ cd venv/
vagrant@precise64:/tmp/venv$ git clone https://github.com/Pylons/substanced/
Cloning into 'substanced'...
remote: Reusing existing pack: 17699, done.
@shimizukawa
shimizukawa / timeit_context.py
Created June 23, 2014 06:58
small implementation for time scaling context : 時間計測するcontext
import time
import contextlib
class TimeIt(object):
def __init__(self):
self._start = 0
self._end = 0
def begin(self):
self._start = time.time()
return self._start
@shimizukawa
shimizukawa / 202518103-Restricted-Accounts-and-Single-Channel-Guest-FAQ.rst
Last active August 29, 2015 14:02
【Slack FAQ 翻訳】 2014/6/23 制限アカウントとシングルチャンネルゲスト FAQ Restricted Accounts and Single-Channel Guest FAQ
@shimizukawa
shimizukawa / pep426-environment-markers.rst
Last active August 29, 2015 14:03
PEP426 environment markers の調査
@shimizukawa
shimizukawa / sphinx-translation-procedure.rst
Last active August 29, 2015 14:04
sphinx translation procedure for users (draft)

$ pip install sphinx[intl]

$ sphinx-quickstart
  • wizard: translations
  • wizard: language
* edit conf.py (optional):
  • add translations
  • set language
vagrant@precise64:/tmp/test$ make latexpdf SPHINXOPTS="-D language=it"
sphinx-build -b latex -d _build/doctrees -D language=it . _build/latex//it
Running Sphinx v1.2.3
loading translations [it]... done
loading pickled environment... not yet created
building [latex]: all documents
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
@shimizukawa
shimizukawa / rst2html.py
Created October 4, 2014 00:06
rst2html.py to work with dotfigure directive plugin
#!D:\venv\Scripts\python.exe
# $Id: rst2html.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing HTML.
"""
@shimizukawa
shimizukawa / README.rst
Last active August 29, 2015 14:08
link2rst : Sphinx linkto context function for template of HTML builder. (CC BY)
@shimizukawa
shimizukawa / conf.py
Last active August 29, 2015 14:13
Sphinx (http://sphinx-doc.org/) autodoc example
# -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.abspath('.')) # directory path that contain 'foo.py'
extensions = [
'sphinx.ext.autodoc',
]