Skip to content

Instantly share code, notes, and snippets.

View franciscocpg's full-sized avatar

Francisco Guimarães (chico) franciscocpg

View GitHub Profile
@franciscocpg
franciscocpg / README.md
Last active January 3, 2026 22:11
Import mitm certificate to CA in arch linux
  1. After installing mitmproxy run it (just type mitmproxy) in a terminal session and quit. This will create the necessaries certificates files at ~/.mitmproxy.

  2. Extract the certificate to .crt format:
    openssl x509 -in ~/.mitmproxy/mitmproxy-ca.pem -inform PEM -out ca.crt

  3. Trust the certificate into CA:
    sudo trust anchor ca.crt

  4. Run the mitmproxy again

@franciscocpg
franciscocpg / dns-flush.sh
Created September 21, 2018 18:42
Arch Linux - Force DNS flush
sudo nscd -K
@franciscocpg
franciscocpg / main.go
Created August 24, 2018 12:23
List github organization repositories
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
)
@franciscocpg
franciscocpg / sleep.js
Created May 29, 2018 19:54 — forked from yentsun/sleep.js
ES6 Sleep
const sleep = require('util').promisify(setTimeout);
//...
await sleep(15);
//...
[Unit]
Description=aws-rotate-key service
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
# Wait for connection during 10 seconds before giving up
ExecStart=/usr/bin/sh -c 'let try=1; until nc -z sts.amazonaws.com 443; do sleep 1; let "try+=1"; if [ $try -gt 10 ]; then exit 1; fi; done; /usr/local/bin/aws-rotate-key -profile ${AWS_PROFILE} -y'
@franciscocpg
franciscocpg / install-reflector-timer.sh
Last active March 20, 2018 12:06
Make sure pacman is using sync mirrors (in Brazil)
yaourt -S --noconfirm reflector-timer
sudo sh -c 'curl -s https://gist.githubusercontent.com/franciscocpg/98c405cc1867c050e7f12df052d9ec5a/raw/reflector.conf > /etc/conf.d/reflector.conf'
sudo systemctl enable --now reflector.timer
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/apex/log"
packages = [
".",
"handlers/memory",
"handlers/text"
]
@franciscocpg
franciscocpg / README.md
Created February 9, 2018 18:37
My regex list (examples using javascript)

AWS s3 filename

const regex = /((?!([0-9a-zA-Z!\-\_\.\*'\(\)])).)/g;

const 
s = '1;çççç~~~~123-aãbc';

console.log(s.replace(new RegExp(regex), ''))

"1123-abc"
@franciscocpg
franciscocpg / README.md
Created September 14, 2017 11:59
gpg pinentry console mode

To change the pinentry permanently, append the following to your ~/.gnupg/gpg-agent.conf: pinentry-program /usr/bin/pinentry-tty

Then kill agent: pkill gpg-agent

@franciscocpg
franciscocpg / README.md
Last active October 15, 2021 07:09
Export/import gpg key

Export

gpg --output mygpgkey_pub.gpg --armor --export mail@mail.com
gpg --output mygpgkey_sec.gpg --armor --export-secret-key mail@mail.com

Import

gpg --import mygpgkey_pub.gpg
gpg --allow-secret-key-import --import mygpgkey_sec.gpg