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 / mvn android lib
Created June 30, 2013 13:57
Create android project with Maven.
mvn archetype:generate \
-DarchetypeArtifactId=android-library-quickstart \
-DarchetypeGroupId=de.akquinet.android.archetypes \
-DarchetypeVersion=1.0.10 \
-Dandroid-plugin-version=3.6.0 \
-DgroupId=com.foo.bar \
-DartifactId=my-android-project \
-Dpackage=com.foo.bar.android
name=$1
sudo sed -i -e "s/kernel.hostname.*/kernel.hostname=${name}/g" /etc/sysctl.conf
echo ${name} | sudo tee /etc/hostname
sudo hostname ${name}
sudo sed -i -e "s/127.0.1.1.*/127.0.1.1 ${name}/g" /etc/network/interfaces
@echo off
set java_exe="%JAVA_HOME%\bin\java.exe"
set javaw_exe="%JAVA_HOME%\bin\javaw.exe"
@yuuichi-fujioka
yuuichi-fujioka / venv.sh
Created July 22, 2013 01:55
activate python virtualenv
virtualenv --no-site-packages ./venv
./venv/bin/python hoge.py
@yuuichi-fujioka
yuuichi-fujioka / simple_subproces.py
Created July 25, 2013 05:17
The snippet of python subprocess
import subprocess
p = subprocess.Popen(
['ls', '-l'],
cwd='/tmp',
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
p.wait()
import inspect
def get_org_func(f):
if hasattr(f.__closure__, 'count') :
for v in f.__closure__:
if inspect.isfunction(v.cell_contents):
return get_org_func(v.cell_contents)
else:
return f
# define decorator
def my_deco(*arg, **kwargs):
def _(func):
func.__dict__.setdefault('foo', (arg, kwargs))
return func
return _
# make decorated function
@my_deco(alice='brother')
def echo(msg):
@yuuichi-fujioka
yuuichi-fujioka / deploy git-server.sh
Created November 7, 2013 01:42
This shell will deploy git-server with ssh
#!/bin/bash
# install git
apt-get install git
# create user for operate git
GIT_HOME=/srv/gitrepos
GIT_SHELL=`which git-shell`
mkdir -p ${GIT_HOME}
adduser --home ${GIT_HOME} --shell ${GIT_SHELL} git
@yuuichi-fujioka
yuuichi-fujioka / find submodules.py
Created January 31, 2014 01:11
Find and load submodules.
import pkgutil
def load_submodules(mod):
for (importer, name, ispkg) in pkgutil.iter_modules(path=mod.__path__,
prefix=mod.__name__ + '.'):
if not ispkg:
yield importer.find_module(name).load_module(name)