Skip to content

Instantly share code, notes, and snippets.

@hktonylee
hktonylee / aws-sigv4-ssm-get-parameter.sh
Created July 2, 2025 05:44 — forked from slawekzachcial/aws-sigv4-ssm-get-parameter.sh
Using CURL to call AWS ReST API, signing request with v4 signature
#!/bin/bash
# Source: https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html
[[ -n "${AWS_ACCESS_KEY_ID}" ]] || { echo "AWS_ACCESS_KEY_ID required" >&2; exit 1; }
[[ -n "${AWS_SECRET_ACCESS_KEY}" ]] || { echo "AWS_SECRET_ACCESS_KEY required" >&2; exit 1; }
readonly parameterName="SlawekTestParam"
readonly method="POST"
@hktonylee
hktonylee / xrdp-nvidia-setup.sh
Created April 30, 2024 00:39 — forked from Nexarian/xrdp-nvidia-setup.sh
Setup for XRDP using Nvidia Acceleration
#!/usr/bin/env bash
set -e
cd ~
sudo -v
# Make sure system is in a good, updated, clean, state.
sudo apt-get -y update
@hktonylee
hktonylee / userChrome.css
Last active May 23, 2025 17:54
My Slim Firefox Theme + Sidebery Config
#TabsToolbar {visibility: collapse;}
/*#sidebar-header{ display: none } */
#sidebar-box[sidebarcommand="_3c078156-979c-498b-8990-85f7987dd929_-sidebar-action"] > #sidebar-header{
display: none;
}
/* remove maximum/minimum width restriction of sidebar */
#sidebar {
@hktonylee
hktonylee / How to auto-start WSL during Windows startup, and run services (e.g. cron) in WSL2?.md
Created October 29, 2021 07:14
How to auto-start WSL during Windows startup, and run services (e.g. cron) in WSL2?
  1. Ran sudo visudo. Add this line:

    ALL ALL= NOPASSWD: /usr/local/etc/start_services.sh
    
  2. Create file /usr/local/etc/start_services.sh

    touch /usr/local/etc/start_services.sh
    chmod go-rwx /usr/local/etc/start_services.sh
    

chown root:root /usr/local/etc/start_services.sh

@hktonylee
hktonylee / backup.prf
Last active October 14, 2021 08:29
2-Phases Backup with Unison
# Unison preferences file (Fast backup)
root = /home/xxxx/your-folder
root = ssh://target.host/your-folder
auto = true
batch = true
prefer = newer
@hktonylee
hktonylee / main.sh
Last active October 22, 2021 07:02
Install Unison v2.40 in macOS 11+
# Get Unison v2.40.x
git clone https://github.com/bcpierce00/unison.git
cd unison
git checkout 2.40
# Install opam (OCaml verion manager
brew install opam
# Download OCaml v4.06.1
opam init
@hktonylee
hktonylee / # qt@5 - 2021-05-24_12-58-54.txt
Created May 24, 2021 20:03
qt@5 on Ubuntu 20.04.2 LTS - Homebrew build logs
Homebrew build logs for qt@5 on Ubuntu 20.04.2 LTS
Build date: 2021-05-24 12:58:54
@hktonylee
hktonylee / interactive-open-url.fish
Created June 15, 2018 20:39
Interactively open URLs
#!/usr/bin/env fish
function +fzf_open_url
[ -z "$FZF_OPEN_URL_LIST" ]; and echo "Please configure \$FZF_OPEN_URL_LIST first." >&2; and return
set -l result ( \
cat $FZF_OPEN_URL_LIST \
| sort \
| uniq \
| grep -ve '^$' \
@hktonylee
hktonylee / parse_standard_chartered_csv.py
Created March 7, 2018 07:28
parse_standard_chartered_csv.py
#!/usr/bin/env python3
import os
import re
import argparse
ACCOUNT_FILE_NAME_EX = re.compile(r'AccountTransactions\d+.csv')
CARD_FILE_NAME_EX = re.compile(r'CardTransactions\d+.csv')
PAYMENT_LINE_EX = re.compile(r'^\d{2}/\d{2}/\d{4},PAYMENT - THANK YOU,')
TRANSACTION_LINE_EX = re.compile(r'^\t\t\t\t\t\t\t\t\t\t\t')
@hktonylee
hktonylee / run-service.sh
Created December 1, 2017 02:12
Run multiple service in one script
#!/usr/bin/env bash
updateRate=1
shutdown() {
updateRate=0.2
for pid in $(jobs -p); do
pkill -TERM -P "$pid"