Skip to content

Instantly share code, notes, and snippets.

#NoEnv
#NoTrayIcon
#SingleInstance force
SendMode Input
SetWorkingDir %A_ScriptDir%
SetCapsLockState, AlwaysOff
CapsLock::Send, {CtrlDown}{Space}{CtrlUp}
@jsfaint
jsfaint / flv2mp4
Last active March 24, 2021 05:54
Convert FLV to MP4 powered by ffmpeg
#!/bin/bash
[[ -z $1 ]] && echo "flv2mp4 <flv name>"
src=$1
if [[ -d $src ]] && command -v fzf > /dev/null 2>&1; then
src="$(fd . -e flv "$src" | fzf -e -m)"
fi
@jsfaint
jsfaint / automount.sh
Created January 20, 2020 08:18
Mount image under /tmp
#!/bin/bash
set -e
[[ -z $1 ]] && echo "$(basename $0) <image>" && exit 1
image=$1
[[ ! -e $image ]] && echo "Invalid image file" && exit 1
sudo losetup -o 1048576 -f $image
@jsfaint
jsfaint / plugin.vim
Last active July 1, 2020 01:50
ncm2 config for vim
let s:rc_path = fnamemodify(expand('<sfile>'), ':h')
let s:vimplug = expand(s:rc_path . '/autoload')
if empty(glob(s:vimplug . '/plug.vim'))
execute '!git clone --depth=1 https://github.com/junegunn/vim-plug' s:vimplug
augroup vimrc
autocmd VimEnter * PlugInstall
augroup END
endif
@jsfaint
jsfaint / Set-ExecutionPolicy.bat
Created April 26, 2018 07:49
Set Windows powershell execution policy
powershell Set-ExecutionPolicy unrestricted -Scope CurrentUser
@jsfaint
jsfaint / https_server.go
Created April 23, 2018 03:35
https server in go
// Package main provides ...
package main
import (
"fmt"
"log"
"net/http"
)
func HelloServer(w http.ResponseWriter, req *http.Request) {
@jsfaint
jsfaint / check_space.sh
Created September 14, 2017 02:24
Push message to wechat via serverchan, when disk space threshold is triggered
#!/bin/bash
avail=$(df / | tail -n 1 | awk '{print $4}')
threshold=""
message="硬盘要满啦"
token=""
if [[ ${avail:?} -lt ${threshold:?} ]]; then
curl "https://sc.ftqq.com/${token:?}.send?text=${message:?}"
fi
@jsfaint
jsfaint / hwmon_temp.sh
Created July 11, 2017 09:16
Get hwmon temperature on Linux via sysfs
#!/bin/bash
hwmon_sysfs="/sys/class/hwmon"
list=$(find "$hwmon_sysfs"/*)
for i in $list; do
if [ -e "$i/name" ]; then
sensor="$i"
else
@jsfaint
jsfaint / mem_chk.sh
Created April 12, 2017 10:07
Monitor the memory usage of given process
#!/bin/bash
# Configure by yourself
procname="cagent"
duration=10
usage()
{
echo "$0 {process name} {duration}"
echo "By default:"
@jsfaint
jsfaint / nutstore_dav.sh
Created March 31, 2017 03:24
Mount jianguoyun with davfs2 via webdav
#!/bin/bash
MOUNTPOINT="$HOME/Nutstore"
sudo mount -t davfs https://dav.jianguoyun.com/dav/ "$MOUNTPOINT"