Skip to content

Instantly share code, notes, and snippets.

View iwinux's full-sized avatar
👽

Limbo Peng iwinux

👽
View GitHub Profile
@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"
)
// 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 / README.md
Created November 16, 2012 17:42
gotunnel on Android

Directory structure:

/data/gotunnel/
- gotunnel
- iptables
- redsocks/
-- config
-- redsocks
- start.sh
@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 / 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 / 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 / _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 / 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' }
;; Usage: racket quick-find.rkt < pairs.txt
#lang racket/base
(require racket/list)
(require racket/string)
(require profile)
(provide make-qf-set qf-connected? qf-find qf-count qf-items qf-connect!)
(module+ main (profile-thunk main))
openssl s_client -connect github.com:443 -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sed -ne '1,/-END CERTIFICATE-/p' > /tmp/github.com.pem
openssl x509 -in /tmp/github.com.pem -sha1 -noout -fingerprint