Skip to content

Instantly share code, notes, and snippets.

@andreswebs
andreswebs / keybase.md
Created January 25, 2019 12:16
Keybase identity proof

Keybase proof

I hereby claim:

  • I am andreswebs on github.
  • I am andreswebs (https://keybase.io/andreswebs) on keybase.
  • I have a public key ASCm8ZBq-D52q-dZgrnvSRd39CPb0LQe4qmDH0H6l5lyLAo

To claim this, I am signing this object:

import * as qs from "qs";
import { PathLike } from "fs";
export const apiConfig = {
returnRejectedPromiseOnError: true,
withCredentials: true,
timeout: 30000,
baseURL: "https://jsonplaceholder.typicode.com/",
headers: {
common: {
@andreswebs
andreswebs / golang-dockerfile-from-scratch.md
Created December 15, 2020 02:19
Example Dockerfile for a non-privileged Go application `FROM scratch`

Golang Dockerfile FROM scratch

FROM golang:alpine as builder
RUN \
  mkdir /build && \
  echo "app:x:10001:10001:app:/app:/bin/false" > /app-user && \
  echo "app:x:10001:" > /app-group
COPY src/* /build/
WORKDIR /build
@andreswebs
andreswebs / signal.go
Created December 15, 2020 10:42 — forked from reiki4040/signal.go
signal handling example for golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
)
func main() {
@andreswebs
andreswebs / eksctl-demo.md
Last active February 9, 2021 17:10
`eksctl` demo

eksctl demo

1. Download and install eksctl

#!/usr/bin/env bash

echo "Downloading ekstcl ..."
curl --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp
@andreswebs
andreswebs / aws_sso.py
Last active February 16, 2021 01:00 — forked from sgtoj/aws_sso.py
AWS SSO Credentials external process
#!/usr/bin/env python3
import json
import os
import sys
import hashlib
from configparser import ConfigParser
from datetime import datetime
from pathlib import Path

Github Two-Factor Authentication (2FA) for Brazil via SMS

The Github doesn't provide country code for Brazil (+55). To add this option, just run the code below in your console:


🇧🇷 [pt-BR]

Autenticação em dois fatores (2FA) do GitHub para o Brasil via SMS

@andreswebs
andreswebs / rdp-setup.md
Created April 17, 2021 14:48
RDP Setup for Ubuntu instance on AWS EC2

0. prerequisites

  • create an EC2 instance on AWS with an Ubuntu AMI.

  • allow ingress traffic on port 3389 on the instance security group (this will be used for RDP)

  • connect to it with SSH

  • run the commands below on the instance shell session

@andreswebs
andreswebs / aws_iam_secret_to_smtp_password.md
Created April 25, 2021 01:59 — forked from damusix/aws_iam_secret_to_smtp_password.md
Convert AWS IAM credentials to AWS SMTP credentials

Convert AWS IAM credentials to AWS SMTP credentials

If you do, or want to, use AWS to deploy your apps, you will end up using AWS SES via SMTP when you're launching an app that sends out emails of any kind (user registrations, email notifications, etc). For example, I have used this configuration on various Ruby on Rails apps, however, it is just basic SMTP configurations and crosses over to any framework that supports SMTP sendmail.

There are two ways to go about this:

Luckily, you found this MD file and the NOT SO EASY WAY is suddenly copy-pasta... sudo yum....

@andreswebs
andreswebs / import-tsv-sqlite.md
Created May 8, 2021 14:11
How to import a TSV file into a SQLite database

How to import a TSV file into a SQLite database

Example:

.mode tabs
.import data.tsv my-table

If the TSV file contains a header row, SQLite will create the table.