Skip to content

Instantly share code, notes, and snippets.

@nobuhito
nobuhito / index.js
Created February 10, 2014 08:54
ローカルファイルをApacheのDirectoryIndexっぽく見せるNode.js
// based on http://shimz.me/blog/node-js/2690
var scriptName = 'index.js';
var separator = '___DATA___';
var http = require('http'),
url = require('url'),
path = require('path'),
fs = require('fs'),
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
process.on('uncaughtException', function (err) {
log.error('uncaughtException : ' + err);
});
@nobuhito
nobuhito / vm_perf.pl
Created July 1, 2014 07:50
ESXi側から仮想マシンのパフォーマンスを一斉取得
#!perl
use strict;
use warnings;
use FindBIn;
use lib "$FindBin::Bin/../../";
use JSON::PP;
use Time::Local;
@nobuhito
nobuhito / graphite.rb.diff
Created October 9, 2014 01:48
mutators/graphite.rbの修正
root@sensu:~# diff -u /tmp/graphite.rb /etc/sensu/mutators/graphite.rb
--- /tmp/graphite.rb 2014-10-09 10:45:00.774510474 +0900
+++ /etc/sensu/mutators/graphite.rb 2014-10-07 13:21:55.672353581 +0900
@@ -31,8 +31,10 @@
# parse event
event = JSON.parse(STDIN.read, :symbolize_names => true)
-if ARGV[0] == "-r" || ARGV[0] == "--reverse"
- puts event[:check][:output].gsub(event[:client][:name], event[:client][:name].split('.').reverse.join("."))
-else
@nobuhito
nobuhito / client.rb.diff
Created December 8, 2014 11:44
SensuにCron的なスケジューリングを組み込んでみる ref: http://qiita.com/nobuhito@github/items/12959c28e1899f515617
> diff -u sensu-0.14.0/lib/sensu/client.rb.org sensu-0.14.0/lib/sensu/client.rb
--- sensu-0.14.0/lib/sensu\clien.rb.org 2014-10-16 20:40:50 +0900
+++ sensu-0.14.0/lib/sensu\clien.rb 2014-12-08 19:34:36 +0900
@@ -1,5 +1,6 @@
require 'sensu/daemon'
require 'sensu/socket'
+require 'rufus/scheduler'
module Sensu
class Client
@nobuhito
nobuhito / OAuth2Invoker.gas.diff
Created December 15, 2014 00:21
GoogleDriveで社外共有しているユーザーとファイルをGASで取得 ref: http://qiita.com/nobuhito@github/items/7e47387a22d089ad5bfa
--- OAuth2Invoker.gs.org 2014-12-12 15:45:41 +0900
+++ OAuth2Invoker.gs 2014-12-12 15:46:04 +0900
@@ -1,7 +1,7 @@
/**
* Used for invoked Google App Engine services from Google Apps Script.
*/
-function OAuth2Invoker(email, pemBase64, scope){
+function OAuth2Invoker(email, pemBase64, scope, target){
this.post = function(url, payload){
var params = {
@nobuhito
nobuhito / README.md
Last active August 29, 2015 14:22
D3とbl.ocks.orgのテスト

D3 & bl.ocks.org

@nobuhito
nobuhito / README.md
Last active August 29, 2015 14:22
R2D3.js

R2D3

D3.jsの勉強がてらにSTARWARS風な六甲おろしをSVGで作成してみました。

サンプル → bl.ocks.org
解説 → Qiita

@nobuhito
nobuhito / echoHttpRequest.js
Last active August 29, 2015 14:23 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
hook.debug(hook.params);
hook.debug(hook.req.path);
hook.debug(hook.req.method);
@nobuhito
nobuhito / MockSwitch.go
Last active August 29, 2015 14:25
JavascriptとStylesheet(ついでにMarkdown)だけでモックを作れるWebサーバー
package main
import (
"github.com/zenazn/goji"
"github.com/zenazn/goji/web"
"github.com/google/go-github/github"
"net/http"
"fmt"
"regexp"
"io/ioutil"