Skip to content

Instantly share code, notes, and snippets.

View yyuu's full-sized avatar
👽
Working from home

YAMASHITA, Yuu yyuu

👽
Working from home
View GitHub Profile
@yyuu
yyuu / wsb.py
Created September 26, 2012 13:41
a benchmarking script for websocket echo servers (based on AutobahnPython)
#!/usr/bin/env python
from __future__ import print_function, with_statement
import autobahn.websocket
import collections
import functools
import math
import optparse
import os
import sys
@yyuu
yyuu / install_wsperf.sh
Created September 24, 2012 12:31
build wsperf on Debian sid
sudo apt-get install libboost1.49-all-dev scons
git clone git://github.com/zaphoyd/websocketpp.git
cd websocketapp
env BOOST_INCLUDES=/usr/include BOOST_LIBS=/usr/lib scons
./build/release/wsperf/wsperf --version
#==> wsperf/0.2.0dev WebSocket++/0.2.0dev
@yyuu
yyuu / meinheld_blocking.py
Created September 20, 2012 12:04
meinheld continuation and threading sample
#!/usr/bin/env python
import Queue
import meinheld.middleware
import meinheld.server
import os
import signal
import sys
import threading
import time
@yyuu
yyuu / notes.md
Created August 30, 2012 10:29
idea notes of pyenv

idea notes of pyenv

overview

I want nicer version manager like rbenv for python.

  • do things almost like rbenv.
  • implemented as pure shell scripts (bash and zsh).
  • have all pythons in $PATH to use them from tox easily.
@yyuu
yyuu / mongodb.monitor.py
Created August 27, 2012 13:29
mon monitor plugin to test mongodb
#!/usr/bin/env python
#
# mongodb.monitor - mon monitor plugin to test mongodb.
#
from __future__ import with_statement
import logging
import optparse
import os
import pymongo
@yyuu
yyuu / packages2json.rb
Created July 18, 2012 03:00
Convert Debian's Packages.gz into JSON format.
#!/usr/bin/env ruby
require 'fileutils'
require 'json'
require 'strscan'
require 'zlib'
def parse(file)
case file
when /\.bz2$/
@yyuu
yyuu / slow_log.py
Created July 6, 2012 07:32
fetch MySQL slow-log from table
#!/usr/bin/env python
import collections
import getpass
import MySQLdb
import optparse
import os
import sys
parser = optparse.OptionParser("usage %prog [OPTIONS]", add_help_option=False)
@yyuu
yyuu / rbenv-recipes.rb
Created June 7, 2012 13:40
a capistrano recipe to install rubies using rbenv (for debian/ubuntu)
namespace(:rbenv) {
_cset(:rbenv_path) {
capture("echo $HOME/.rbenv").chomp()
}
_cset(:rbenv_bin) {
File.join(rbenv_path, 'bin', 'rbenv')
}
_cset(:rbenv_cmd) { # to use custom rbenv_path, we use `env` instead of cap's default_environment.
path = "#{rbenv_path}/bin:#{rbenv_path}/shims:$PATH"
"env PATH=#{path.dump()} #{rbenv_bin}"
@yyuu
yyuu / test-blocking-msgpackrpc.py
Created June 2, 2012 09:26
sample of blocking msgpack-rpc client impl in python
#!/usr/bin/env python
import socket
import msgpack
import time
import random
REQUEST = 0
RESPONSE = 1
NOTIFY = 2
@yyuu
yyuu / download_java.rb
Created May 23, 2012 09:36
download java archive from oracle website
#!/usr/bin/env ruby
require 'rubygems'
require 'uri'
require 'mechanize'
$u = "PUT YOUR ORACLE USERNAME HERE"
$p = "PUT YOUR ORACLE PASSWORD HERE"
original_uri = 'http://download.oracle.com/otn/java/jdk/7u3-b04/jdk-7u3-linux-x64.tar.gz'