Skip to content

Instantly share code, notes, and snippets.

View snhrdt's full-sized avatar
🏠
Working from home

Martin Eisenhardt snhrdt

🏠
Working from home
  • infogralis
  • Switzerland
View GitHub Profile
@snhrdt
snhrdt / bcrypt_hash_pw.py
Created March 20, 2024 19:24
bcrypt_hash_pw.py
import getpass
import bcrypt
password = getpass.getpass("password: ")
hashed_password = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt())
print(hashed_password.decode())
@snhrdt
snhrdt / gist:b7551f08800646bf862972db44264990
Created October 27, 2023 21:54 — forked from ShipkaChalk/gist:629fdc42dad781776d2007fc502188f3
Plex Hetzner workaround using Docker.

Hey, here is how you can route all plex traffic via wireguard out of another VPS, this can be used for any container but was inspired by the recent Hetzner block Plex put in place.

And no not all of us are using it for nefarious means, sometimes people don't have room for a home server.

Why docker? I prefer it as it keeps items separated and cleaned. It also allows for quickly moving configurations around from server to server if need be.

  1. Get yourself a VPS
  2. Install docker
  3. Create this docker-compose.yml
@snhrdt
snhrdt / zfs_cleanup.sh
Created November 5, 2019 10:25 — forked from jstutters/zfs_cleanup.sh
Find and delete multiple ZFS snapshots
zfs list -t snapshot -H -o name | grep "201509[0-9].*" | xargs -n1 echo
# zfs list -t snapshot -H -o name | grep "201509[0-9].*" | xargs -n1 zfs destroy
@snhrdt
snhrdt / slack.sh
Created November 4, 2019 14:16 — forked from andkirby/slack.sh
Shell/Bash script for sending slack messages.
#!/usr/bin/env bash
####################################################################################
# Slack Bash console script for sending messages.
####################################################################################
# Installation
# $ curl -s https://gist.github.com/andkirby/67a774513215d7ba06384186dd441d9e/raw --output /usr/bin/slack
# $ chmod +x /usr/bin/slack
####################################################################################
# USAGE
# Send message to slack channel/user
---
- name: Set root password
hosts: all
become: yes
become_method: sudo
become_user: root
tasks:
- name: Set root password
shell: echo -e "naaSOQcSzkBxSFS4nBefN7yg4\nnaaSOQcSzkBxSFS4nBefN7yg4" | passwd
@snhrdt
snhrdt / whats-my-folder.sh
Created July 19, 2019 13:41
Determine folder of running bash script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
@snhrdt
snhrdt / drop-all-tables.sql
Created July 19, 2019 13:27
How to drop all tables (Postgres)
select 'drop table if exists "' || tablename || '" cascade;'
from pg_tables
where schemaname = 'public';
@snhrdt
snhrdt / insert-random-strings-into-postgres.sql
Created July 17, 2019 10:40
How to insert random strings into Postgres
INSERT INTO messages
SELECT (SELECT
string_agg(chr(floor(random() * 26)::int + 65), '')
FROM generate_series(1,10000))
FROM generate_series(1,10);
@snhrdt
snhrdt / GreetingUtil.java
Last active December 15, 2015 12:39
Hello world for Octopress
package example;
public class GreetingUtil {
public static final String getGreeting() {
return "Hello, world!";
}
}