Skip to content

Instantly share code, notes, and snippets.

View eduardofcgo's full-sized avatar
⛷️

Eduardo Gonçalves eduardofcgo

⛷️
View GitHub Profile
@eduardofcgo
eduardofcgo / settings.json
Created January 3, 2025 22:19
VS Code Settings
{
"window.commandCenter": 1,
"editor.fontSize": 15,
"editor.fontFamily": "'JetBrains Mono', 'monospace', monospace",
"editor.lineHeight": 1.7,
"editor.tabSize": 2,
"workbench.colorTheme": "Default Dark Modern",
"editor.fontLigatures": true,
"editor.stickyScroll.enabled": false,
"editor.bracketPairColorization.enabled": false,
@eduardofcgo
eduardofcgo / tracking_params.txt
Created May 13, 2024 23:27
tracking url parameters
cm_mmca1
mi_ecmp
ss_campaign_sent_date
hsa_ad
utm_emcid
oft_ids
ysclid
ml_sub
hsa_src
ir_partnerid
@eduardofcgo
eduardofcgo / rollout.sh
Last active April 15, 2024 23:29
Rolling updates, zero downtime with just nginx and docker compose
#!/bin/bash
set -e
docker-compose build
echo Update only secondary on 3333
docker-compose up -d cooked_secondary
echo Wait until secondary is live
curl --silent --include --retry-connrefused --retry 30 --retry-delay 1 --fail http://localhost:3333/health.txt
@eduardofcgo
eduardofcgo / s3client.clj
Last active May 14, 2024 04:29
aws s3 sdk v2 for s3 compatible providers
(defn create-client []
(-> (S3Client/builder)
(.credentialsProvider
(StaticCredentialsProvider/create
(AwsBasicCredentials/create access-key secret-key)))
(.region (Region/of region))
(.endpointOverride (URI/create endpoint))
(.build)))
@eduardofcgo
eduardofcgo / espresso.md
Last active November 6, 2023 19:00
Intuition for espresso recipes

Variables that make up the espresso puck

  • Coffee bean solubility (roast level / altitude grown / type of bean)
  • Coffee dose / Head space
  • Grind size
  • Uniformity (puck preparation)
  • Tamp pressure

What makes an espresso

  • All these variables must yield a puck that in contact with water creates some "integrity" - this integrity creates the resistance to water necessary for extraction under pressure.
  • Integrity always increases with these variables.
@eduardofcgo
eduardofcgo / store.clj
Created January 9, 2023 13:02
Serialize ring session store into a jdbc compatible database, sqlite...
(ns ll.session.store
(:require
[taoensso.nippy :as nippy]
[clojure.java.jdbc :as jdbc]
[ring.middleware.session.store :refer [SessionStore]]))
(def serialize nippy/freeze)
(defn deserialize [session]
@eduardofcgo
eduardofcgo / faturas.py
Last active September 5, 2022 02:23
Mapa de impostos a partir do e-fatura
import requests
import logging
import json
import sqlite3
import math
search_params = {
"dataInicioFilter": "2022-06-01",
"dataFimFilter": "2022-08-31",
@eduardofcgo
eduardofcgo / nif.py
Last active May 26, 2022 02:39
validar nifs portugueses
import re
def _convert_to_int_list(nif_str):
return list(map(int, nif_str))
def _check_len(nif):
return len(nif) == 9
@eduardofcgo
eduardofcgo / cached_iterator.py
Created November 23, 2021 04:48
cached iterator python
from collections.abc import Iterator
class _CachedIterator(Iterator):
def __init__(self, iterator):
self.iterator = iterator
self.cache = []
self.cached = False
def __iter__(self):
@eduardofcgo
eduardofcgo / rtp-download.js
Last active May 9, 2021 11:38
download rtp play
console.log(`youtube-dl -f mp4 https://streaming-ondemand.rtp.pt${player1.fileKey.split(".mp4")[0]}/master.mpd -o "${document.title}.mp4"`)