Skip to content

Instantly share code, notes, and snippets.

View Senorsen's full-sized avatar
👋
Hello

Sen Zhang Senorsen

👋
Hello
View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqSTvd4u7WEGgv/GGJ2E7XlD5UlHAuv2B2mRKcCwa2UAQyPCTiOXUpLV9nffnSj04JOweJCsMUnIM71nWDp0j/+sswWHEzk6vPWLTjQvhsF+0R3jxZBk/IGS6mv0Qme9wjHeHPCkqrl7oAEg2JTpzAzJsPniIcZp0Axvc1cJyj9MJaiKhiIjGyL+m7IhBjWu953CHE4YNMUG3FlpWqy9+ykp3Wzpbr1E2sQjuWWgJA8uVtNScFfC1zkKBYElTVtZSlBaJ7jXZqLYW2uhozHg922N5gQlg4pffMZbbe0sGLprnJtFeCMD8iWbXqaSkNIrdPWDjJoN/QooFyEVyBKYWh senorsen@pat
@Senorsen
Senorsen / sysctl-tcp-bbr-append.conf
Last active July 21, 2018 08:48
Enable TCP BBR in Linux 4.9.0
# Only in Linux >= 4.9.0
# Append to sysctl.conf
# TCP BBR
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
@Senorsen
Senorsen / flac-fix.sh
Last active April 26, 2017 07:38
Generate common flac file with 'fLaC' header (use flac package), so firefox or other softwares will support the file
#!/bin/sh
set -e
flac 2>&1 >/dev/null || (echo "Install flac package first. "; exit 1)
FILE=$1
# get the tags
ARTIST=$(metaflac "$FILE" --show-tag=ARTIST | sed s/.*=//g || true)
TITLE=$(metaflac "$FILE" --show-tag=TITLE | sed s/.*=//g || true)
ALBUM=$(metaflac "$FILE" --show-tag=ALBUM | sed s/.*=//g || true)
@Senorsen
Senorsen / use-wsl-zsh-in-cmder.bat
Created September 18, 2016 16:28
Use wsl's zsh in cmder
%windir%\system32\bash.exe -cur_console:p -c zsh
# for generate import
for f in *.ts; do MODEL_NAME=$(grep -ohw 'class \(\w\+Model\)' $f | grep -ohw '\w\+Model'); test $MODEL_NAME && echo "import ${MODEL_NAME} from './$(echo $f | sed 's/\.ts$//')';"; done
# for generate Interface
for f in *.ts; do MODEL_NAME=$(grep -ohw 'class \(\w\+Model\)' $f | grep -ohw '\w\+Model'); test $MODEL_NAME && echo "$(echo ${MODEL_NAME} | sed -e 's/\w/\L\0/' | sed -e 's/Model$//'): ${MODEL_NAME};"; done
@Senorsen
Senorsen / set_path.cmd
Created July 5, 2016 05:45
Add git\bin folder to PATH (git for windows)
@echo off
cls
echo Set objShell = CreateObject("WScript.Shell") > c:\set_path.vbs
echo Set objEnv = objShell.Environment("System") >> c:\set_path.vbs
echo PathToAdd = "C:\Program Files\Git\bin" >> c:\set_path.vbs
echo oldSystemPath = objEnv("PATH") >> c:\set_path.vbs
echo newSystemPath = oldSystemPath ^& ";" ^& PathToAdd >> c:\set_path.vbs
echo objEnv("PATH") = newSystemPath >> c:\set_path.vbs
echo wscript.echo "Complete" >> c:\set_path.vbs
c:\set_path.vbs
@Senorsen
Senorsen / win-set-git-sh-path.bat
Created June 7, 2016 13:30
Set Git for Windows' sh.ext to PATH
REM need administrator's privilege!
setx path "%PATH%;C:\Program Files\Git\bin" /M
@Senorsen
Senorsen / my-vscode-settings.json
Created May 31, 2016 12:41
my-vscode-settings.json
{
"files.trimTrailingWhitespace": true,
"files.eol": "\n"
}
@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 / 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"