Skip to content

Instantly share code, notes, and snippets.

View kawaz's full-sized avatar
🏠
Working from home

Yoshiaki Kawazu kawaz

🏠
Working from home
View GitHub Profile
@kawaz
kawaz / GoogleSBM_kawaz.user.js
Created March 4, 2011 16:08
Google+SBM( http://userscripts.org/scripts/show/23906 )がニュースに対応してなかったのでXPathを修正したバージョン。
// ==UserScript==
// @name Google+SBM
// @namespace http://wildlifesanctuary.blog38.fc2.com/
// @description Show SBM count in Google search result
// @include http://*.google.*/*q=*
// ==/UserScript==
// this script based on
// http://d.hatena.ne.jp/kusigahama/20051207#p1
// http://la.ma.la/blog/diary_200607281316.htm
$ vmc target api.cloudfoundry.com
Succesfully targeted to [http://api.cloudfoundry.com]
@kawaz
kawaz / gist:1210888
Created September 12, 2011 09:09
#gdd11jpのAppsScript問題のコード
var ss = SpreadsheetApp.getActiveSpreadsheet();
function resolveQuiz() {
var qs = ss.getActiveSheet();
var q = qs.getRange(1, 1).getValue();
try {
var json = JSON.parse(q);
} catch($e) {
Browser.msgBox("A1セルに問題のJSONを入力しておいて下さい");
return;
@kawaz
kawaz / gist:1598614
Created January 12, 2012 03:54
nvm用にnave ls-remote相当の機能を付けたいメモ
curl -s http://nodejs.org/dist/ |
egrep -o 'v[0-9]+\.[0-9]+\.[0-9]+' |
sort -u -k 1,1n -k 2,2n -k 3,3n -t . |
awk '{printf "%-9s",$1} NR%8==0{print ""} END{print ""}'
@kawaz
kawaz / isolates-example.js
Created January 17, 2012 06:23
Node v0.7.0出たのでIsolatesのテスト
var child_process = require('child_process');
var cpuCount = require('os').cpus().length;
if(process.features.isolates) {
if(process.tid == 1) {
//main thread
console.log("Isolates is supported! (" + process.version + ")");
for(var i = 0; i < 5; i++) { //ここでは試験用に固定値だが、CPU使いきりたいならcpuCount使うと良いか
var child = child_process.fork(__filename, null, {thread: true});
child.send("Hello thread");
@kawaz
kawaz / 不幸な○○学ランキング.txt
Created May 26, 2012 06:11
不幸な○○学ランキング
http://togetter.com/li/309732
文系:理系:その他=87:11:2
5 社会学
5 経済学
4 心理学
3 法学
3 日本文学
3 教育学
2 歴史学
@kawaz
kawaz / hide_akb_link.user.js
Created May 30, 2012 01:48
特定キーワードをテキストに含むリンクを隠す
@kawaz
kawaz / .gitmodules
Created May 30, 2012 02:21
.gitmodulesにいつも書いてるメモ
# submoduleの削除手順
# 1: .gitmodules から削除したいサブモジュール設定を削除
# 2: .git/config から削除したいサブモジュール設定を削除
# 3: git rm --cached -r path/to/submodule を実行
@kawaz
kawaz / superagent-proxy-patch.diff
Created June 12, 2012 03:42
superagentをプロキシ対応するパッチ
*** node_modules/tower/node_modules/superagent/lib/node/index.js.orig 2012-06-12 11:59:44.000000000 +0900
--- node_modules/tower/node_modules/superagent/lib/node/index.js 2012-06-12 12:38:44.000000000 +0900
***************
*** 458,463 ****
--- 458,472 ----
// initiate request
var mod = exports.protocols[url.protocol];
+ // use proxy
+ if(process.env.http_proxy) {
@kawaz
kawaz / server.js
Created June 28, 2012 04:42
SNI利用サンプル
var https = require('https')
, fs = require('fs')
, defaultCredentials =
{ key: fs.readFileSync('example.com/server.key')
, cert: fs.readFileSync('example.com/server.crt')
, ca: fs.readFileSync('example.com/server.cacert.crt')
}
, jpCredentials =
{ key: fs.readFileSync('example.jp/server.key')
, cert: fs.readFileSync('example.jp/server.crt')