Skip to content

Instantly share code, notes, and snippets.

View hotpxl's full-sized avatar

Yutian Li hotpxl

View GitHub Profile
@hotpxl
hotpxl / swap-ctrl-caps.reg
Last active April 23, 2020 19:13
Swap control and caps lock on Windows
REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,3a,00,3a,00,1d,00,00,00,00,00
@hotpxl
hotpxl / prepare-commit-msg
Last active March 5, 2018 21:52
Prepare commit message for Git
#!/usr/bin/env bash
set -euo pipefail
branch=$(git symbolic-ref HEAD | sed -e "s#refs/heads/##")
sed -i.sed '1 i \
'"[${branch}] " "$1"
@hotpxl
hotpxl / ipv6.sh
Last active December 25, 2015 01:19
Connect to Tsinghua ISATAP
#!/bin/bash
if [[ -z "$1" ]]; then
INTERFACE=(en0 en4)
else
INTERFACE=$1
fi
for ITEM in ${INTERFACE[*]}; do
echo "Trying interface ${ITEM}"
LOCAL_IP=$(ifconfig ${ITEM} | grep inet | grep -v inet6 | awk '{print $2}')