Skip to content

Instantly share code, notes, and snippets.


Heri Sim heri16

View GitHub Profile
heri16 /
Last active May 17, 2022
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 -O /usr/lib/sqm/layer_cake_ct.qos
heri16 / 90-mkinitcpio-install.hook.patch
Last active May 13, 2022
Enable Linux Secure Boot with TPM 2.0 (Manjaro / Archlinux) - rEFInd
View 90-mkinitcpio-install.hook.patch
--- /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 @@
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 /
Last active Mar 23, 2022
Download / Record Youtube Live stream
heri16 / bgpd.conf
Last active Feb 14, 2022
AWS VPC VPN StrongSwan Virtual Tunnel Interface (VTI)
View bgpd.conf
#@ /etc/quagga/bgpd.conf (Centos & Ubuntu)
hostname <Local OS hostname>
password <Any random phrase>
enable password <Any random phrase>
log file /var/log/quagga/bgpd
!debug bgp events
!debug bgp zebra
debug bgp updates
heri16 / ProcessExtensions.cs
Created Jul 13, 2016
Powershell / C# class to start a GUI Windows Process on the desktop/session of any logged-in RDP/TS user.
View ProcessExtensions.cs
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).
heri16 / NetwatchGatewayStates.rsc
Last active Dec 19, 2021
Mikrotik RouterOS Script to do proper uplink failover/failback (more reliable than Netwatch)
View NetwatchGatewayStates.rsc
# Mikrotik RouterOS Script to do proper uplink failover/failback (more reliable than Netwatch).
# Supports both Generic and PPPoE interfaces.
# Policy: read, write, policy, test
### Configuration ###
# Define Names of all Interfaces that will be checked:
:local "interface-names" { "internet-speedy";"internet-biznet" };
heri16 / flatten_array.ex
Created Aug 26, 2021
Elixir Flatten array (with tail recursion)
View flatten_array.ex
defmodule FlattenArray do
@doc """
Accept a list and return the list flattened without nil values.
## Examples
iex> FlattenArray.flatten([1, [2], 3, nil])
iex> FlattenArray.flatten([nil, nil])
heri16 /
Last active Oct 19, 2021
Binary encoding of OUCH messages in Elixir

Reuse logic in Elixir

Here are commons ways to reuse logic in Elixir:

1a. Move Function to other module (guards, pattern-matching) 1b. Protocol - Polymorphism

  1. Behaviour Dynamic-func - with def method_name(implemetation, args)
heri16 /
Last active Oct 2, 2021
Install Elixir on macOs


brew update
brew install asdf openssl@1.1
EDITOR=nano brew edit wxmac # Edit the file according to wxmac.patch
brew install wxmac --build-from-source

asdf plugin add erlang
asdf plugin add elixir
heri16 / playground.go
Last active Sep 9, 2021
Nasdaq OUCH_4.2 golang
View playground.go
package main
import (