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 / fake_apple_mouse.py
Last active February 11, 2021 05:21
A script to modify VirtualSMC.kext or FakeSMC.kext for faking non-apple mouse.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import plistlib
from shutil import copyfile
files = ["/Volumes/EFI/EFI/OC/Kexts/VirtualSMC.kext/Contents/Info.plist",
"/Volumes/EFI/EFI/OC/Kexts/FakeSMC.kext/Contents/Info.plist"]
idProduct = 9486
idVendor = 16700
# Better work with oh-my-pwsh
# Put below content into $PROFILE
function su-fun {Start-Process powershell -Verb runAs -argumentlist '-NoExit', "cd '$pwd';", "$args"}
set-alias su su-fun
set-alias sudo su-fun
$env:PYTHONIOENCODING="utf-8"
# Remove curl alias
If (Test-Path Alias:curl) {Remove-Item Alias:curl}
@the-eric-kwok
the-eric-kwok / split_log.sh
Created June 2, 2018 05:29
Split v2ray log and delete outdated logs.
#!/bin/bash
LOGPATH=/var/log/v2ray/
TIME=`date +"%Y%m%d %H:%M"`
MAXLOGDAY=20
cd $LOGPATH
# split logs
tar -zcf ${TIME}.log.tgz *.log
cat /dev/null > error.log
cat /dev/null > access.log
@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
@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 / 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)
#!/bin/bash
VIDEO=$1
ASS=$2
OUTPUT=$3
help(){
echo "Usage: burn_ass.sh <video> <ass sub> <output>"
}
# 这个脚本可以用来把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"
@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
@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: