Skip to content

Instantly share code, notes, and snippets.

View ethicnology's full-sized avatar
🐧
🧅

J. Azad EMERY ethicnology

🐧
🧅
View GitHub Profile
@ethicnology
ethicnology / ssh-over-tor.md
Last active April 18, 2025 10:57
SSH over TOR

SSH over TOR

server

install tor

sudo apt install tor

edit /etc/tor/torrc

HiddenServiceDir /var/lib/tor/sshd/
@ethicnology
ethicnology / ssh-user.md
Last active June 3, 2023 06:08
New linux user with SSH
NewUser=winston
sudo useradd $NewUser --create-home
sudo mkdir /home/$NewUser/.ssh
sudo touch  /home/$NewUser/.ssh/authorized_keys
sudo chown -R $NewUser:$NewUser /home/$NewUser/.ssh
sudo chmod 700 /home/$NewUser/.ssh
sudo chmod 600 /home/$NewUser/.ssh/authorized_keys
@ethicnology
ethicnology / 01-bonds.yaml
Created June 3, 2023 07:20
Netplan two-port Ethernet link with round-robin fault tolerance and load balancing
# based on: https://www.hughesportal.com/blog.php?article=setup-network-bonding-using-netplan
network:
version: 2
ethernets:
enp2s0f0:
dhcp4: no
dhcp6: no
enp2s0f1:
dhcp4: no
dhcp6: no
@ethicnology
ethicnology / S01E01_why.md
Created February 6, 2024 02:28
S01E01 why: Golang –> SQL, JSON, postgres

S01E01 Why ?

  • Why golang sql and sqlx libraries can't parse array_agg ?

  • Why golang json library parse [null] as a struct with default values (int = 0, string = "") instead of an error or an empty array ?

  • Why postgres COALESCE(jsonb_agg(DISTINCT to_jsonb(ti)), '[]') still returns [null] instead of [] ?
    I want to add FILTER…

As always:

@ethicnology
ethicnology / osm-toilets.md
Last active June 1, 2024 18:55
Extracts all toilets from Open Street Map

Download the whole planet dataset (~80 Gb)

curl -OL https://planet.openstreetmap.org/pbf/planet-latest.osm.pbf

Using osmium tool filter amenity=toilets nodes

osmium tags-filter planet-latest.osm.pbf n/amenity=toilets -o toilets.osm
@ethicnology
ethicnology / supabase.md
Created August 4, 2024 20:03
I like supabase but they don't care so much about self-hosted users.

Supabase self-hosted

Setup

Clone docker repository ONLY

mkdir supabase-for-my-app && cd "$_"

git clone -n --depth=1 --filter=tree:0 https://github.com/supabase/supabase .
@ethicnology
ethicnology / pg_backup.sh
Created September 4, 2024 01:31
Backup selected (or all) schema from your postgres database
#!/bin/bash
# Configuration
DB_HOST=""
DB_PORT=""
DB_NAME=""
DB_USER=""
DB_PASS=""
DIR=""
DATE=$(date +"%Y%m%d_%H%M%S")