Skip to content

Instantly share code, notes, and snippets.

@shouya
shouya / masquerade.sh
Created October 21, 2012 14:00
BGY utils
#!/bin/sh
IP_ADDR=10.69.56.48
HW_ADDR=aa:bb:cc:dd:ee:ee
IFACE=eth0
if [ "$USER" != "root" ]; then
echo Fucker, Run it as root\!\!\!
exit
@shouya
shouya / share_connection.sh
Last active September 7, 2024 05:47
Share internet connection to android phone
#!/bin/sh
[ $UID = "0" ] || {
echo "Please run as root."
exit
}
[ $1 == '--help' ] && {
echo <<HERE
@shouya
shouya / mandelbrot.rb
Created November 3, 2012 18:43
ruby mandelbrot graphing
require 'RMagick'
# require 'ruby-progressbar'
include Magick
COORD_SIZE = { :x => [-2, 1], :y => [-1, 1] }
MAX_REPEATS = 50
#IMG_SIZE = [200, 200]
IMG_MAGNITUDE = 400
IMG_SIZE = [IMG_MAGNITUDE,
@shouya
shouya / 2ssl.js
Created November 7, 2012 11:20
HTTP -> HTTPS
javascript:window.location=window.location.toString().replace(/^http:/,'https:');
@shouya
shouya / caps2ctrl.reg
Created November 9, 2012 05:37
swap capslock and control key on windows. (after imported the setting you need to re-log in your account)
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3A,00,1D,00,1D,00,3A,00
@shouya
shouya / eco_article.md
Created November 24, 2012 14:43
Economics article to be approved

I have chosen this article: http://www.bbc.co.uk/news/business-19213550

Outline:

It's about the predication of the price of corn in U.S.America will rise sharply. As a result of the nature situation, this year's yield will reach a low valley. And there will be a bunch of consequences, involving the price changes of flue and meat..

@shouya
shouya / sina_or_twitter.js
Created December 1, 2012 14:28
Isn't this twitter's api?
{
"statuses": [
{
"created_at": "Sat Dec 01 22:06:33 +0800 2012",
"id": 3518548498412385,
"mid": "3518548498412385",
"idstr": "3518548498412385",
"text": "蓬門未識綺羅香,擬托良媒益自傷。 誰愛風流高格調,共憐時世儉梳妝。 敢將十指誇針巧,不把雙眉鬥畫長。 苦恨年年壓金線,為他人作嫁衣裳! http://t.cn/zjVh2wq",
"source": "<a href=\"http://weibo.com/\" rel=\"nofollow\">新浪微博</a>",
"favorited": false,
@shouya
shouya / adblock.rules
Created December 15, 2012 11:25
Clarify Sina Weibo! Simply add these lines to your adblock custom rules.
vdisk.weibo.com##A[id="toolbar_download_forward"][class="W_btn_b"]
vdisk.weibo.com##A[id="toolbar_save_forward"][class="W_btn_b"]
weibo.com##A[class="gn_tab gn_member"]
weibo.com##DIV[id="trustPagelet_recom_interestv5"]
weibo.com##DIV[class="W_rightModule"]
weibo.com##DIV[id="trustPagelet_zt_hottopicv5"]
weibo.com##DIV[class="WB_right_module"]
weibo.com##DIV[id="pl_leftnav_group"][class="level_2_Box"]
weibo.com##DIV[id="pl_leftnav_app"]
weibo.com##A[href="http://club.weibo.com/intro"]
@shouya
shouya / UnLockPwd.c
Created December 16, 2012 19:03
Disassembly-ing LockPwd function!
int __stdcall UnLockPwd(int a1, int a2)
{
signed int v2; // esi@1
int v3; // edx@1
int v4; // ecx@1
signed int v5; // edi@1
int v6; // eax@2
int i; // esi@2
signed int j; // esi@6
signed int k; // esi@11
@shouya
shouya / anki_helper.rb
Last active September 24, 2018 13:38
Connect anki flash card and colordict together! (see my github project shouya/anki-helper for the newer version of it)
#
# This script is a convenient tool that takes colordict history from stdin
# and filters all starred vocabularies, queries the dict for meaning, then outputs
# a file for anki to import.
#
# Requires:
# * sdcv (stardict commandline version)
#
#
# This script is licensed by WTFPL.