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
diogopms / README.md
Created May 2, 2022 19:11 — forked from gjrdiesel/README.md
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
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
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
diogopms / homelab-planning.md
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
diogopms / list-constraints.sql
Created December 15, 2021 13:04 — forked from PickledDragon/list-constraints.sql
Postgres list all constraints
SELECT
tc.constraint_name, tc.table_name, kcu.column_name,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM
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
diogopms / homebrew-install-older-version.md
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
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)
192.168.1.2 e 2001:818:xxxx::192:168:1:2 no meu caso
2. Configurar DNS uplink do pihole igual ao IP do Router (192.168.1.1)
3. Configurar Router
Huawei HS8247W (Smart Router 2)
1. Configurações Avançadas -> LAN -> Configuração de DHCP
Servidor DNS Primário: 192.168.1.2
@diogopms
diogopms / README.md
Created February 4, 2021 07:53 — forked from qdm12/README.md
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.

Assumptions

This should fit most setups (not mine though 😉)

@diogopms
diogopms / delete-data-glacier.sh
Created January 28, 2021 12:27
delete all data from glacier
#!/usr/bin/env bash
file='./output.json'
id_file='./output-archive-ids.txt'
if [[ -z ${AWS_ACCOUNT_ID} ]] || [[ -z ${AWS_REGION} ]] || [[ -z ${AWS_VAULT_NAME} ]]; then
echo "Please set the following environment variables: "
echo "AWS_ACCOUNT_ID"
echo "AWS_REGION"
echo "AWS_VAULT_NAME"
@diogopms
diogopms / aws_glacier_delete_vault.md
Created November 25, 2020 07:51 — forked from veuncent/aws_glacier_delete_vault.md
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
diogopms / docker-compose.yml
Created October 7, 2020 12:10
unify-controller with traefik
version: "3.7"
services:
unifi-controller:
image: linuxserver/unifi-controller:5.14.23-ls76
container_name: unifi-controller
environment:
- PUID=1000
- PGID=1000
- TZ="Europe/Lisbon"
volumes:
@diogopms
diogopms / traefik_docker-compose.yaml
Last active June 9, 2020 11:37
Traefik ptg - docker
version: "3.7"
services:
traefik:
restart: always
image: "traefik:latest"
container_name: "traefik"
hostname: "traefik"
ports:
- "80:80"