Skip to content

Instantly share code, notes, and snippets.

View jeffersfp's full-sized avatar

Jefferson Pires jeffersfp

  • São Paulo, Brazil
  • 19:22 (UTC -03:00)
View GitHub Profile

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@jeffersfp
jeffersfp / docker-compose.yml
Created August 25, 2023 16:28 — forked from marcelo-ochoa/docker-compose.yml
Traefik plus Portainer stack
version: "3.6"
services:
whoami:
image: traefik/whoami:v1.6.0
deploy:
mode: replicated
replicas: 1
labels:
- traefik.enable=true
@jeffersfp
jeffersfp / Quirks of C.md
Created August 10, 2023 18:55 — forked from jdmonty/Quirks of C.md
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@jeffersfp
jeffersfp / wsl-cheatsheet.ps1
Created September 14, 2022 22:05 — forked from karthiks/wsl-cheatsheet.ps1
WSL 2 CLI Cheat-sheet To Be Run In Powershell
# To list installed distributions
wsl -l
wsl --list
# To list installed distributions along with its running status and wsl config being 1 or 2
wsl -l --verbose
wsl -l -v
# To run a specific distro
wsl -d distro_name
@jeffersfp
jeffersfp / kafka-del-topics.sh
Created January 31, 2022 14:50 — forked from hartfordfive/kafka-del-topics.sh
Script to delete all kafka topics on a given cluster
#!/bin/bash
TOPICS=$(kafka-topics --zookeeper [ZK_IP]:2181/kafka --list )
for T in $TOPICS
do
if [ "$T" != "__consumer_offsets" ]; then
kafka-topics --zookeeper [ZK_IP]:2181/kafka --delete --topic $T
fi
done
@jeffersfp
jeffersfp / gpg-import-and-export-instructions.md
Created May 7, 2020 19:41 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@jeffersfp
jeffersfp / config.ini
Created February 10, 2020 14:57 — forked from tsuriga/config.ini
Simple config file validation in python
[DEFAULT]
; Operation mode
; This is a global value for all sections
mode = master
[server]
; Connection lifetime
timeout = 3600
@jeffersfp
jeffersfp / README.md
Last active August 5, 2020 16:18 — forked from erichrobinson/README.md
SwitchResX Configuration

SwitchResX Settings for LG 21:9 UltraWide

SwitchResX is a utility that allows users to override the default resolution settings in OSX. For more information, including download links, vist http://www.madrau.com/ .

Disabling System Integrity Protection (SIP)

If you are running OSX 10.11 or higher, SIP must be disabled. To disable SIP do the following:

  • Boot into the recovery partition by pressing CMD + R when starting up your Mac.
  • Once in recovery mode, open a terminal window.
  • Type the command csrutil disable
@jeffersfp
jeffersfp / README.md
Last active July 3, 2018 12:08 — forked from mayorova/README.md
Mutual SSL in NGINX

Securing traffic to upstream servers with client certificates

Info: https://www.nginx.com/resources/admin-guide/nginx-https-upstreams/

Creating and Signing Your Certs

Source: http://nategood.com/client-side-certificate-authentication-in-ngi

This is SSL, so you'll need an cert-key pair for you/the server, the api users/the client and a CA pair. You will be the CA in this case (usually a role played by VeriSign, thawte, GoDaddy, etc.), signing your client's certs. There are plenty of tutorials out there on creating and signing certificates, so I'll leave the details on this to someone else and just quickly show a sample here to give a complete tutorial. NOTE: This is just a quick sample of creating certs and not intended for production.