Skip to content

Instantly share code, notes, and snippets.

@mendhak
mendhak / !Getting the AULA F65 to work with VIA app.md
Last active December 23, 2025 07:49
Getting the AULA F65 to work with VIA app - README + JSON layout

I bought an Aula F65 off Ali Express. By default it didn't work with VIA. I had to download the Aula F65 firmware first.

The firmware was a single EXE which I'd run which gave almost no information about what it was doing except that it had set my keyboard to "Code Version 0000". Rerunning the exe multiple times would result in different codes, including a "Code Version 1005" which made the keyboard unresponsive, bit of a scary moment. I ran the exe again and it set the keyboard back to "Code Version 0000".

image

Once the keyboard was at "Code Version 0000", it was then VIA compatible. I reconnected the keyboard, then on the UseVIA website, I was able to authorize the keyboard and it showed up in the keyboard selection list.

But that wasn't enough, even after authoriz

@mendhak
mendhak / snowflake_generate_jwt_from_private_key.py
Created August 27, 2025 16:49
Generate a JWT for Snowflake from a private key
# /// script
# dependencies = [
# "cryptography",
# "PyJWT",
# ]
# ///
#!/usr/bin/env python3
# To run this on the command line, enter:
# uv run snowflake_generate_jwt_from_private_key.py --account=<account_identifier> --user=<username> --private_key_file_path=<path_to_private_key_file>
@mendhak
mendhak / .bashrc
Last active January 27, 2025 09:45
Bash function to convert text to spongebob mocking text
# Just add this to .bashrc
# then call
# spongebob We are all a family
function spongebob() { export MOCKIFY="$@"; python3 -c "import os;import random;print(''.join(random.choice((str.upper, str.lower))(letter) for letter in os.getenv('MOCKIFY')))"; }
# function spongebob() { export MOCKIFY="$@"; python3 -c "import os;import random; print(''.join( [ x.upper() if random.randint(0,1) else x for x in os.getenv('MOCKIFY') ] ))"; }
@mendhak
mendhak / README.md
Last active August 27, 2024 20:58
Playwright, using a proxy, with a domain being transparently mapped to another domain

With Playwright in a container, I want to have it call 'example.com', and when it does, reroute that request to some other domain, such as httpbin.org. In my case this would be a load balancer.

How it works - Playwright uses its proxy feature and calls Squid.
The Squid container has been configured to think that example.com is on the nginx container's IP address.
Nginx just uses TCP forwarding and sends the request on to httpbin.org.
Nginx doesn't use HTTP proxying because then it would need to host a certificate.

Bring up the nginx and squid

@mendhak
mendhak / README.md
Last active August 27, 2024 21:04
In docker, transparently route a domain to another domain through TCP proxying

Basically I want a container to call 'example.com' and when it does, it should go to Nginx which in turn forward the request to some-other-domain.com

This worked with curl and other basic applications.

This doesn't seem to work with Playwright though, for some reason Chrome just ignores the 'DNS' being set up here. For Playwright, I used this method with Squid.

Bring up the nginx

docker-compose up nginx
@mendhak
mendhak / add-all-aws-ca.sh
Last active July 22, 2024 18:14
Script to add all Amazon AWS CAs to the local Ubuntu trust store
certdir=/tmp/aws-certs
mkdir -p "${certdir}"
sudo mkdir -p /usr/local/share/ca-certificates/aws/
curl -sS "https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem" > ${certdir}/global-bundle.pem
awk 'split_after == 1 {n++;split_after=0} /-----END CERTIFICATE-----/ {split_after=1}{print > "aws-ca-" n+1 ".crt"}' < ${certdir}/global-bundle.pem
for cert in aws-ca-*; do
sudo mv $cert /usr/local/share/ca-certificates/aws/
@mendhak
mendhak / sidecar_cleanup.sh
Last active April 28, 2024 20:58
Script to delete XMPs and other sidecar files in a specified directory, if the base image file does not exist
#!/bin/bash
# modified from # https://stackoverflow.com/questions/48757748/removing-orphaned-sidecar-files-by-extension
# Check if directory is provided as argument
if [ $# -ne 1 ]; then
echo "Usage: $0 directory_path"
exit 1
fi
@mendhak
mendhak / .keychron_k2_pro_via_layout.md
Created March 11, 2024 19:22
Keychron K2 Pro - VIA layout, with sterling symbol and em dash

Remapped the lighting key to printscreen.

Removed the lighting related keys on layer 3

Macro for £ (fn1 + g) and — (fn1 + d)

@mendhak
mendhak / .keychron_k6_pro_via_layout.md
Last active February 27, 2024 08:44
Keychron K6 Pro - VIA layout, with sterling symbol and em dash

Remapped the rightmost keys to delete, home, end. (Instead of Home, pg up, pg down).

Remapped the lighting key to printscreen.

Removed the lighting related keys on layer 3

Macro for £ (fn1 + g) and — (fn1 + d)

@mendhak
mendhak / README.md
Created July 24, 2023 22:13
Run Llama2 on GPU