Skip to content

Instantly share code, notes, and snippets.

View shimizukawa's full-sized avatar

Takayuki SHIMIZUKAWA shimizukawa

View GitHub Profile
@t2y
t2y / conftest.py
Created July 24, 2012 02:43
simple plugin for shelldoctest with pytest, though this script reports only its result
import pytest
import shelldoctest
# use this if you run only shelldoctest
#def pytest_addoption(parser):
# parser.addoption("--shelldoctest", action="store_true",
# help="run shell-doctest")
#
#def pytest_runtest_setup(item):
# if not isinstance(item, item.Function):
@voluntas
voluntas / gist:73efe2f36ac1513c02a8
Created August 5, 2012 16:13
レビューのススメ?

レビューのススメ?

typo 死ぬほど多いので突っ込みまってます

バージョン

0.2.3

作者

@voluntas

考え方はコロコロ変わるタイプなのですが、最近はレビューが実はとても大事でとにもかくにもレビューなのでは?と思い始めてきています。

@almost
almost / glacier.py
Created August 21, 2012 17:59
Amazon Glacier from Python. There's now a branch for this, see here: https://github.com/almost/boto/tree/glacier
# Thomas Parslow http://almostobsolete.net
# Just a work in progress and adapted to what I need right now.
# It does uploads (via a file-like object that you write to) and
# I've started on downloads. Needs the development version of Boto from Github.
#
# Example:
#
# glacierconn = GlacierConnection(AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY)
# writer = GlacierWriter(glacierconn, GLACIER_VAULT)
# writer.write(somedata)
@aodag
aodag / myenv.py
Created September 5, 2012 01:35
installing distribute after pyenv created
#!/opt/python-3.3.0rc1/bin/python3.3
import venv
import sys
import argparse
import subprocess
import os
here = os.path.dirname(__file__)
# put it into your conf.py
def setup(app):
# disable versioning for speed
from sphinx.builders.gettext import I18nBuilder
I18nBuilder.versioning_method = 'none'
def doctree_read(app, doctree):
if not isinstance(app.builder, I18nBuilder):
return
from docutils import nodes
@epc
epc / inventory.py
Last active November 1, 2022 04:48
python script to parse sphinx objects.inv file
#!/usr/bin/env python
""" Process URL for intersphinx targets and emit html or text """
def validuri(string):
return string
from sphinx.ext.intersphinx import read_inventory_v2
from posixpath import join
import pprint
import argparse
@ymotongpoo
ymotongpoo / pyspa_advent.py
Created November 30, 2012 05:58
2012 PySpa advent calendar抽選
import random
participants = ["ymotongpoo",
"shiumachi",
"mopemope",
"tk0miya",
"shimizukawa",
"kuenishi",
"ransui",
"turky",
rst2textileのend_stateの仕様について質問→自己解決
元々のコード
def visit_literal_block(self, node):
self.new_state(0)
def depart_literal_block(self, node):
self.end_state(wrap=False, first="<pre>\n", end=['</pre>'])
出力されるもの
<pre>
@podhmo
podhmo / sqlalchemy_example.py
Created December 20, 2012 14:59
sqlalchemy query example.
import sqlalchemy as sa
import sqlalchemy.orm as orm
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import scoped_session, sessionmaker
DBSession = scoped_session(sessionmaker())
class BaseMixin(object):
query = DBSession.query_property()
id = sa.Column(sa.Integer, primary_key=True)
sys.path.insert(0, 'lib/')
extensions += ['sphinxcontrib_phpautodoc']