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 gjreasoner/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 / 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 / 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 / Multiple Deploy Keys in GitHub.md
Created February 16, 2020 17:04 — forked from mcnamee/Multiple Deploy Keys in GitHub.md
Using multiple GitHub deploy keys on a single server with a single user

Using multiple GitHub deploy keys on a single server with a single user

Within GitHub it is possible to set up two types of SSH key - account level SSH keys and and repository level SSH keys. These repository level SSH keys are known in GitHub as deploy keys.

Deploy keys are useful for deploying code because they do not rely on an individual user account, which is susceptible to change, to “store” the server keys.

There is, however, an ‘issue’ with using deploy keys; each key across all repositories on GitHub must be unique. No one key can be used more than once. This becomes a problem when deploying to repositories to the same server with the same user. If you create two keys, the SSH client will not know which key to use when connecting to GitHub.

One solution is to use an SSH config file to define which key to use in which situation. This isn’t as easy as it seems.. you might try something like this:

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
@diogopms
diogopms / github-contributions-webtask.js
Created December 21, 2018 21:55 — forked from jstrutz/github-contributions-webtask.js
Webtask.io Github Contribution Data API-ification! 🤘
"use latest";
/*
* A webtask.io little hack to scrape the github contributions data, and present it in some usable JSON
*
* Setup:
* - Download this file
* - Setup a webtask.io account
* - Upload to webtask.io with something like:
* wt create --name github-contributions github-contributions-webtask.js
@diogopms
diogopms / tmux-cheatsheet.markdown
Created February 11, 2017 14:03 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname