This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http') | |
, httpProxy = require('http-proxy') | |
, Cookie = require('cookie') | |
, fs = require('fs'); | |
var SERVERS_FILE_NAME = "servers.json" | |
var PROXY_PORT = 4000 | |
var SERVERS = null; | |
var g_httpProxies = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
def init | |
(1..9).to_a.shuffle | |
end | |
success=0 | |
failure=0 | |
10000000.times do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec' | |
require File.expand_path('../../hash_with_value_indifferent_access',__FILE__) | |
describe HashWithValueIndifferentAccess do | |
context "initialize" do | |
before do | |
@hash = HashWithValueIndifferentAccess.new({:a=>:b}) | |
end | |
it "symbole value compare string value " do | |
@hash[:a].should == "b" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'forwardable' | |
class HashWithValueIndifferentAccess | |
extend Forwardable | |
attr_accessor :hash | |
def_delegators(:@hash,*({}.public_methods - Object.new.public_methods - ["[]","[]=","values","==","to_s"])) | |
def initialize(hash={}) | |
@hash={} | |
hash.each do|k,v| | |
if v.is_a?(Symbol) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nkf' | |
Dir.glob("c:/howm/2011/*/*.howm"){|g| | |
d = File.read(g) | |
File.open(g,"w"){|f| | |
f.write(d.force_encoding(NKF.guess(d)).encode("cp932")) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetCode(pos,str) | |
let s:pos = a:pos | |
let s:n_code = str2nr(strpart(a:str,s:pos,2),16) | |
let s:pos = s:pos + 2 | |
"in a certain sns | |
"if s:n_code == 37 | |
" let s:n_code = str2nr(strpart(s:line,s:pos,2),16) | |
" let s:pos = s:pos + 2 | |
"endif | |
return [s:pos,s:n_code] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun post-ftp() | |
"Post current file to Server." | |
(interactive ) | |
(setq nowfile (buffer-file-name)) | |
(setq before_buffer (buffer-name)) | |
(setq dir_pos (string-match "/[^/]*$" nowfile)) | |
(setq dir_name (substring nowfile 0 dir_pos)) | |
(setq remote_dir_name (substring nowfile (length "c:/") dir_pos)) | |
(setq file_name (substring nowfile (+ 1 dir_pos) (length nowfile))) | |
(find-file "c:\\tmp\\scpcmd.txt") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" You should execute pagent before you call those command. | |
function PutScp() | |
let s:nowDir = substitute(expand("%:p:h"),"[cC]:\\(.*\\)$","\\1","") | |
let s:nowFile = expand("%:t") | |
let s:fn = "c:\\tmp\\scpcmd.txt" | |
if filereadable(s:fn) | |
let s:ret = delete(s:fn) | |
endif | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Rack | |
class SignatureCheck | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
return [ 401,{ 'Content-Type' => 'text/plain','Content-Length' => '0'},[]] unless ::OauthSignature.valid?(env) | |
@app.call(env) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.net.URI | |
import org.apache.http._ | |
import org.apache.http.client._ | |
import org.apache.http.impl.client._ | |
import org.apache.http.entity.InputStreamEntity | |
import org.apache.http.client.methods._ | |
import scala.util.parsing.json.JSON._ | |
import java.io.StringBufferInputStream | |
import org.apache.commons.codec.binary.Base64.encodeBase64 | |
import javax.crypto |