Skip to content

Instantly share code, notes, and snippets.

@chen7897499
chen7897499 / login-to-yahoo-jp-with-mechanize-on-ruby.rb
Created July 2, 2016 08:38 — forked from kaosf/login-to-yahoo-jp-with-mechanize-on-ruby.rb
login to Yahoo! JAPAN with Mechanize on Ruby - Ruby の Mechanize を使って Yahoo! JAPAN にログインする
# coding: utf-8
require 'mechanize'
Id = 'id'
Password = 'password'
Mechanize.new do |agent|
agent.user_agent = 'Mozilla/5.0 (Linux; U; Android 2.3.2; ja-jp; SonyEricssonSO-01C Build/3.0.D.2.79) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'
agent.get 'http://login.yahoo.co.jp/config/login?.lg=jp&.intl=jp&logout=1&.src=www&.done=http://www.yahoo.co.jp'
@chen7897499
chen7897499 / web-servers.md
Created July 3, 2016 06:55 — forked from mcxiaoke/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@chen7897499
chen7897499 / nl.sh
Created July 19, 2016 07:08 — forked from yyx990803/nl.sh
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"
@chen7897499
chen7897499 / stack_overflow_debugger.rb
Created August 31, 2016 14:04 — forked from myronmarston/stack_overflow_debugger.rb
Stack overflow debugger (since Ruby doesn't provide the whole stack in this case)
max_stack_frames = 500
TooManyStackFrames = Class.new(StandardError)
TracePoint.new(:call) do |tp|
if caller.size >= max_stack_frames
raise TooManyStackFrames, "Stack has exceeded #{max_stack_frames} frames"
end
end.enable
@chen7897499
chen7897499 / .rvmrc
Created November 18, 2016 09:09 — forked from danielnc/Gemfile
Ruby-based Benchmark of MessagePack vs. JSON vs. Yajl vs. Protobuffers vs. MultiJson vs. Marshal vs. YAML vs. BSON
rvm --create 1.9.3@benchmarks
#script to see differents between consistently calculation and parallel calculation
gem "parallel"
require 'parallel'
#function can compute more efficiently and I know it :)
def is_prime?(num)
return true if num == 1
return false if num < 1
for x in 2...num
@chen7897499
chen7897499 / 1 Gist conventions
Created December 29, 2016 05:51 — forked from PavloBezpalov/1 Gist conventions
Deploy Rails 5.0.0.beta3 to VPS(Ubuntu 14.04.4 LTS). Nginx, Puma, Capistrano3, PostgreSQL, RVM.
<<APP>> change this variables