Skip to content

Instantly share code, notes, and snippets.

View heri16's full-sized avatar

Heri Sim heri16

View GitHub Profile
@heri16
heri16 / 0-README.md
Last active May 4, 2024 02:55
Secure Number Masking for Postgres (Scrambling DB Primary Keys or sensitive data using NIST FF1 Format Preserving Encryption)

What

This is open-source code that lets you secure or mask numbers (within Postgresql DB) for use as unique IDs that are 6-digits or more.

This is what they look like:

https://example.com/order/053124
@heri16
heri16 / 0-README.md
Last active April 26, 2024 09:08
Secure Short Unique IDs (for generating Invites Codes or Promo Codes or URL slug from Postgres Database)

What

This is open-source code that lets you generate short unique identifiers from numbers (within Postgres DB). These IDs are URL-safe, can encode several numbers, and do not contain common profanity words.

This is what they look like:

https://example.com/order/FHxkSB1ai
@heri16
heri16 / 90-mkinitcpio-install.hook.patch
Last active April 26, 2024 04:57
Enable Linux Secure Boot with TPM 2.0 (Manjaro / Archlinux) - rEFInd
--- /usr/share/libalpm/hooks/90-mkinitcpio-install.hook 2020-03-05 12:45:41.000000000 +0800
+++ /etc/pacman.d/hooks/90-mkinitcpio-install.hook 2020-06-13 23:08:32.861202141 +0800
@@ -8,5 +8,7 @@
[Action]
Description = Updating linux initcpios...
When = PostTransaction
-Exec = /usr/share/libalpm/scripts/mkinitcpio-install
+Exec = /usr/local/share/libalpm/scripts/mkinitcpio-install
+Depends = sbsigntools
+Depends = x11-ssh-askpass
@heri16
heri16 / CAPTIVE-PORTAL.md
Created April 1, 2024 10:52
CAPTIVE PORTAL DETECTION Domains and URLs

Captive Portal Detection

Browsers:

captive.apple.com, www.apple.com, clients3.google.com, clients4.google.com, connectivitycheck.gstatic.com, www.gstatic.com, edge-http.microsoft.com, msftconnecttest.com, detectportal.brave-http-only.com, detectportal.firefox.com, spectrum.s3.amazonaws.com

See: https://captivebehavior.wballiance.com/

@heri16
heri16 / README.md
Last active March 29, 2024 02:43
Openwrt: Uses CAKE's diffserv4 classifications: Bulk, Best Effort, Video, Voice in combination with act_ctinfo and CONNMARK --set-dscpmark to restore DSCP classifications on ingress.

Smart Queue

Initial Setup

opkg update
opkg install luci-app-sqm kmod-sched-ctinfo iptables-mod-hashlimit ipset nano

# Install modified layer_cake to sqm-scripts
wget https://gist.githubusercontent.com/heri16/06c94b40f0d30f11e3a82166eca718f3/raw/layer_cake_ct.qos -O /usr/lib/sqm/layer_cake_ct.qos
@heri16
heri16 / ProcessExtensions.cs
Created July 13, 2016 16:17
Powershell / C# class to start a GUI Windows Process on the desktop/session of any logged-in RDP/TS user.
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
using System.IO;
namespace heri16
{
/// <summary>
/// Static class to help Start a GUI/Console Windows Process as any user that is logged-in to an Interactive Terminal-Session (e.g. RDP).
# Measure Bandwidth (using https://www.speedtest.net/apps/cli)
#wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-x86_64.tgz -O /tmp/speedtest.tgz
wget https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-aarch64.tgz -O /tmp/speedtest.tgz
tar -xzvf /tmp/speedtest.tgz -C /usr/sbin/
rm -f /tmp/speedtest.tgz /usr/sbin/speedtest.*
chmod +x /usr/sbin/speedtest
/etc/init.d/qosify stop
speedtest --format=tsv > /tmp/speedtest.tsv &&
BANDWIDTH_DOWN="$(($(cut -f6 /tmp/speedtest.tsv) / 125000))mbit" &&
@heri16
heri16 / 1-android-sdk.sh
Created February 7, 2024 14:13
Fdroid Quick Repository
#!/usr/bin/env zsh
curl -o commandlinetools-linux.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip && unzip commandlinetools-linux.zip && rm commandlinetools-linux.zip
@heri16
heri16 / Netwatch.rsc
Created April 10, 2017 07:43
Mikrotik RouterOS script for Ping-based Fast Failover with PPPoE uplinks.
/interface pppoe-client
set [find name="internet-speedy"] comment="PROVIDER1"
set [find name="internet-biznet"] comment="PROVIDER2"
/ip route
add comment="Force test pings through PROVIDER1" distance=1 dst-address=4.2.2.4/32 gateway=internet-speedy
add comment="Block test pings through other providers" distance=20 dst-address=4.2.2.4/32 type=blackhole
/tool netwatch
add comment=CheckCon down-script=":local \"p1\" [/interface pppoe-client find c\
@heri16
heri16 / 0-README.md
Last active August 4, 2023 16:31
Patch chrome-remote-desktop to use DISPLAY 0

Usage

curl -o- https://gist.githubusercontent.com/heri16/c64ec7a20334cc4037ab879083bed5a4/raw/chrome-remote-desktop.patch | sudo patch /opt/google/chrome-remote-desktop/chrome-remote-desktop
crd --restart