Skip to content

Instantly share code, notes, and snippets.

View jb68's full-sized avatar

Julian Buliga jb68

View GitHub Profile
@jb68
jb68 / vps.md
Created May 3, 2025 01:11 — forked from arrogantrabbit/vps.md
Hosting services, like Storj, behind firewall/GNAT, using Wireguard on a VPS and DNAT (Port Forwarding) with iptables.

DNAT with iptables over wireguard hosted on a VPS to host services behind a firewall/GNAT.

This is a short description of how to host services, using STORJ node as an example, on a host behind GNAT, or otherwise restrictive firewall, by forwarding packets through WireGuard endpoint on a relatively fast nearby VPS. This is not specific to Storj, and can be adopted to hosting other services.

As an example we will use an Oracle Cloud instance. Free tier still provides 10TB of monthly traffic that is sufficient for most node operators. Just make sure to create an account in a closest datacenter to minimize extra latency.

Notes on configuring the cloud instance

  1. Create the oracle compute instance (ideally, Ampere, because they are awesome, but if that is not availabe, any other will do too).
  2. Pick any OS you prefer, here we'll describe Ubuntu, as a most popular one.
@jb68
jb68 / EmojiFormatter.py
Created April 11, 2025 18:16 — forked from skewty/EmojiFormatter.py
Python logging using Emoji for loglevel
import logging
class EmojiFormatter(logging.Formatter):
"""Formatter that adds `levelemoji` field. Override emojis used my modifying EMOJI_MAP.
Example:
logging.basicConfig(format="%(asctime)s %(levelemoji)s %(message)s")
"""
# the INFO level should have the "Information" (U+2139) emoji but it doesn't seem to work in the next line
@jb68
jb68 / p10k_classic.omp.json
Created September 27, 2024 17:45 — forked from AnsonH/p10k_classic.omp.json
p10k_classic - Custom Oh My Posh theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "lightYellow",
"style": "plain",
@jb68
jb68 / jen_del_blds.groovy
Created August 23, 2019 20:29
Delete old builds in jenkins and last 5. This script needs to be exec in jenkins script console
def jobName = "aa"
def noOfJobsToKeep=5
def job = Jenkins.instance.getItem(jobName)
job.getBuilds().findAll { it.number < job.getBuilds().number.max() - noOfJobsToKeep }.each { it.delete() }
@jb68
jb68 / rpm-digital-signature.sh
Created September 6, 2018 23:58 — forked from fernandoaleman/rpm-digital-signature.sh
How to sign your custom RPM package with GPG key
# How to sign your custom RPM package with GPG key
# Step: 1
# Generate gpg key pair (public key and private key)
#
# You will be prompted with a series of questions about encryption.
# Simply select the default values presented. You will also be asked
# to create a Real Name, Email Address and Comment (comment optional).
#
# If you get the following response:
@jb68
jb68 / ThinkLight
Created November 6, 2017 23:26 — forked from vzaliva/ThinkLight
This script controll keyboard backlight on IBM ThinkPad X-series
#!/bin/bash
# Vadim Zaliva [email protected]
# based on https://gist.github.com/hadess/6847281
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@jb68
jb68 / user.py.diff
Last active April 27, 2025 06:02
freeipa user-add/remove/mod trigger a custom script
diff --git a/user.py b/user.py
index cb47cbb..6b9ff36 100644
--- a/user.py
+++ b/user.py
@@ -40,7 +40,7 @@ from ipalib import _, ngettext
from ipalib import output
from ipalib import x509
from ipaplatform.paths import paths
-from ipapython.ipautil import ipa_generate_password
+from ipapython.ipautil import ipa_generate_password, run
@jb68
jb68 / parse_yaml.sh
Created April 4, 2017 16:47 — forked from pkuczynski/LICENSE
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}