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 / ipmi_channel.sh
Created March 10, 2015 02:41
Dump NCSI IP/Mac address using ipmitool
#!/bin/bash
channel_cmd="ipmitool channel info"
lan_cmd="ipmitool lan print"
function is_lan_channel()
{
local chan=$1
$channel_cmd $chan 2>&1 | grep LAN -q
if [[ $? -eq 0 ]]; then
return 1
@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 / sys_proxy
Last active April 13, 2020 01:26
Set System Proxy for OS X
#!/bin/bash
wifi="Wi-Fi"
IP=127.0.0.1
PORT=7777
[[ $# -ne 1 ]] && echo "$0 http|pac|disable" && exit 1
flag=$1
function webproxy_set() {
@jsfaint
jsfaint / 99-intelbacklight.rules
Created June 20, 2014 12:36
A udev rules for laptop, set intel graphic card brightness.
ACTION=="change", SUBSYSTEM=="backlight", RUN+="/usr/sbin/intelbacklight.sh"
@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 / mac_update.sh
Created March 24, 2017 07:58
Update MAC address using ethtool
#!/bin/bash
PATTERN='^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$'
print_usage() {
echo "Need NIC name"
echo "usage: $0 eth0 00:11:22:33:44:55"
}
if [ -z $1 ]; then
@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) {