Skip to content

Instantly share code, notes, and snippets.

View gusalbukrk's full-sized avatar

Gustavo Albuquerque gusalbukrk

View GitHub Profile
@gusalbukrk
gusalbukrk / iteration-async.md
Last active April 29, 2023 01:32
#async #await #iteration #loop

async/await in loops & iterative functions

loops vs forEach

  • loops (for, for...of, while) work as expected
  • but the async code in the forEach callbacks (and any sync code after the first async code) will only be executed after all of the synchronous code and they will start in parallel — not in sequence — which means the order in each they resolve is undetermined

for loop

@gusalbukrk
gusalbukrk / idb.html
Last active March 31, 2023 03:28
#indexedDB #idb
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>idb example</title>
</head>
<body>
<h1>idb example</h1>
@gusalbukrk
gusalbukrk / defaults.md
Last active March 19, 2023 00:16
#js #objects

2 ways to set default values for function parameters that're objects

1st - destructuring with default values

function f1(
  { a = 3, b = true, c = 'foo' } = {}
) {
  console.log(a, b, c);
}

data query language (DQL)

  • SELECT

data definition language (DDL)

  • CREATE
  • ALTER
  • DROP
  • TRUNCATE
@gusalbukrk
gusalbukrk / debian.md
Last active January 27, 2023 15:03
#debian

Choosing Debian image

I Used Debian 11 Bullseye for a Month - An Arch Linux User's Perspective: discussion about Debian download pages navigation

  • choosing the correct Debian image isn't as straightforward as many distros because its site has a large quantity of download options and a confusing interface
  • the better option is to use a amd64, live and non-free image
    • amd64 is for 64-bit processors — which is the most common architecture in modern pcs
    • live means you can run the OS without installing
      • live Debian images come in a specific flavor, which means you don't have the option to choose a flavor during installation (it's already defined by the image have you download)
  • non-free includes proprietary firmwares which are needed by some network and video adapters
@gusalbukrk
gusalbukrk / deployment.md
Last active September 23, 2024 00:31
#deploy
  • register domain on Namecheap
  • log into DigitalOcean and create a project
  • before creating a droplet, you must create a SSH key at settings
  • create a droplet inside the project created previously and select the SSH key created on the previous step as authentication method
  • update nameservers on Namecheap to set DigitalOcean as the DNS provider (instructions)
    • later you'll revert to use Namecheap as the DNS provider but for now you need to use DigitalOcean to issue the SSL certificate
  • access the droplet using ssh: ssh [email protected] (replace 137.184.12.128 with your droplet's ip)
  • initial server configuration
  • install docker on your server
  • [install docker compose on your server](https://www.digit
@gusalbukrk
gusalbukrk / email.md
Last active December 20, 2022 15:12
#email

Custom domain email address

  • receive emails: Namecheap offers free e-mail forwarding (instructions)
  • send emails: you need a SMTP server, for instance SMTP2GO
    • create a new account (you must use an email with custom domain therefore you need to have configured email forward on Namecheap) and then follow the instructions inside the SMTP2GO dashboard
@gusalbukrk
gusalbukrk / cheatsheet.md
Last active November 23, 2022 18:33
#kubernetes

namespaces

  • kubectl get namespaces, kubectl get ns
  • argument --all-namespaces = executa comando em todos os namespaces
  • argument --namespace, -n = seleciona um namespace especifico
    • esse argumento é util em comandos como esse minikube service que por padrão roda o comando no namaspace 'default'
  • kubectl create namespace namespace-name = cria um namespace

driver