Skip to content

Instantly share code, notes, and snippets.

View SimZhou's full-sized avatar
🥇

Simon Zhou SimZhou

🥇
View GitHub Profile
@SimZhou
SimZhou / ark2wav.sh
Created January 20, 2023 03:46
Bash script to convert all wav.ark from a wav.scp file into .wav
#!/bin/bash
speed=100
if [ $# != 2 ];then
echo "[ERROR] Usage: $0 wav.scp(archived) outdir" && exit 1
fi
wavscp=$1
outdir=$2
@SimZhou
SimZhou / duhere
Created August 1, 2022 03:41
Write folder size info of curdir into du.<datetime>
#!/bin/bash
# ======================
# To write folder size info into curdir as a file,
# with timestamps.
# ======================
du -d 1 -h | tee "du."$(date "+%Y%m%d_%H-%M-%S")
@SimZhou
SimZhou / proxy-settings-for-linux-shell.sh
Last active January 3, 2024 13:28
A linux shell proxy set/unset script
# Save following lines as '/usr/local/sbin/ssr-on'
# Enable proxy using command: . ssr-on
proxy_list=(
http://username:passwd@192.168.1.2:1080
http://192.168.1.11:1080
)
for proxy in ${proxy_list[@]}; do
ip_addr=$(echo $proxy | sed -re 's|^http://||g;s|.*@||g;s|:[0-9]*/?$||g')
port=$(echo $proxy | awk '{port=gensub(/.*:([0-9]{1,5})\/?/,"\\1","g",$0);print port}')
nc -vz -w 1 $ip_addr $port &> /dev/null && {
@SimZhou
SimZhou / .bashrc
Last active April 22, 2023 16:19
Some useful .bashrc settings
# sshcd, Useful when you are switching between hosts with shared file systems
# Example Usage:
# sshcd 172.168.2.32 $(pwd)
# sshpwd 172.168.2.32
sshcd () { ssh -t "$1" "cd \"$2\"; exec \$SHELL -l"; }
sshpwd() { ssh -t "$1" "cd \"$(pwd)\"; exec \$SHELL -l"; }
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=5000
HISTFILESIZE=8000
@SimZhou
SimZhou / .vimrc
Last active May 25, 2022 14:46
My .vimrc
set number " 显示行号
set hlsearch " 高亮搜索
set incsearch " 输入立即开始搜索
syntax enable
filetype on
filetype plugin indent on
set t_Co=256 " 256色
set encoding=utf-8 " 命令行显示的编码
set fileencodings=utf-8,gb18030,gb2312,gbk,ucs-bom,cp936 " 打开文件的编码
@SimZhou
SimZhou / Q_rsqrt.go
Last active February 13, 2022 14:15
Fast inverse square root in Golang
// The Fast Inverse Square Root code in the game "Quake"
// translated from C
// Reference: https://en.wikipedia.org/wiki/Fast_inverse_square_root
package main
import (
"fmt"
"unsafe"
)