Skip to content

Instantly share code, notes, and snippets.

View gohumble's full-sized avatar
💎
🙌🏽

gohumble

💎
🙌🏽
View GitHub Profile
@tkrajina
tkrajina / unmarshal_interface.go
Last active March 24, 2025 01:02
Unmarshal JSON to specific interface implementation
package main
import (
"encoding/json"
"fmt"
"reflect"
)
type Something interface{}
@Necklaces
Necklaces / ufw_vpn_killswitch_tutorial.md
Last active January 5, 2025 18:56
GNU/Linux UFW VPN kill switch tutorial

GNU/Linux UFW VPN kill switch tutorial

This is a quick guide for setting up a kill switch using UFW (Uncomplicated FireWall). It is assumed you are using OpenVPN and optionally Network-Manager with network-manager-openvpn.

1. (Optional) IP Addresses

Before we can start we're going to need the IP address (or the IP addresses) of your VPN so that we can whitelist those later on, write them down. They are obviously going to be different for every VPN and VPNs with multiple servers, so I'll leave this up to you.

2. Install UFW

On some systems UFW is installed and enabled by default (Ubuntu, for example). Installation procedure is going to be different for every distribution of GNU/Linux, but it's usually something like

@rdyv
rdyv / print-memory.go
Created May 22, 2019 20:54
Go print current memory
package main
import (
"runtime"
"fmt"
"time"
)
func main() {
// Print our starting memory usage (should be around 0mb)
@Cybergrany
Cybergrany / WeightedMultiParameterHyperOptLoss.py
Last active April 9, 2022 22:45
WeightedMultiparameterHyperOptLoss.py V 0.3
"""
WeightedMultiparameterHyperOptLoss.py V 0.3
-by Cybergrany
A loss function for Freqtrade's hyperopt feature, which allowes the user
to choose weights, which influence how much each parameter affects the objective.
For example, if I want quick trades and don't care too much about risk, I would
give more weight to trades and less to the sortino.
Most of the code here is based on existing freqtrade code, namely the sortino
function and max drawdown calculations. I've just added a way to incorporate