Skip to content

Instantly share code, notes, and snippets.

Gustavo Henrique gustavohenrique

View GitHub Profile

Configuring HTTPs proxy for local development

Add alias:

cat "" | sudo tee -a /etc/hosts

Create a Caddyfile


Instalar swatchdog:

$ sudo apt install swatch	hashtag#Ubuntu/Debian
$ sudo yum install epel-release && sudo yum install swatch	hashtag#RHEL/CentOS

Configuração do swatchdog: $ sudo vi .swatchrc

Cortar por posição de byte (2o byte):
$ echo 'baz' | cut -b 2
Cortar por posição de byte (1o e 2o bytes):
echo 'baz' | cut -b 1-2
Cortar por posição de byte (1o e 3o bytes):
$ echo 'baz' | cut -b 1,3
Cortar por posição de caracter (2o byte):
View css-media-queries-cheat-sheet.css
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
@media all and (min-width: 1025px) and (max-width: 1280px) {}
@media all and (min-width: 768px) and (max-width: 1024px) {}
@media all and (min-width: 480px) and (max-width: 768px) {}

Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You'll be asked for the content of the CSR file when ordering the certificate.

openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr

This gives you two files:

  • example_com.key -- your Private key. You'll need this later to configure ngxinx.
gustavohenrique /
Created Jun 13, 2018
Test external API using NodeJS


cat > package.json <<EOF
  "name": "test-api",
  "version": "0.1.0",
  "description": "It test the API",
  "main": "index.js",
  "scripts": {
gustavohenrique /
Created Apr 15, 2018
Run Kong API gateway and Konga in Docker
docker run -d --name kong --link postgres -e "KONG_DATABASE=postgres" -e "KONG_PG_HOST=postgres" -e "KONG_CASSANDRA_CONTACT_POINTS=postgres" -e KONG_PG_USER=admin -e KONG_PG_DATABASE=mydb -e KONG_PG_PASSWORD=password -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" -e "KONG_PROXY_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" -e "KONG_ADMIN_LISTEN=" -e "KONG_ADMIN_LISTEN_SSL=" -p 8000:8000 -p 8443:8443 -p 8001:8001 -p 8444:8444 kong:latest
docker run -p 1337:1337 --link kong --link postgres --name konga -e "NODE_ENV=production" -e "DB_ADAPTER=postgres" -e "DB_HOST=postgres" -e "DB_PORT=5432" -e "DB_USER=admin" -e "DB_PASSWORD=password" -e "DB_DATABASE=mydb" pantsel/konga
gustavohenrique /
Created Feb 12, 2018
running old linux distro using qemu
qemu-img create -f qcow2 hd.qcow2 5G
qemu-system-i386 -boot d -m 512 -hda $PWD/hd.qcow2 -cdrom $PWD/Conectiva6.0.iso -net nic,vlan=0 -net user,vlan=0 -localtime
qemu-kvm -m 16M -drive if=ide,format=qcow2,file=slackware.qcow2 \
-netdev user,id=slirp -device ne2k_isa,netdev=slirp \
-serial stdio -redir tcp:22122::22

add other apt repositories

wget -qO - | sudo apt-key add -
echo "deb apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] bionic stable"

wget -q -O - | sudo apt-key add -
gustavohenrique / reverse-proxy.go
Last active Nov 18, 2017
A snippet to create a reverse proxy using Go
View reverse-proxy.go
package main
import (
func main() {
You can’t perform that action at this time.