Skip to content

Instantly share code, notes, and snippets.

@GusAntoniassi
GusAntoniassi / README.md
Last active July 17, 2024 10:15
Configure autocompletion to kubectl with zsh

kubectl with ZSH (oh-my-zsh)

How to configure

Use the following commands to add the kubectl autocomplete to zsh:

mkdir -p ~/.oh-my-zsh/custom/plugins/kubectl-autocomplete/
kubectl completion zsh > ~/.oh-my-zsh/custom/plugins/kubectl-autocomplete/kubectl-autocomplete.plugin.zsh
@GusAntoniassi
GusAntoniassi / README.md
Last active July 12, 2024 14:53
How to install Hashicorp Nomad on aarch64 Alpine Linux (Moto G6 / PostmarketOS)

How to install Hashicorp Nomad on aarch64 Alpine Linux (Moto G6 / PostmarketOS)

Since as of now there is no binary release for Hashicorp Nomad in aarch64, we'll have to compile it from scratch.

PostmarketOS configuration

As of now, the mainline kernel that motorola-ali uses comes with a couple of netfilter extensions disabled, and we'll have to enable them for the CNI plugins that Nomad uses.

Edit the kernel kconfig with:

@GusAntoniassi
GusAntoniassi / README.md
Last active July 12, 2024 12:14
Moto G6 PostmarketOS initial configuration

How to configure Moto G6 with PostmarketOS

Note: This guide assumes your phone is already unlocked, and you have some experience running fastboot and Linux commands.

Flashing instructions

Note: if you plan to run Hashicorp Nomad or something else that uses a container networking interface, you'll probably need to enable some kernel modules. See these instructions to do it before you configure Wi-Fi to avoid having to do it twice.

Install pmbootstrap

@GusAntoniassi
GusAntoniassi / README.md
Created May 14, 2020 00:50
Play audio files on your microphone with ffmpeg

play-audio-mic.sh

This script was adapted to allow you to play audio files through your microphone input. It does so by creating a virtual microphone and piping an audio file to it.

The work was mostly done in this StackOverflow answer, I just adapted it to use ffmpeg and add a trap to cleanup on exit.

Requirements:

  • ffmpeg
  • Bash
  • PulseAudio/pactl
@GusAntoniassi
GusAntoniassi / README.md
Created October 6, 2020 21:16
Terraform external data provider - Shell script with input without jq

This is an example workaround for getting Terraform input variables when you won't have jq available in the executing machine.

Uses sed to parse the input JSON to extract a certain key from the input JSON.

Warning: this hasn't really been well-tested, it will pretty much work only with string values and will likely break for strings that have quotes. Might give you an idea of how to improve it for your implementation though.

@GusAntoniassi
GusAntoniassi / README.md
Created May 25, 2020 13:50
AWS CloudFormation Nested Stack bucket policy

This S3 bucket policy allows CloudFormation to read your Nested Stack template without making it public for everyone.

Policy JSON:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowCloudformationAccessBucket",
 "Effect": "Allow",
@GusAntoniassi
GusAntoniassi / etc-securetty
Created July 3, 2020 12:45
/etc/securetty
# /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).
console
# Local X displays (allows empty passwords with pam_unix's nullok_secure)
:0
:0.0
:0.1
:1
@GusAntoniassi
GusAntoniassi / README.md
Last active June 5, 2020 15:43
AWS Well Architected Framework - Anotações

AWS Well Architected Framework

O que é?

  • Melhores práticas pra utilização da AWS
  • Princípios, melhores práticas e questões
  • Pensado pelos SA em contato com os clientes
  • Como você está usando os serviços da AWS?
  • Se o alicerce não está sólido, o prédio inteiro pode ser comprometido