Skip to content

Instantly share code, notes, and snippets.

View Leask's full-sized avatar
🏠
Working from home

Sixia "Leask" Huang Leask

🏠
Working from home
View GitHub Profile
@Leask
Leask / invertTree.js
Created June 12, 2015 18:28
[Invert Binary Tree] Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off. https://leetcode.com/problems/invert-binary-tree/#.VXqvIdRFNy8.twitter
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {TreeNode}
@Leask
Leask / remove_office.sh
Created April 25, 2015 20:12
How to completely remove Office for Mac 2011?!
#!/bin/sh
# Original from: https://www.v2ex.com/t/174943#reply12
# more informations: https://support.microsoft.com/en-us/kb/2398768
osascript -e 'tell application "Microsoft Database Daemon" to quit'
rm -R '/Applications/Microsoft Communicator.app/'
rm -R '/Applications/Microsoft Messenger.app/'
rm -R '/Applications/Microsoft Office 2011/'
rm -R '/Applications/Remote Desktop Connection.app/'
@Leask
Leask / dic.txt
Last active August 29, 2015 14:19
Research of trust.dat
$¡»Ô¢Ö›®ÏÎ => a
¶ƒ‹Ôš¶ƒ‡¬ª => b
Á©ˆ’É => c
¦¡ÕÓ => d
¨‡¯–°½À § => e
@Leask
Leask / ranking.sh
Created March 3, 2015 19:54
Ranking script for burlingtonenglish.com connection optimization project.
#!/bin/bash
direct() {
for i in {1..100}; do
curl --compressed --silent http://www.burlingtonenglish.com > /dev/null
echo -n '='
done
}
optimized() {
# fuck http://www.mikecrm.com/f.php?t=t0g4Vh&from=singlemessage&isappinstalled=0 by @leaskh
a=0;
for ((i=0; i<=1000000; i++)); do
((a=$a+1));
echo $a;
curl 'http://www.mikecrm.com/handler/handleAddFormFeedback.php' -H 'Origin: http://www.mikecrm.com' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8,zh-CN;q=0.6,zh;q=0.4,zh-TW;q=0.2' -H 'X-Requested-With: XMLHttpRequest' -H 'Proxy-Authorization: Basic Y29ycHNlYy0zNmtyOmkzaTN6SkZ5' -H 'Cookie: PHPSESSID=qkgshafe6oqglvn12b8mdqtq70' -H 'Proxy-Connection: keep-alive' -H 'Pragma: no-cache' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.12 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'MG-REFERER: {"RF":"NULL"}' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Cache-Control: no-cache' -H 'Referer: http://www.mikecrm.com/f.php?t=t0g4Vh&from=singlemessage&isappinstalled=0' --data 'DATA=%7B%22FORMTOKEN%22%3A%
@Leask
Leask / startssl.sh
Last active August 29, 2015 14:13
StartSSL certs configuration script.
cat ssl.crt ssl.key > ssl.pem
# https://forum.startcom.org/viewtopic.php?t=719
# http://www.startssl.com/certs/
wget http://www.startssl.com/certs/sub.class1.server.ca.pem
wget http://www.startssl.com/certs/ca.pem
cat sub.class1.server.ca.pem ca.pem > ca-certs.crt
@Leask
Leask / filename.list
Last active August 29, 2015 14:13
Restore the original name of Shotter subtitles.
This file has been truncated, but you can view the full file.
#射手镜像列表
#匹配115礼包 75G 版本
#Powered by 射手网(伪) http://sub.makedie.me/
266260 _________________The_Walking_Dead_S05E08_REPACK_HDTV_x264_KILLERS_chs_eng.rar
266259 e36686269099e147a807e1ece881bbee.rar
266258 _______________.zip
266227 chappie_tlr1_h1080p.zip
266226 Once_Upon_a_Time_in_America_1984_Extended_Bluray_1080p_x264_10bit_DTS_HD_MA5_1_HDTime.zip
266225 1bcd7510cf71831caa374de585db4878.zip
266224 _____________________________________________________.zip
@Leask
Leask / dradio_download
Created December 31, 2013 10:10
Download current playing song in dRadio(for Mac) to your Downloads folder(~/Downloads).
#!/bin/sh
# Download current playing song in dRadio(for Mac) to your Downloads folder(~/Downloads).
# by @leaskh
cp ~/Library/Containers/com.lembacon.dradio/Data/Library/Caches/com.lembacon.dradio/*.tmp ~/Downloads/dRadio.mp3
@Leask
Leask / qqmusic_download
Last active May 3, 2017 08:20
Download current playing song in QQ Music(for Mac) to your Downloads folder(~/Downloads).
#!/bin/sh
# Download current playing song in QQ Music(for Mac) to your Downloads folder(~/Downloads).
# by @leaskh
cp ~/Library/Application\ Support/QQMusicMac/QQMusicPlay.tm3 ~/Downloads/QQMusicPlay.mp3
#!/bin/sh
#dropbox service
DROPBOX_USERS="user1 user2"
DAEMON=.dropbox-dist/dropbox
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
HOMEDIR=`getent passwd $dbuser | cut -d: -f6`