Skip to content

Instantly share code, notes, and snippets.

@a-chen
a-chen / karabiner.json
Created September 24, 2024 17:38
Karabiner MacOS built-in keyboard rule for CapsLock + VIM motions script
{
"description": "CAPS › ESC, CAPS+H/J/K/L › ←↓↑→, CAPS+N/M › Cmd+Left/Cmd+Right, CAPS+F/G › Word left/right",
"manipulators": [
{
"conditions": [
{
"name": "caps_lock pressed",
"type": "variable_if",
"value": 1
}
@a-chen
a-chen / #strip-openlp-song-export-xml.txt
Last active June 19, 2023 21:01
Strips most OpenLP song export XML data so that's human-readable. The script is written in Python and uses the `lxml` library for XML parsing
Gist name
@a-chen
a-chen / remove-chinese-from-openlp.py
Last active May 28, 2022 18:28
Script to remove Chinese text from the OpenLP song title and lyrics
# python 3.x
# Script to remove Chinese text from the OpenLP song title and lyrics
# Chinese lyrics are typically prepended by {y} tags, and suffixed with {/y} tags
# SQL examples here https://www.digitalocean.com/community/tutorials/how-to-use-the-sqlite3-module-in-python-3
# USAGE
# point this script at songs.sqlite OpenLP file
# python3 ./remove-chinese-from-openlp.py songs.sqlite
# created to strip Chinese off of CBM's OpenLP song files where the Chinese text is surrounded by tags
@a-chen
a-chen / parse_youtube_transcript.py
Last active August 30, 2021 18:39
Extract and prettify YouTube transcripts
# -*- coding: utf-8 -*-
# @Author: Isaac Pei
# @Date: 2020-09-28 18:11:14
# @Last Modified by: Isaac Pei
# @Last Modified time: 2021-05-29 13:49:12
## Take the vtt file as input, to generate the transcript text, 1 per line
# --
# -- There is an online tool doing similar work: https://hierogly.ph/
@a-chen
a-chen / shell-script-template-optargs.sh
Last active April 24, 2018 22:13
shell-script-template-optargs.sh
#!/usr/bin/env bash
set -o errexit
set -o pipefail
usage() {
echo "
${0##*/}
DESCRIPTION:
Script explanation
@a-chen
a-chen / shell-script-template.sh
Last active April 24, 2018 21:39
Shell script template with long arguments
#!/usr/bin/env bash
set -o errexit
set -o pipefail
usage() {
echo "
${0##*/}
DESCRIPTION:
Script explanation
@a-chen
a-chen / dark-gray-centered.css
Last active July 14, 2017 02:52
Dark gray centered Stylish theme
/** Dark Gray Centered Theme **/
/*** Main ***/
/* Uncomment to hide main scrollbar
body::-webkit-scrollbar {
display: none;
}
*/
.page {
@a-chen
a-chen / Pok3r-keybinds.ahk
Last active August 30, 2021 18:41 — forked from JarvisPrestidge/Pok3r.ahk
Pok3r keybinds including media and volume controls
#CommentFlag //
#InstallKeybdHook
// Original Author: Jarvis Prestidge
// Enhanced by: Andrew Chen
// =========================
// Pok3r Layout Marcos
// =========================
// Includes Media Keys (Previous|Q, Play/Pause|W, Next|E)
@a-chen
a-chen / install-cmder.bat
Last active July 20, 2017 02:56
Install Cmder with Chocolatey and adds start from context and start menu
@echo off
goto check_permissions
:install
rem Installs Chocolatey package manager
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
rem Installs cmder
choco install cmder -y