Skip to content

Instantly share code, notes, and snippets.

View kgbu's full-sized avatar

Kazutaka Ogaki kgbu

View GitHub Profile
@kgbu
kgbu / twitterRealtimeAPIsample
Created June 27, 2009 05:42
twitter realtime API access sample
-module(rt).
-export([new/3]).
auth_hdr(nil, nil) -> [];
auth_hdr(U, P) when is_binary(U) ->
auth_hdr(binary_to_list(U), P);
auth_hdr(U, P) when is_binary(P) ->
auth_hdr(U, binary_to_list(P));
auth_hdr(U, P) ->
@kgbu
kgbu / gist:146079
Created July 13, 2009 12:20
true if M out of N fits given predicate
%%% true if M out of N fits given predicate.
%%%
%%% inspired by http://d.hatena.ne.jp/mzp/20090703/cond
%%%
-module(moutofn).
-export([moon/3]).
moon(List, Pred, Threshold) when is_list(List), is_function(Pred), is_integer(Threshold) ->
Len = length(List),
if
@kgbu
kgbu / dated, revisioned backup copy command
Created July 23, 2009 15:35
dated, revisioned (from 1 to 9) backup copy command
#!/bin/bash
filepathname=$1
dn=`dirname $filepathname`
bn=`basename $filepathname`
YMD=`stat -c %y $filepathname | awk '{print $1}' | awk -F- '{print ($1 % 10) $2 $3}'`
for i in $(seq 1 9)
do
if [ "$dn" = "" ]
@kgbu
kgbu / RTM api access trial in Erlang
Created August 9, 2009 05:34
RTM API test code fragment, now discarded. see my erlandom/rtmapi/rtm.erl
%%% Remember the Milk API test code
%%% see http://github.com/kgbu/erlandom/blob/0dc55509fb37a9881f3d759ddd11ee7b1cda6b07/rtmapi/rtm.erl
Sub chkpagenator()
'
' chkpagenator Macro
' 見出し1でもないのに、段落前で改ページしている要素を発見する
'
Dim p As Paragraph
Dim s As Style
For Each p In ActiveDocument.Paragraphs
@kgbu
kgbu / buzz_client_on_sinatra.rb
Created June 9, 2010 02:42
Still buggy Buzz client on Sinatra
require 'rubygems'
require 'sinatra'
require 'oauthclient'
require 'zlib'
require 'stringio'
configure do
Consumer_key = "nantara.domain"
Consumer_secret = "kantara_secret"
*** haresources2cib.py 2010-08-10 12:59:28.000000000 +0900
--- _BK-80206-1_haresources2cib.py 2010-08-10 12:58:45.000000000 +0900
***************
*** 33,40 ****
ocf_ra_setting = {
"apache" :{"params":["configfile","httpd","port","statusurl","options","testregex"],"time":["120s","60s"]},
! "IPaddr" :{"params":["ip","cidr_netmask","nic","broadcast","iflabel","lvs_support","local_stop_script","local_start_script","ARP_INTERVAL_MS","ARP_REPEAT","ARP_BACKGROUND","ARP_NETMASK"],"time":["5s","5s"]},
! "IPaddr2" :{"params":["ip","cidr_netmask","nic","broadcast","iflabel","lvs_support","mac","clusterip_hash","arp_interval","arp_count","arp_bg","arp_mac"],"time":["5s","5s"]},
"db2" :{"params":["instance","admin"],"time":["120s","60s"]},
Hardware spec: Express5800/110Ge [N8100-1447Y]
BIOS version: 1.0.0037
CPU: Xeon 3065 @ 2.33GHz
virtualization by VMware ESXi 4.1
1 virtual CPU assigned
32bit RHEL base OS
# ./Run
Intel Atom 510D base Xen3 guest CentOS
# ./Run
make all
make[1]: Entering directory `/usr/local/src/unixbench-5.1.2'
Checking distribution of files
./pgms exists
./src exists
./testdir exists
./tmp exists
Intel Atom D510 M.B.
4CPU found in /var/log/dmesg
# ./Run
make all
make[1]: Entering directory `/usr/local/src/unixbench-5.1.2'
Checking distribution of files
./pgms exists
./src exists
./testdir exists