Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
$LOAD_PATH << 'lib'
$LOAD_PATH << '../lib'
require 'optparse'
require 'uri'
require 'rubygems'
require 'daemons'
@ha1t
ha1t / all.rb
Created November 2, 2010 11:26
weechat plugin:all.rb
#
# weechat plugin
#
def weechat_init
Weechat.register(
'all',
'halt',
'0.3',
'GPL3',
@ha1t
ha1t / thread.rb
Created October 21, 2011 09:21
ruby thread example
puts "Test start"
puts "Create thread"
message = ARGV[0] ||= '0'
begin
t = Thread.new do
puts "Start thread"
begin
raise "chatched"
@ha1t
ha1t / merge_kpi_csv.php
Created November 21, 2011 09:10
DeNAのKPIレポートのcsvをマージするスクリプト
<?php
/**
*
*
*/
date_default_timezone_set('Asia/Tokyo');
$csv = array();
foreach (glob('report_kpi_*') as $filename) {
$lines = file($filename);
@ha1t
ha1t / gist:1476177
Created December 14, 2011 11:15
2000年前後のWebサイトの8割に実装されていたであろうJavaScript
/* _/_/_/時間によってメッセージを変更_/_/_/*/
function putTime()
{
d=new Date();
h=d.getHours();
if(h<5){document.write("真夜中ですな。テレホ入ってますか?");}
else if(h<11){document.write("おっはよーございます。おげんきですか?");}
else if(h<15){document.write("お昼。ご飯食べた?");}
else if(h<16){document.write("3時。おやつちょうだいです。");}
else if(h<19){document.write("もう暗くなってきたね。");}
@ha1t
ha1t / ts_check.php
Created December 20, 2011 16:05
TSの先頭80秒のstreamパターン変化を読み取り、変化があった時間を返す
<?php
/**
* streamの変化を調べる
* @url http://zion009.blog98.fc2.com/blog-entry-36.html
*/
$src = $argv[1];
$temp_file = '/tmp/tmp.mp4';
$temp_text = '/tmp/tmp.text';
@ha1t
ha1t / anime_rename.php
Created January 21, 2012 09:03
しょぼいカレンダーを使ってアニメタイトルをファイル名にする
#!/usr/bin/env php
<?php
/**
* しょぼいカレンダーを使ってアニメタイトルをファイル名にする
* @url https://sites.google.com/site/syobocal/spec/rss2-php
*/
//$word = '戦姫絶唱シンフォギア_20120113_225900.ts';
$user_id = 'anime_rename';
@ha1t
ha1t / disablecursor.vim
Created January 31, 2012 01:44
カーソルキーを封じるvimのmap
""
" map disable cursor key
"
set ttimeout
set timeout
set ttimeoutlen=0
set timeoutlen=0
map <ESC>OA <ESC>
map <ESC>OB <ESC>
map <ESC>OC <ESC>
@ha1t
ha1t / make_testuser.php
Created February 16, 2012 00:53
facebookでtestuser作ったり一覧だすクラス
<?php
/**
*
* @url http://blog.maripo.org/2011/05/facebook-%E3%82%A2%E3%83%97%E3%83%AA%E3%81%A4%E3%81%8F%E3%82%8D%E3%81%86%E3%81%9C-%E3%81%9D%E3%81%AE8-%E3%83%86%E3%82%B9%E3%83%88%E3%83%A6%E3%83%BC%E3%82%B6%E3%82%92%E4%BD%9C%E3%82%89%E3%81%AA/
* @url http://developers.facebook.com/docs/test_users/
*/
$APP_ID = '';
$APP_SECRET = '';
$SITE_URL = '';
@ha1t
ha1t / wassr-todo.vim
Created March 14, 2012 09:27
wassr todoをvimの上で操作できるスクリプト
""
" wassr-todo.vim
"
scriptencoding utf-8
"let g:wassr_user = "your id"
"let g:wassr_pass = "your pass"
function! WassrTODOList()
let json = s:GetJson("http://" . g:wassr_user . ":" . g:wassr_pass . "@api.wassr.jp/todo/list.json")