Skip to content

Instantly share code, notes, and snippets.

@lazywei
lazywei / scmipy
Created May 27, 2014 12:03
Automatically create port forwarding regarding to iPython Kernel. Used with vim-ipython
#!/usr/bin/env ruby
require 'net/ssh'
require 'optparse'
require 'json'
if ARGV.length != 1
puts "need kernel file"
abort
end
diff --git a/hw3/src/Makefile.in b/hw3/src/Makefile.in
index 00a8a79..8036860 100644
--- a/hw3/src/Makefile.in
+++ b/hw3/src/Makefile.in
@@ -23,7 +23,7 @@ CFLAGS = -g -Wall -DTA_KB_SETTING $(PKGFLAG)
@$(CXX) $(CFLAGS) -I$(EXTINCDIR) -c -o $@ $<
top: $(EXTLINK) target
- @echo -n
+ @/bin/echo -n
@lazywei
lazywei / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@lazywei
lazywei / bill.rb
Created February 14, 2013 08:10
自動抓取 emome 上未出帳的每月上網使用流量
# encoding: UTF-8
require "nokogiri"
require "mechanize"
p "Phone number:"
uid = gets.chomp
p "Password:"
pw = gets.chomp
base_url = "http://bms.emome.net/proxy/mbms/"
@lazywei
lazywei / aoh.coffee
Last active December 17, 2015 22:59
Attack on hubot / 進擊的 hubot
# Description:
# Attack on Hubot AT hipchat.
#
# Commands:
# hubot aoh help - Show rules.
# hubot aoh init me - Create or reset certain user.
# hubot aoh atk user - Attack user.
# hubot aoh hunt - hunt something.
# hubot aoh find user - Display user infomation.
@lazywei
lazywei / parser.rb
Last active December 20, 2015 09:49
Yahoo! buy parser
require 'nokogiri'
require 'typhoeus'
url = "http://tw.buy.yahoo.com/gdsale/gdsale.asp?gdid=3791541"
r = Typhoeus.get(url)
doc = Nokogiri::HTML(r.body)
specs = {}
#!/usr/bin/env bash
# Pre-requisites
sudo apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim
# Download and install rbenv
cd ~
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
@lazywei
lazywei / HWTemplate.tex
Last active December 23, 2015 08:19 — forked from dcernst/HWTemplate.tex
% --------------------------------------------------------------
% This is all preamble stuff that you don't have to worry about.
% Head down to where it says "Start here"
% --------------------------------------------------------------
\documentclass[12pt]{article}
\usepackage{fontspec,xltxtra,xunicode}
\usepackage[margin=1in]{geometry}
\usepackage{amsmath,amsthm,amssymb}
@lazywei
lazywei / webserver.go
Last active December 25, 2015 21:29
Groupcache
package main
import (
"bytes"
"fmt"
"github.com/golang/groupcache"
"image"
_ "image/gif"
_ "image/jpeg"
"image/png"
package main
import (
//"bytes"
"fmt"
"github.com/golang/groupcache"
//"image"
_ "image/gif"
_ "image/jpeg"
//"image/png"