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 | |
# coding: utf-8 | |
"""Mimic legacy blast's blastall to execute BLAST+ commands | |
""" | |
import argparse, os, sys | |
def main(): | |
sys.stderr.write('>>>>> %s\n' %(' '.join(sys.argv))) | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-p', dest='program', required=True) |
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 open_zfiles(filename): | |
open_method = open # builtin open | |
if filename.endswith('gz'): | |
open_method = gzip.open # gzip's open | |
elif filename.endswith('Z'): | |
from subprocess import Popen, PIPE | |
open_method = lambda fn: Popen(['zcat', fn], stdout=PIPE).stdout | |
with open_method(filename, 'rb') as infile: | |
return infile |
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
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Column | |
from sqlalchemy import Integer, DateTime, String, Text | |
from sqlalchemy import UniqueConstraint, Sequence | |
from sqlalchemy import create_engine | |
Base = declarative_base() | |
class SomeTable(Base): | |
__tablename__ = 'some_nice_table' |
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
# coding: utf-8 | |
from __future__ import print_function | |
from os import walk | |
from os.path import join, splitext | |
from PIL import Image, ImageChops | |
def compare_images(dir1, dir2): | |
for dirname, subdirnames, filenames in walk(dir1): | |
for filename in filenames: |
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
""" | |
>>> from argparse import ArgumentParser | |
>>> from multiprocessing import Process, Queue | |
>>> def build_parser(): | |
... parser = ArgumentParser() | |
... parser.add_argument('-e', '--engage', action='store_true') | |
... parser.add_argument('-b', '--beam-me-up', action='store_true') | |
... parser.add_argument('-d', '--good-day-to-die', action='store_true') | |
... # blah blah blah | |
... return parser |
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
# coding: utf-8 | |
from gettext import NullTranslations | |
import argparse, sys | |
argparse.str = lambda s: s.encode(sys.stdout.encoding) if isinstance(s, unicode) else s | |
CATALOGUE = dict([ | |
('usage: ', | |
u'使い方: '), |
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
coding: utf-8 | |
def answer(relations): | |
"""ハイフンで区切られた語のリストから連関グラフを抽出する | |
""" | |
# 語のペアの集合を生成する | |
pairs = [set(r.split('-')) for r in relations] | |
# pairs に要素が残っている間はループ | |
while pairs: | |
# 起点となるペアを取り出す | |
pivot = pairs.pop() |
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
# coding: utf-8 | |
import os | |
import sys | |
import urllib | |
import tarfile | |
import time | |
from xml.etree import ElementTree as ET | |
from StringIO import StringIO | |
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
/* | |
pthtest --- hello pthread. | |
gcc -pthread -o pthtest pthtest.c | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
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 win32com.client, time, binascii | |
Agent = win32com.client.Dispatch("Agent.Control.2") | |
Agent.Connected = 1 | |
Agent.Characters.Load("Merlin", "C:\WINDOWS\MSAGENT\CHARS\MERLIN.ACS") | |
Merlin = Agent.Characters("Merlin") | |
Merlin.Show() | |
bdat = [ \ |