Skip to content

Instantly share code, notes, and snippets.

View yuuichi-fujioka's full-sized avatar

yuuichi fujioka yuuichi-fujioka

View GitHub Profile
@yuuichi-fujioka
yuuichi-fujioka / android ant.sh
Last active December 16, 2015 13:39
android project apply to ant
android update project -p ./
@yuuichi-fujioka
yuuichi-fujioka / function reflection example.py
Created April 24, 2013 06:32
reflection examples for function
def my_func(hoge,fuga,name='scot'):
'''comment message'''
print my_func.func_code.co_varnames # ('hoge', 'fuga', 'name')
print my_func.func_name # my_func
hoge_func = my_func
print hoge_func.func_code.co_name # my_func
keytool -genkey -v -keyalg RSA -keystore .KeyStore -alias hogehoge -validity 10000
@yuuichi-fujioka
yuuichi-fujioka / .gitbashrc
Created May 20, 2013 02:25
bash setting for looks like git bash
# Reset
Color_Off="\[\033[0m\]" # Text Reset
# Regular Colors
Black="\[\033[0;30m\]" # Black
Red="\[\033[0;31m\]" # Red
Green="\[\033[0;32m\]" # Green
Yellow="\[\033[0;33m\]" # Yellow
Blue="\[\033[0;34m\]" # Blue
Purple="\[\033[0;35m\]" # Purple
@yuuichi-fujioka
yuuichi-fujioka / submodule list recursively.py
Created May 21, 2013 00:22
find all submodule recursively
import pkgutil
import hoge
for importer, module_name, is_pkg in pkgutil.walk_packages(hoge.__path__, hoge.__name__ + "."):
print module_name
@yuuichi-fujioka
yuuichi-fujioka / import module from text.py
Created May 21, 2013 01:14
import module from string. Only available for Python >= 2.7 or 3.x
import importlib
m = importlib.import_module('foo.bar')
@yuuichi-fujioka
yuuichi-fujioka / print nice json.py
Created May 21, 2013 02:45
print out nice json
import json
m ={ 'foo':{'alice': ['first', 'second'], 'backet':'bread'}, 'bar':'hello'}
print json.dumps(m, sort_keys=True, indent=2)
""" output
{
"bar": "hello",
"foo": {
import functools
class mydeco:
def __init__(self, *args):
self.args = args
def __call__(self, func):
@functools.wraps(func)
@yuuichi-fujioka
yuuichi-fujioka / update android sdk.sh
Created May 24, 2013 05:15
silent update android sdk with cli
android update sdk --no-ui --obsolete --force
@yuuichi-fujioka
yuuichi-fujioka / iptables
Created June 7, 2013 01:59
simple port forwarding
out_nic=eth0
in_nic=eth1
in_net_cidr=192.168.0.0/24
iptables -t nat -A POSTROUTING -o ${out_nic} -j MASQUERADE
iptables -t nat -A POSTROUTING -o ${in_nic} -s ${in_net_cidr} -j MASQUERADE
dst_port=10022
dst=192.168.0.5:22