Skip to content

Instantly share code, notes, and snippets.

View takuya's full-sized avatar

takuya@mori takuya

  • Osaka City Univ
  • Osaka,Japan
View GitHub Profile
@takuya
takuya / gist:1452427
Created December 9, 2011 17:13
v8 javascript patch for using shebang
--- shell.cc.orig 2010-05-14 15:21:28.000000000 -0500
+++ shell.cc 2010-05-14 15:26:54.000000000 -0500
@@ -211,6 +211,13 @@
i += read;
}
fclose(file);
+
+ // allow the first line to be a shebang (by commenting it out).
+ if ((chars[0] == '#') && (chars[1] == '!')) {
+ chars[0] = '/';
@takuya
takuya / gist:1524830
Created December 27, 2011 19:09
QiitaのJSONのURL
フォロー中の一覧
http://qiita.com/following_tag_items
自分の一覧
http://qiita.com/mime
フォロー中のユーザーの一覧
http://qiita.com/following_user_items?latest_item_id=1468
全体の一覧
http://qiita.com/public
通知一覧の件数
http://qiita.com/api/notifications/count
@takuya
takuya / urldecode.rb
Created December 27, 2011 19:12
URLのデコード ref: http://qiita.com/items/1469
#!/usr/bin/env ruby
require 'uri'
str = ARGV.join if ARGV.size > 0
str = STDIN.read unless ARGV.size > 0
puts URI.encode(str)
@takuya
takuya / file0.txt
Created February 7, 2012 09:16
ディレクトリ中のファイルを一覧 ref: http://qiita.com/items/2041
function scan_files_in_dir($dir){
$cwd = getcwd();
chdir($dir);
$list = scandir("$dir/vendor") ;
foreach( $list as $idx=> $dirname){
if( $dirname == "." ){ unset($list[$idx] ); continue; }
if( $dirname == ".." ){ unset($list[$idx] ); continue;}
if( is_dir($dirname) === true ){ unset($list[$idx] ) ;continue;}
$list[$idx] = getcwd()."/".$dirname;
};
@takuya
takuya / dirs.php
Created February 7, 2012 09:16
ディレクトリ中のディレクトリ ref: http://qiita.com/items/2042
<?php
function scan_dir_in_dir($dir){
$cwd = getcwd();
chdir($dir);
$list = scandir("$dir/vendor") ;
foreach( $list as $idx=> $dirname){
if( $dirname == "." ){ unset($list[$idx] ); continue; }
if( $dirname == ".." ){ unset($list[$idx] ); continue;}
if( is_dir($dirname) === false ){ unset($list[$idx] ) ;continue;}
$list[$idx] = getcwd()."/".$dirname;
@takuya
takuya / fotolife
Created February 8, 2012 12:26
はてなフォトライフにアップロードする。 ref: http://qiita.com/items/2160
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'wsse'
require 'base64'
$KCODE='u'
if ARGV.size < 1 or not ARGV.all?{|e| File.exist? e} then
puts "usage: #{__FILE__} 画像ファイル名
ファイル名はタイトルになる。
タイトル指定したいときはファイル名を使えば良い。"
@takuya
takuya / mysql2sqlite.rb
Created February 8, 2012 16:08
MySQLをSqliteに変換する。 ref: http://qiita.com/items/2197
#!/usr/bin/env ruby
require 'rubygems'
if ARGV.size < 1 or not ARGV.all?{|e| File.exist? e} then
puts "usage: #{__FILE__} mysql_create_table.sql
MySQL の show create table などで出力したファイルを引数に指定する"
exit 2
end
@takuya
takuya / test.php
Created February 9, 2012 16:00
PHPのSimpleTestを使う最小限の例 ref: http://qiita.com/items/2286
require_once('simpletest/autorun.php’);
class Sample extends UnitTestCase{
public function test_my_var(){
$this->assertTrue( 1 == "1" );
}
}
$t = new Sample();
@takuya
takuya / file0.txt
Created February 14, 2012 12:37
jQueryを手早くコピペ出来る ref: http://qiita.com/items/2483
src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js";
sc = document.createElement("script");
sc.type="text/javascript";
sc.src=src;
document.body.appendChild(sc);
@takuya
takuya / yucho_bank.rb
Created February 24, 2012 07:34
ゆうちょ銀行のログインとか取得か ref: http://qiita.com/items/2781
require 'rubygems'
require 'kconv'
require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
require 'mechanize'
class YuchoBank
attr_accessor :password, :passphrase_list, :id, :password,:m
START_URL ="https://direct.jp-bank.japanpost.jp/direct_login.html?link_id=ycDctLgn"
def initialize()