Skip to content

Instantly share code, notes, and snippets.

View Senorsen's full-sized avatar
👋
Hello

Sen Zhang Senorsen

👋
Hello
View GitHub Profile
gnome-shell -r --display=:0
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
geo $limited {
default 1;
# Wordpress Jetpack ranges:
192.0.0.0/16 0;
66.135.0.0/16 0;
66.155.0.0/16 0;
76.74.0.0/16 0;
}
@Senorsen
Senorsen / fudan-xk-script.js
Last active August 29, 2015 14:16
复旦选课网半自动脚本
/*
* @author Senorsen <sen@senorsen.com>
*/
var jquery_url = 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js',
script = document.createElement("script");
var stop_flag = false;
script.src = jquery_url;
document.getElementsByTagName("head")[0].appendChild(script);
function start_fetch(lessonid, verify, auto) {
@Senorsen
Senorsen / wintime.sh
Created February 23, 2016 04:06
Get time in both Windows and Unix-like (in bash, etc.)
#!/bin/sh
# Originally from http://stackoverflow.com/questions/24538632/githubs-git-bash-msysgit-showing-wrong-timezone-on-windows
# and modified by Senorsen
# Are we running on Windows?
isWindows() { [[ -n "$WINDIR" ]]; }
# Get time, cross-platform.
getTime() {
@Senorsen
Senorsen / build-git-under-deb8.md
Created March 10, 2016 03:47
build git under debian 8

Prerequisite

sudo apt-get install build-essential libssl-dev libcurl4-openssl-dev libexpat-dev gettext
@Senorsen
Senorsen / weibo-unfollow-all.js
Last active March 20, 2016 05:12
weibo unfollower
// 先加载 jQuery
loadScript('http://code.jquery.com/jquery-2.2.2.js', function () {
var users = [];
$('.member_li').each(function () {
var userArr = $(this).attr('action-data').split('&');
for (var i in userArr) {
userArr[i] = userArr[i].split('=');
}
@Senorsen
Senorsen / flash-nexus.sh
Last active August 11, 2016 09:28
Flash Nexus Device (especially approriate for unlocked & rooted devices)
#!/bin/sh
# Author: Senorsen <senorsen.zhang@gmail.com>
# Prerequisites: adb, fastboot, unzip
# Flash Nexus Device (especially approriate for unlocked & rooted devices), which cannot be upgraded with OTA
# First download nexus factory image from:
# https://developers.google.com/android/nexus/images
set -e
FILE="$1"
@Senorsen
Senorsen / winprog.sh
Created May 20, 2016 14:53
no sucks with windows ping.exe in cygwin & msys for chinese (gbk <-> utf-8)
#!/bin/sh
# Usage: winprog ping 8.8.8.8
# Hint: you can write a shell: ~/bin/ping, and call this script
iconv -f utf-8 -t gbk | $@ | iconv -f gbk -t utf-8
@Senorsen
Senorsen / my-vscode-settings.json
Created May 31, 2016 12:41
my-vscode-settings.json
{
"files.trimTrailingWhitespace": true,
"files.eol": "\n"
}