Skip to content

Instantly share code, notes, and snippets.

View iorionda's full-sized avatar

Iori ONDA iorionda

  • Freelance
  • Tokyo/Japan
View GitHub Profile
#!/usr/local/bin/python
# vim:fileencoding=utf-8↲
class _const:
class ConstError(TypeError):
pass
def __setattr__(self, name, value):
#!/usr/local/bin/python
# vim:fileencoding=utf-8
def build_filter_query(fieldname, value, operator=' OR '):
"""
return the concatenation operator in the list of fieldname and values.
>>> build_filter_query('itemName', ['BOOK', 'DVD', 'CD'])
'itemName:BOOK OR itemName:DVD OR itemName:CD'
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
@iorionda
iorionda / private.xml
Created September 3, 2012 02:40
KeyRemap4MacBook を利用して Terminal で ESC を押下した時にIMEをオフにする
<?xml version="1.0"?>
<root>
<item>
<name>Escape to EISUU+Escape only terminal</name>
<identifier>remap.jis_escape2eisuuAndEscape_terminal</identifier>
<only>TERMINAL</only>
<autogen>--KeyOverlaidModifier-- KeyCode::ESCAPE, KeyCode::JIS_EISUU, KeyCode::ESCAPE</autogen>
</item>
</root>
#!/usr/local/bin/python
# vim:fileencoding=utf-8
import sys
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import sessionmaker, mapper
import datetime
import csv
log_file= datetime.datetime.today().strftime('query_log.%Y%m%d')
@iorionda
iorionda / tox.ini
Created September 7, 2012 18:40
tox.ini
[tox]
envlist = py26, py27, py31, py32
[testenv:py26]
basepython = /opt/local/bin/python2.6
[testenv:py27]
basepython = /opt/local/bin/python2.7
[testenv:py31]
@iorionda
iorionda / csv.py
Created September 21, 2012 10:45
CSVをいじるやつ
#!/usr/lcoal/bin/python
# -*- coding: utf-8 -*-
import sys
from sqlalchemy import create_engine, MetaData, Table
from sqlalchemy.orm import sessionmaker, mapper
import csv
filename = 'TSystemConfig.csv'
dburi = 'mysql://account:password@hostname/db_name'
@iorionda
iorionda / gist:4070539
Created November 14, 2012 05:48
ctags で -R オプションが効かない

エラー内容

% ctags -R .
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...

Homebrew を使って install

@iorionda
iorionda / httpresponse.rb.patch
Created November 30, 2012 09:43
webrick 使いつづけたかったら。
--- /Users/ONDA/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/webrick/httpresponse.rb 2012-11-29 15:16:18.000000000 +0900
+++ /Users/ONDA/httpresponse.rb.orig 2012-11-29 15:15:35.000000000 +0900
@@ -202,7 +202,7 @@
if @header['connection'] == "close"
@keep_alive = false
elsif keep_alive?
- if chunked? || @header['content-length'] || @status == 304 || @status == 204
+ if chunked? || @header['content-length']
@header['connection'] = "Keep-Alive"
else
source :rubygems
group :development, :test do
gem 'rails'
gem 'zeus'
gem 'meta_request', '0.2.1'
gem 'rspec'
gem 'rspec-rails'
gem 'cucumber'
gem 'cucumber-rails'