Skip to content

Instantly share code, notes, and snippets.

View shimizukawa's full-sized avatar

Takayuki SHIMIZUKAWA shimizukawa

View GitHub Profile
@vsajip
vsajip / pyvenvex.py
Last active May 18, 2024 23:13
A script which demonstrates how to extend Python 3.3's EnvBuilder, by installing setuptools and pip in created venvs. This functionality is not provided as an integral part of Python 3.3 because, while setuptools and pip are very popular, they are third-party packages.The script needs Python 3.3 or later; invoke it using"python pyvenvex.py -h"fo…
#
# Copyright (C) 2013-2020 Vinay Sajip. New BSD License.
#
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve

PIL(Pillow) build on Windows (32bit & 64bit)

If you want to build PIL on Windows, you need to prepare few external libraries. Although some libraries did not provide static library for windows 32/64 bits then you need to build these libraries by your hand too. Also, PIL will load by python at last then you are recommended to use same compiler with python to build libraries.

Target PIL and versions

Pillow

1.7.8 for Python 2.7: src

@shimizukawa
shimizukawa / PIL_build.rst
Last active December 11, 2015 17:28
PIL (Pillow) build procedure

PIL(Pillow) build on Windows (32bit)

If you want to build PIL on Windows, you need to prepare few external libraries. Although some libraries did not provide static library for windows 32/64 bits then you need to build these libraries by your hand too. Also, PIL will load by python at last then you are recommended to use same compiler with python to build libraries.

Target PIL and versions

PIL

1.1.7 for Python 2.4 (or Pillow-1.7.8)

sys.path.insert(0, 'lib/')
extensions += ['sphinxcontrib_phpautodoc']
@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)
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>
@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",
@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
# 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
@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__)