Skip to content

Instantly share code, notes, and snippets.

View aodag's full-sized avatar

Atsushi Odagiri aodag

View GitHub Profile
@aodag
aodag / HelloApp.cs
Created March 2, 2014 06:12
OwinContextなしで、KatanaのStartupを利用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Threading.Tasks;
using System.IO;
using System.Text;
namespace OwinSample
{
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 8 columns, instead of 7. in line 3.
1,none,none,none,taro,tokyo,man,22
2,none,none,none,hanako,kyoto,woman,56
3,none,none,none,satoru,kagoshima,man,18
4,miyoko,none,none,none,fukuoka,45
@aodag
aodag / travis.yml
Created April 7, 2014 13:02
pythonでtoxを使うための設定。coverall通知もする。
language: python
python: 3.3
env:
matrix:
- TOXENV=py26
- TOXENV=py27
- TOXENV=pypy
- TOXENV=py33
- TOXENV=py34
- TOXENV=coverage
@aodag
aodag / drone.io
Created April 12, 2014 09:09
drone.ioでwheel使った実行例
pip freeze
python get-pip.py -f wheelhouse --use-wheel
pip install -U setuptools -f wheelhouse --use-wheel
pip install -r requirements.txt -f wheelhouse --use-wheel
pip install -e .
psql -c 'create database sns_test;' -U postgres
alembic -n drone upgrade head
flake8 sns
py.test sns
py.test tests
@aodag
aodag / test_sample.py
Created April 22, 2014 15:52
テストケースをもっと明示的にできないかと考えた書き方。こんなデコレータはまだ存在しない。
from testfixtures import compare
from inspirated import testcase_config, test_config
@testcase_config(target='your.product.Foo')
class TestFoo(object):
@test_config(params=[({'var': 1}, 4)])
def test_it(self, target, var, expected):
foo = target()
@aodag
aodag / bib.py
Last active August 29, 2015 14:00
多分なにかある
#!/usr/bin/env python3.3
import sys
import os
import re
import argparse
import distlib.wheel
import subprocess
import distlib.metadata
import distlib.locators
from pyramid.config import Configurator
from pyramid.view import view_config
import waitress
@view_config(renderer='index.html')
def index(request):
return dict(message='Hello, jinja!')
def main():
@aodag
aodag / instoru-paison
Created May 3, 2014 13:57
veriy simple python installer
#!/bin/sh
# -*- mode:sh -*-
version=$1
if [ "x$1" = "x" ] ; then
exit 1
fi
major=$(echo $version | awk -F "." '{print $1}')
minor=$(echo $version | awk -F "." '{print $2}')
micro=$(echo $version | awk -F "." '{print $3}')

>>> import argparse >>> >>> def split_type(s): ... if ":" in s: ... return tuple(s.split(":", 1)) ... else: ... return s, 'zlib' ... >>> parser = argparse.ArgumentParser() >>> parser.add_argument('--send', type=split_type)

@aodag
aodag / main.py
Created May 6, 2014 10:34
restful-json wsgi app
import functools
from sqlalchemy import (
Column,
Integer,
ForeignKey,
Unicode,
)
from sqlalchemy.orm import (
scoped_session,
sessionmaker,