Skip to content

Instantly share code, notes, and snippets.

View diogopms's full-sized avatar
Working from home (🇵🇹)

Diogo Serrano diogopms

Working from home (🇵🇹)
View GitHub Profile
diogopms /
Created May 2, 2022 19:11 — forked from gjreasoner/
Expand Ubuntu 20 Proxmox Disk
# Resize the file system in UI, under VM -> Hardware -> Click on the disk to resize, click "Resize disk" button

# Confirm increase in disk space (1TB in my case)
$ lsblk
sda                         8:0    0    1T  0 disk
├─sda1                      8:1    0    1M  0 part
├─sda2                      8:2    0    1G  0 part /boot
└─sda3                      8:3    0    1T  0 part
diogopms /
Last active December 31, 2021 13:57
Homelab planning

Homelab planning

Olá :)

ALGUÉM já fez o planeamento da eletricidade de uma CASA de origem ou com obras qual são as dicas que fizeram para o Prewire de uma casa com CAT6 (alarme com cabos network, tablets na parede, HDMI over Ethernet, cat6 no tecto para app, bastidor na garagem, homeassistant, shelly). Eu tenho alguns requisitos mas gostava de saber a vossa opinião especialmente na parte de HDMI over ehternet.

Eu vou tentar centralizar tudo num documento, mas a ideia era seria se ganhares o "euromilhões"

diogopms / list-constraints.sql
Created December 15, 2021 13:04 — forked from PickledDragon/list-constraints.sql
Postgres list all constraints
tc.constraint_name, tc.table_name, kcu.column_name,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
information_schema.table_constraints AS tc
JOIN information_schema.key_column_usage AS kcu
ON tc.constraint_name = kcu.constraint_name
JOIN information_schema.constraint_column_usage AS ccu
ON ccu.constraint_name = tc.constraint_name
diogopms /
Created October 6, 2021 19:42
Homebrew: Install an older version of a formula

Homebrew: Install an older version of a formula

kubernetes-cli (v1.10.3) taken as example

  1. Downgrade Homebrew to the commit which upgrades the formula to the specific version that we want
$ cd "$(brew --repo homebrew/core)"
$ git log Formula/kubernetes-cli.rb

diogopms / gist:28d66c10de0e92a5cc20223bb89fde7d
Created February 25, 2021 19:41 — forked from nosuchuser/gist:3a67d06bb054273ef390d4a2ed4a5d89
Configuração Vodafone FTTH / pihole
1. Configurar IPv4 estático e IPv6 estático no pihole (YMMV) e 2001:818:xxxx::192:168:1:2 no meu caso
2. Configurar DNS uplink do pihole igual ao IP do Router (
3. Configurar Router
Huawei HS8247W (Smart Router 2)
1. Configurações Avançadas -> LAN -> Configuração de DHCP
Servidor DNS Primário:
diogopms /
Created February 4, 2021 07:53 — forked from qdm12/
Wireguard and iptables restrictions for multiple users

Wireguard and iptables restrictions for multiple users

If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.


This should fit most setups (not mine though 😉)

diogopms /
Created January 28, 2021 12:27
delete all data from glacier
#!/usr/bin/env bash
if [[ -z ${AWS_ACCOUNT_ID} ]] || [[ -z ${AWS_REGION} ]] || [[ -z ${AWS_VAULT_NAME} ]]; then
echo "Please set the following environment variables: "
diogopms /
Created November 25, 2020 07:51 — forked from veuncent/
Delete all archives in an AWS Vault

AWS Glacier: Delete vault

Follow these steps to remove all archives from an AWS vault. After this is finished, you will be able to delete the vault itself through the browser console.

Step 1 / Retrieve inventory

This will create a job that collects required information about the vault.

$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME 
diogopms / docker-compose.yml
Created October 7, 2020 12:10
unify-controller with traefik
version: "3.7"
image: linuxserver/unifi-controller:5.14.23-ls76
container_name: unifi-controller
- PUID=1000
- PGID=1000
- TZ="Europe/Lisbon"
diogopms / traefik_docker-compose.yaml
Last active June 9, 2020 11:37
Traefik ptg - docker
version: "3.7"
restart: always
image: "traefik:latest"
container_name: "traefik"
hostname: "traefik"
- "80:80"