Skip to content

Instantly share code, notes, and snippets.

@jin
jin / socks-proxy-iphone.sh
Last active August 29, 2015 14:14
Share jailbroken iPhone's WiFi connection from USB tether to a Mac.
# A USB tether always make use of the 3G/4G connection of your iPhone.
# You can override this config by buying MyWi 8.0 for 20 bucks or
# do the following. :-)
# Skip to step 4 if you already have ssh set up.
# 1) Install OpenSSH from Cydia
# 2) ssh into your phone. default password is `alpine`.
# I use CCSystemInfo to access my iPhone's cellular IP address easily.
@jin
jin / keybase.md
Last active August 29, 2015 14:14

Keybase proof

I hereby claim:

  • I am jin on github.
  • I am jin (https://keybase.io/jin) on keybase.
  • I have a public key whose fingerprint is 124B CC2E 008C 650E FF3D EC71 47D0 E655 F065 B791

To claim this, I am signing this object:

require 'nokogiri'
require 'httparty'
require 'concurrent'
require 'pp'
class HWZRequest
def initialize
@host = "http://forums.hardwarezone.com.sg"
end
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive'
Plug 'Raimondi/delimitMate'
Plug 'tpope/vim-ragtag'
" Runs code through external parser to check for syntatic errors
Plug 'scrooloose/syntastic'
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
@jin
jin / rails-3.1-gemfile.rb
Created September 2, 2011 01:46
Gemfile of fresh Rails 3.1 app, clean RVM 1.9.2 gemset except for Rails itself
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
@jin
jin / ex37.rb
Created September 13, 2011 08:16
Ruby symbols review: Learn Ruby The Hard Way
descriptions = {}
# ========
# KEYWORDS
# ========
# -----
# alias
# -----
array = [
{:name=>"site a", :url=>"http://example.org/site/1/"},
{:name=>"site b", :url=>"http://example.org/site/2/"},
{:name=>"site c", :url=>"http://example.org/site/3/"},
{:name=>"site d", :url=>"http://example.org/site/1/"},
{:name=>"site e", :url=>"http://example.org/site/2/"},
{:name=>"site f", :url=>"http://example.org/site/6/"},
{:name=>"site g", :url=>"http://example.org/site/1/"}
]
let rec read_lines () =
try let line = read_line () in
int_of_string (line) :: read_lines()
with
End_of_file -> []
let f n arr = (*Complete this function*)
let () =
let n::arr = read_lines() in
@jin
jin / islands.rb
Last active December 15, 2015 07:24
islands.rb
# find the number of islands (1's) in a n x m matrix
# islands are only connected by cells in the up, down, left and right directions.
input = "
1 1 1 1 1 \n
0 0 1 0 0 \n
0 0 0 0 0 \n
1 1 0 0 1 \n
1 0 0 0 1 \n
"
@jin
jin / Q1.js
Last active December 22, 2015 13:59
DG3
// integration using Simpson's Law
function calc_integral (func, a, b, n) {
var h = (b - a) / n;
function helper (func, acc, k) {
if (k === n) {
if (k % 2 === 0) {
return (acc + 2 * func(a + k * h));
} else {
return (acc + 4 * func(a + k * h));