Skip to content

Instantly share code, notes, and snippets.

/**
* @param {Function} func .
* @param {Function} .
*/
function decorator(func, begin, end) {
return function() {
var time = begin(arguments);
var result = func.apply(this, arguments);
setTimeout(function(){
end(arguments, time);
% cat Makefile
compile:
make lint
make updatedeps
make compilejs
lint:
gjslint --strict -r src/xxx
updatedeps:
@rokujyouhitoma
rokujyouhitoma / gist:4688312
Created February 1, 2013 01:11
on linkedin
Tohru,
I thought you'd be interested by this:
http://stoic.com/javascript
It has a quite interesting architecture, and it's entirely written in Javascript.
I'd love to get your take on it!
Java のコードを
pythonista に持ち込む:まぁ、Java も書けなくはないけどね
rubyist に持ち込む:ツマラン、どこかに細工してやろうか・・・
CTO川崎 に持ち込む:出てけゴルァァァァァァァァァァァ!!
Python のコードを
Java エンジニアに持ち込む:おぅ、Python のコードか
rubyist に持ち込む:スクリプト言語の僚友だ、バッチリ直してやるぜ
CTO川崎 に持ち込む:けっ、優等生か
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
while true; do date; curl "http://stocks.finance.yahoo.co.jp/stocks/detail/?code=3632.t" 2>/dev/null | grep 'class="stoksPrice"' | awk 'match($0, /[0-9,]+/) {print substr($0, RSTART, RLENGTH)}'; sleep 60; done;
@rokujyouhitoma
rokujyouhitoma / gist:d736bb68147a93363861
Created September 18, 2014 03:02
ApacheJMeterの結果データをよきように表すやつ
# -*- coding: utf-8 -*-
import pandas
import argparse
parser = argparse.ArgumentParser(description='xxx')
parser.add_argument('csv', type=argparse.FileType('r'))
args = parser.parse_args()
csv = args.csv
@rokujyouhitoma
rokujyouhitoma / gist:173b75f030a1f1f22591
Created September 19, 2014 04:40
PythonでHTTP RequestとResponseの生文字列を確認したい時のモンキーパッチ
def http_connection_send():
import httplib
def patch_send():
old_send= httplib.HTTPConnection.send
def new_send(self, data, *args, **kwargs):
print(data)
body = old_send(self, data, *args, **kwargs)
return body
httplib.HTTPConnection.send = new_send
patch_send()
@rokujyouhitoma
rokujyouhitoma / patched.py
Created March 10, 2015 07:41
locust and gevent patch for python2.7.9
#https://github.com/gevent/gevent/issues/477#issuecomment-56292848
# # Re-add sslwrap to Python 2.7.9
import inspect
__ssl__ = __import__('ssl')
try:
_ssl = __ssl__._ssl
except AttributeError:
_ssl = __ssl__._ssl2
/* Generated by Cython 0.22 */
/* BEGIN: Cython Metadata
{
"distutils": {}
}
END: Cython Metadata */
#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS