Skip to content

Instantly share code, notes, and snippets.

View hiroakis's full-sized avatar

Hiroaki Sano hiroakis

View GitHub Profile
@hiroakis
hiroakis / functools_partial_example.py
Created July 13, 2013 18:21
functools.partial example
import functools
def calc(x, y, mode):
if mode == '+':
return x + y
elif mode == '-':
return x - y
elif mode == '*':
return x * y
elif mode == '/':
@hiroakis
hiroakis / 01_riak.spec
Last active December 15, 2015 14:09
Custom Riak RPMs spec file.
%define _version 1.3.0
%define _revision 1.3.0
%define _release 1
Name: riak
Version: %{_version}
Release: %{_release}%{?dist}
License: Apache License
Group: Development/Libraries
Source: %{name}-%{_revision}.tar.gz
@hiroakis
hiroakis / installation_pyenv
Last active December 15, 2015 04:49
My Python developing environment.
# Install pyenv in ~/.pyenv
cd ~
git clone git://github.com/yyuu/pyenv.git .pyenv
echo 'export PYENV_ROOT="${HOME}/.pyenv"' >> ~/.zshrc
echo 'if [ -d "${PYENV_ROOT}" ]; then' >> ~/.zshrc
echo ' export PATH=${PYENV_ROOT}/bin:$PATH' >> ~/.zshrc
echo ' eval "$(pyenv init -)"' >> ~/.zshrc
echo 'fi' >> ~/.zshrc
@hiroakis
hiroakis / example_rabbitmq_api.py
Last active August 21, 2023 13:33
Calling the RabbitMQ api from Python sample
#!/usr/local/bin/python
import requests
import json
def call_rabbitmq_api(host, port, user, passwd):
url = 'http://%s:%s/api/queues' % (host, port)
r = requests.get(url, auth=(user,passwd))
return r
@hiroakis
hiroakis / installation_perlbrew
Created December 28, 2012 06:12
My perl environment for CentOS
mkdir /perl
export PERLBREW_ROOT=/perl
curl -L --insecure http://xrl.us/perlbrewinstall | bash
echo 'export PERLBREW_ROOT=/perl' >> ~/.zshrc
echo '[ -f /perl/etc/bashrc ] && source /perl/etc/bashrc' >> ~/.zshrc
source ~/.zshrc
perlbrew available
perlbrew install perl-5.16.2
perlbrew switch perl-5.16.2
perlbrew install-cpanm