Skip to content

Instantly share code, notes, and snippets.

View iwinux's full-sized avatar
👽

Limbo Peng iwinux

👽
View GitHub Profile
@iwinux
iwinux / dump-doit-im.py
Created January 14, 2013 16:19
Dump Doit.im to JSON (can be imported to Taskwarrior) **BACKUP YOUR DATA BEFORE TRYING**
# encoding: utf-8
from __future__ import print_function
from json import dumps as to_json
from datetime import datetime, timedelta
import requests
URL_BASE="https://i.doit.im/tasks/%s"
DOIT_BOXES = ('inbox', 'today', 'next', 'tomorrow', 'scheduled', 'someday', 'waiting')
COOKIES = { 'autologin': 'Your Autologin Cookie Here' }
@iwinux
iwinux / _form.html.haml
Created January 5, 2013 05:32
A sample Rails form definition
= simple_form_for([:admin, @event]) do |f|
= f.error_notification
.form-inputs
= f.input :is_active
= f.input :name_en, label: 'Name (in English)', input_html: { class: 'input-xxlarge' }
= f.input :name_cn, label: 'Name (in Chinese)', input_html: { class: 'input-xxlarge' }
= f.input :category_id, as: :hidden
@iwinux
iwinux / filter-by-type.patch
Created December 29, 2012 11:17
豆藤补丁,按类型过滤广播,使用方法:patch 豆藤脚本.js < filter-by-type.patch
--- doubanhelper.user.js 2012-12-19 23:11:33.000000000 +0800
+++ doubanhelper.user.patched.js 2012-12-29 19:02:51.267462938 +0800
@@ -1571,7 +1571,7 @@
//过滤设置项
var toggle = document.createElement('div');
toggle.id = 'myGFWbar';
- toggle.innerHTML = '<span title="已屏蔽广播数 by 豆藤">屏蔽(<em id="blockNum">0</em>)</span> | <a id="showBlock" class="bn-status-more" href="#" title="还原显示被屏蔽广播 by 豆藤" >显示</a> | <a id="setMyGFW" class="bn-status-more" href="#" title="设置屏蔽规则 by 豆藤">设置</a> |&nbsp;';
+ toggle.innerHTML = '<span title="已屏蔽广播数 by 豆藤">屏蔽(<em id="blockNum">0</em>)</span> | <a id="showBlock" class="bn-status-more" href="#" title="还原显示被屏蔽广播 by 豆藤" >显示</a>| <a id="filter-by-type" class="bn-status-more" href="#" title="过滤某些类型的广播">过滤</a> | <a id="setMyGFW" class="bn-status-more" href="#" title="设置屏蔽规则 by 豆藤">设置</a> |&nbsp;';
$$('#mod-status-cate .status-cate')[0].insertBefore(toggle, $$('#mod-status-cate .bn-status-more')[0]);
@iwinux
iwinux / my-places.el
Last active December 10, 2015 06:29
my-places.el - simple directory shortcut for Emacs
;; usage: M-x places-goto
(setq my-places
'((notes . "~/documents/notes")
(blog . "~/documents/blog")
(emacs . "~/.emacs.d")
(src . "~/src")
(projects . "~/src/projects")))
(defun places-goto ()
@iwinux
iwinux / meminfo.txt
Created December 3, 2012 03:27
sudo dmidecode -t memory
# dmidecode 2.10
SMBIOS 2.5 present.
Handle 0x0023, DMI type 16, 15 bytes
Physical Memory Array
Location: System Board Or Motherboard
Use: System Memory
Error Correction Type: None
Maximum Capacity: 4 GB
Error Information Handle: Not Provided
@iwinux
iwinux / README.md
Created November 16, 2012 17:42
gotunnel on Android

Directory structure:

/data/gotunnel/
- gotunnel
- iptables
- redsocks/
-- config
-- redsocks
- start.sh
// quick-find
type QuickFindSet struct {
numOfComponents uint
items []uint
}
func NewSet(n uint) QuickFindSet {
set := QuickFindSet{ numOfComponents: n, items: make([]uint, n) }
for i, _ := range set.items { set.items[i] = uint(i) }
@iwinux
iwinux / random.go
Created November 5, 2012 16:07
a naive typoglycemia generator
package main
import (
"fmt"
"math/rand"
"io/ioutil"
"os"
"bytes"
"unicode"
)
@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']
@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) {