Skip to content

Instantly share code, notes, and snippets.

View ymotongpoo's full-sized avatar
📈
observability matters

Yoshi Yamaguchi ymotongpoo

📈
observability matters
View GitHub Profile
@ymotongpoo
ymotongpoo / gist:1271888
Created October 8, 2011 04:56
recursive download files under www.hoge.com/path/to/dir
wget --recursive --no-parent --domains hoge.com --convert-links --page-requisites www.hoge.com/path/to/dir
@ymotongpoo
ymotongpoo / gist:1342656
Last active November 22, 2022 01:26
extract AAC audio from flv, and convert aac to mp3 using ffmpeg
# using libfaac on Mac OS X 10.6.8
# -vn : not copying video
# -acodec : specify codec used in flv file
# -ac : channels. 1 is for mono, 2 is for stereo
# -ab : specify bitrate for output file (note that rate is not kbps but bps)
# -ar : sampling frequency (Hz)
# -threads: number of threads for encoding
# "-strict experimental" is necessary to use libfaac
ffmpeg -y -i xxxxxxxxxxx.flv -vn -acodec aac -ac 2 -ab 128000 -ar 44100 -threads 4 -strict experimental xxxxx.m4a
@ymotongpoo
ymotongpoo / gist:1372699
Created November 17, 2011 08:36
build sphinx project using virtualenv
#! /bin/bash
source ~/.virtualenvs/sphinx/bin/activate
cd ~/docs/
make html
@ymotongpoo
ymotongpoo / gist:1376300
Created November 18, 2011 12:13
Erlang configure option
% ./configure --prefix=/opt/erlang/R15B01 \
> --disable-hipe \
> --disable-native-libs \
> --enable-smp-support \
> --enable-threads \
> --enable-kernel-poll \
> --enable-darwin-64bit \
> --without-javac
@ymotongpoo
ymotongpoo / gist:1381882
Created November 21, 2011 06:57
convert PuTTy public key.
# convert PuTTY's public ssh key file into OpenSSH public key
ssh-keygen -i -f id_rsa_putty.pub > id_rsa.pub
find . -iname '*.txt' | xargs python -c 'import sys; print sys.argv[1:]'
find . -iname '*.txt' | python -c 'import sys; print [f.strip() for f in sys.stdin]'
@ymotongpoo
ymotongpoo / aiff2alac.sh
Created January 10, 2012 16:54
convert AIFF to ALAC, ALAC to AAC
#!/bin/bash
IFS="
"
cd "${1}"
echo "source dir: "${PWD}
echo "target dir: "${2}
for input in `find . -name "*.aiff" -type f`
@ymotongpoo
ymotongpoo / requests-oauth2.py
Created February 25, 2012 07:53
Google API OAuth 2.0 Authorization Sample in Python
# -*- coding: utf-8 -*-
"""
This scripts reqire a third party module 'requests'.
You can get it from PyPI, i.e. you can install it using
easy_install or pip.
http://docs.python-requests.org/en/v0.10.4/
Original source code is written by shin1ogawa, which is in Java.
@ymotongpoo
ymotongpoo / weathercli.py
Created March 27, 2012 15:12
ZeroMQ PUB/SUB sample implementation
import zmq
import sys
context = zmq.Context()
subscriber = context.socket(zmq.SUB)
subscriber.connect("tcp://localhost:5556")
# receive only message with zipcode being 10001
zipfilter = sys.argv if len(sys.argv) > 1 else "10001 "
subscriber.setsockopt(zmq.SUBSCRIBE, zipfilter)
@ymotongpoo
ymotongpoo / calcpull.py
Created March 28, 2012 01:10
ZeroMQ PUSH/PULL sample implementation (no collector)
import zmq
import sys
import time
cxt = zmq.Context()
receiver = cxt.socket(zmq.PULL)
receiver.connect("tcp://127.0.0.1:5555")
sum = 0
while True: