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 -*- | |
import os | |
import os.path | |
import sys | |
import lxml.html | |
import xlwt |
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
sh tree_diff.sh | |
svn_dir=`diff ./tmp1 ./tmp2 | egrep "\/\.svn\/" | cut -c 2- | sed -e "s/\(.*\/\.svn\/\).*/\1/g" | uniq` | |
for i in $svn_dir; do | |
ls -ald $i | |
rm -rf $i | |
done |
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 -*- | |
""" | |
This script compare a package installed by pip and the latest version | |
in PyPI. And it is also possible to upgrade it then and there. | |
For now work on Windows and Linux. | |
And I'm not MACer.(Probably run.) | |
require: Python 2.6, 2.7 or 3.x | |
If you using Python 2.5 or below, check at gist:1153625 |
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
public static <T,U> List<U> hoge(List<T> in) { | |
class InstanceGenerator<X> { | |
X instance(X ... x) throws InstantiationException, IllegalAccessException { | |
Class<?> xArrayClass = x.getClass(); | |
Class<X> xClass = (Class<X>) xArrayClass.getComponentType(); | |
return xClass.newInstance(); | |
} | |
} | |
InstanceGenerator<U> d = new InstanceGenerator<U>(); | |
List<U> out = new ArrayList<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
reduce(lambda x, y: x+y, [i for i in range(1,1000) if i % 3 == 0 or i % 5 == 0]) |
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 -*- | |
def fibo(): | |
a, b = 1, 2 | |
while True: | |
yield a | |
a, b = b, a + b | |
ans = [] |
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
In [1]: import django.shortcuts | |
(...) | |
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. |
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
python -c "n = 1; import re ;from subprocess import Popen, PIPE;import sys; sys.stdout.write([commit.split(' ')[1] for commit in re.split('\n*', Popen(['git', 'log'], stdout=PIPE).communicate()[0]) if commit.startswith('commit ')][n])" | pbcopy |
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
# aliases for git/git svn | |
alias ga='git add' | |
alias gb='git branch' | |
alias gc='git commit' | |
alias gco='git checkout' | |
alias gd='git diff' | |
alias gl='git log' | |
alias gm='git merge' | |
alias gr='git rebase' | |
alias gs='git status' |
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/ruby | |
# This script installs to /usr/local only. To install elsewhere you can just | |
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like. | |
module Tty extend self | |
def blue; bold 34; end | |
def white; bold 39; end | |
def red; underline 31; end | |
def reset; escape 0; end | |
def bold n; escape "1;#{n}" end |
OlderNewer