Skip to content

Instantly share code, notes, and snippets.

View the-eric-kwok's full-sized avatar
😉

EricKwok the-eric-kwok

😉
View GitHub Profile
@the-eric-kwok
the-eric-kwok / auto-backup.sh
Last active January 19, 2018 06:12
auto backup spigot dir
#!/bin/bash
DATE=`date '+%F'` #获取当前日期
DEL-DATE="30" #自动删除30天以前的备份
BACKUP_DIR="./share/spigot_backup" #备份目录
tar -zcvf "$DATE-spigot.tar.gz" ~/spigot
if [ ! -d "$BACKUP_DIR" ]; then
mkdir "$BACKUP_DIR"
fi
@the-eric-kwok
the-eric-kwok / tab2space.sh
Created January 19, 2018 05:45
convert tabs in text file to spaces
#!/bin/bash
# Set the count of space to 2
SPACES=" "
if [ "$1" == "--help" ]||[ "$1" == "-h" ]||[ -z "$1" ]; then
echo "Function: Transform tabs to spaces."
echo "Usage: tab2space [file]"
exit 1
fi
@the-eric-kwok
the-eric-kwok / ssh_config.md
Last active January 28, 2018 14:08
ssh 配置文件模板

文件存于~/.ssh/

Host xx
    HostName xxx.xxx.com
    User xx
    Port 22
    IdentityFile ~/.ssh/id_rsa
@the-eric-kwok
the-eric-kwok / bash-complete.md
Last active March 1, 2018 08:23
Give you a smarter auto-complete

Debian does not come with 'bash-completion' installed and enabled.

To fix this, run (as root):

apt-get install bash-completion

Then, you have two options. You can either (1) enable it on a per-user basis for yourself, or (2) enable it globally.

If you want to enable it for just your user, edit ~/.bash_profile and ~/.bashrc - add the following:

@the-eric-kwok
the-eric-kwok / genpasswd.sh
Created March 4, 2018 15:03
*nix password generator
#!/bin/bash
l=$1
[ "$l" == "" ] && l=16
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
# 这个脚本可以用来把ASS格式的字幕和logo一起压制到视频里。依赖于ffmpeg和zenity
# 由于使用命令行输入路径的话参数太多,不方便记忆(我自己都记不住),所以使用zenity图形界面来操作,对新手更友好
# logo建议使用png格式,使用透明背景,并且请裁剪成正方形,否则大概会变形
# 设置logo大小指的是logo水印在视频中的大小,默认为200x200的正方形,如果需要压制长方形logo请自行修改源码
#!/bin/bash
TOP_LEFT="10:10"
TOP_RIGHT="main_w-overlay_w-10:10"
BUTTOM_LEFT="10:main_h-overlay_h-10"
#!/bin/bash
VIDEO=$1
ASS=$2
OUTPUT=$3
help(){
echo "Usage: burn_ass.sh <video> <ass sub> <output>"
}
@the-eric-kwok
the-eric-kwok / merge_av.bat
Last active May 12, 2018 13:22
Merge video and audio
@echo off
:: This is help menu
if "%1"=="/h" (goto help)
if "%1"=="/help" (goto help)
if "%1"=="/?" (goto help)
if "%1"=="-h" (goto help)
if "%1"=="--help" (goto help)
if "%1"=="" (goto help)
@the-eric-kwok
the-eric-kwok / merge_av.sh
Created May 12, 2018 13:26
Merge video and audio
#!/bin/bash
VIDEO=$1
AUDIO=$2
OUTPUT=$3
help(){
echo "Usage: burn_ass.sh <video> <ass sub> <output>"
}
@the-eric-kwok
the-eric-kwok / open_powershell_here.md
Last active May 30, 2018 03:13 — forked from davecan/open_powershell_here.md
How to enable "Open PowerShell Here" context menu in Windows 10