Skip to content

Instantly share code, notes, and snippets.

View iwinux's full-sized avatar
👽

Limbo Peng iwinux

👽
View GitHub Profile
#! /bin/bash
for i in {1..9999}
do
curl http://www.sysulove.com/lovetree/myapp/index.php/Friend/friendPersonalPage/friend_id/$i --cookie "<Paste your browser cookies here>" > $i.html
sleep 0.5
done
@iwinux
iwinux / mongoid_patch.rb
Created November 21, 2011 06:23
add find_by_attribute to Mongoid
module Mongoid
module Finders
# add find_by_xxx to Mongoid
# from https://github.com/mitijain123/mongoid/commit/b28b360b787ba4cd32e5423afcfa3b83574f9df1
def method_missing(method_id, *args, &block)
conditions = {}
bang = false
case method_id.to_s
when /^find_(all|last||first)_?by_([_a-zA-Z]\w*)(!?)$/
function inMinutes(time) {
return time.getHours() * 60 + time.getMinutes();
}
function calcDuration(timeStart, timeEnd) {
if (!timeStart || !timeEnd) {
return "";
}
var start = inMinutes(timeStart);
@iwinux
iwinux / gist:1516997
Created December 24, 2011 09:35
my fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<edit mode="assign" name="rgba">
<const>rgb</const>
</edit>
</match>
@iwinux
iwinux / .tmux.conf
Created April 15, 2012 04:41
tmux.conf
# reference https://bitbucket.org/xuxiaodong/dotman/src/cb7f1e6fb338/.tmux.conf
set -g default-terminal "screen-256color"
set -g display-time 3000
set -g history-limit 65535
set -g base-index 1
set -g pane-base-index 1
set -s escape-time 0
# key bindings
@iwinux
iwinux / gist:2477074
Created April 24, 2012 06:19
display caoliu images without opening new windows
(function () {
var i, current, src, elem;
var container = $$('.tpc_content')[0];
var inputs = $$('.tpc_content input');
for (i = 0; i < inputs.length; i++) {
current = inputs[i];
src = current.onclick
.toString()
.match(/open\(".*"\)/)[0]
diff --git a/osdep-darwin.c b/osdep-darwin.c
index c5820df..7b15446 100644
--- a/osdep-darwin.c
+++ b/osdep-darwin.c
@@ -18,6 +18,7 @@
#include <sys/types.h>
#include <sys/sysctl.h>
+#include <libproc.h>
@iwinux
iwinux / monssh.sh
Created October 31, 2012 01:49
monitor SSH status
#! /bin/bash
# usage: monssh [hostname]
if [[ -z $1 ]]
then
HOST="YOURHOST"
else
HOST=$1
fi
@iwinux
iwinux / mylist.go
Created November 2, 2012 13:59 — forked from JeffreyZhao/List.cs
List.removeMultiple implemented in Golang
package main
import ("fmt")
type (
T interface{}
MyList []T
)
func (listp *MyList) removeMultiple(toRemove MyList) {
@iwinux
iwinux / proxy-pac.js
Last active October 12, 2015 10:28
PAC that uses a white list
/*global isPlainHostName, isInNet*/
// inspired by http://chenyufei.info/blog/2012-03-18/pac-and-debug
var proxy = "SOCKS5 127.0.0.1:9999; SOCKS 127.0.0.1:9999; DIRECT"
var noProxy = "DIRECT"
var localhosts = [
['0.0.0.0', '255.255.255.255']
, ['192.168.0.0', '255.255.0.0']
, ['10.0.0.0', '255.0.0.0']