Skip to content

Instantly share code, notes, and snippets.

View pecigonzalo's full-sized avatar
🌊

Gonzalo Peci pecigonzalo

🌊
View GitHub Profile
@pecigonzalo
pecigonzalo / rds-undo.sh
Last active July 14, 2022 14:07
Undo pending RDS changes
#!/usr/bin/env bash
set -euo pipefail
NAME="$1"
description=$(aws rds describe-db-instances --db-instance-identifier "$NAME")
instance_type=$(echo $description | jq -r '.DBInstances[0] | .DBInstanceClass')
allocated_storage=$(echo $description | jq -r '.DBInstances[0] | .AllocatedStorage')
@pecigonzalo
pecigonzalo / bootstrap.sh
Created January 9, 2022 16:38 — forked from pahud/bootstrap.sh
AWS SSO + Codespaces
#!/bin/bash
# video demo - https://www.youtube.com/watch?v=Y8TyE_DNds8
mkdir ~/.tmp && cd $_
# install aws-cli v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
sudo ./aws/install
@pecigonzalo
pecigonzalo / bootstrap.sh
Created January 9, 2022 16:37 — forked from pahud/bootstrap.sh
AWS SSO + Codespaces
#!/bin/bash
# video demo - https://www.youtube.com/watch?v=Y8TyE_DNds8
mkdir ~/.tmp && cd $_
# install aws-cli v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
sudo ./aws/install
@pecigonzalo
pecigonzalo / change.sh
Created December 20, 2021 08:22
Run command in folders
#!/usr/bin/env bash
set -euo pipefail
for repo in $(fd --type=directory -d 1); do
pushd $repo
${@:1:1} "${@:2}"
popd
done
@pecigonzalo
pecigonzalo / flake-direnv.md
Created December 7, 2021 14:49 — forked from inscapist/flake-direnv.md
Nix Flakes and Direnv on Mac OSX (Catalina)

Development environment with Nix Flakes and Direnv

This document is targeted at those who seek to build reproducible dev environment across machines, OS, and time.

It maybe easier for remote teams to work together and not spending hours each person setting up asdf/pyenv/rbenv, LSP servers, linters, runtime/libs. Nix is probably the closest thing to Docker in terms of development environment.

Flake is used here because it provides hermetic build, with absolutely no reliance on system environment (be it Arch/Catalina/Mojave). Also it freezes dependencies in flake.lock so builds are reproducible.

This gist provides the setup to develop Java/Clojure/Python applications on Nix. But it can be easily adapted to ruby, nodejs, haskell.

@pecigonzalo
pecigonzalo / cdktf-get-bug
Created August 13, 2021 15:29
cdktf-get-m1
❯ cdktf get
⠇ downloading and generating modules and providers...
[2021-08-13T17:27:28.177] [ERROR] default - ╷
│ Error: Incompatible provider version
│ Provider registry.terraform.io/terraform-providers/docker v2.7.2 does not
│ have a package available for your current platform, darwin_arm64.
│ Provider releases are separate from Terraform CLI releases, so not all
│ providers are available for all platforms. Other versions of this provider
@pecigonzalo
pecigonzalo / App.kt
Created August 5, 2021 12:12
Kotlin Kinesis Producer
package app
import com.amazonaws.auth.AWSStaticCredentialsProvider
import com.amazonaws.auth.BasicSessionCredentials
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain
import com.amazonaws.services.kinesis.producer.KinesisProducer
import com.amazonaws.services.kinesis.producer.KinesisProducerConfiguration
import com.amazonaws.services.kinesis.producer.UnexpectedMessageException
import com.amazonaws.services.kinesis.producer.UserRecordFailedException
import com.amazonaws.services.kinesis.producer.UserRecordResult
### Keybase proof
I hereby claim:
* I am pecigonzalo on github.
* I am pecigonzalo (https://keybase.io/pecigonzalo) on keybase.
* I have a public key ASAWep_KXMkGiW-rNCDkOZnWoaNZq589Tbg1w5oL65JC3go
To claim this, I am signing this object:
@pecigonzalo
pecigonzalo / effective-fsharp.md
Created April 16, 2021 12:44 — forked from swlaschin/effective-fsharp.md
Effective F#, tips and tricks

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges

@pecigonzalo
pecigonzalo / ofms.md
Created April 13, 2021 16:07 — forked from taion809/ofms.md
Observable F# Microservices

Observable FSharp Microservices (dotnetcore2.2+)

Let us define an observable microservice as one that exposes its internal state through events, metrics, and trace data. Ideally we can aggregate this data in some sort of centralized observability system for alerting and diagnostics. In my opinion there are tools that work much better than others and I will use those in this example but the most important part is that you have a starting point and your services can be observed and alerted on somehow. If your company does not have the means to setup all of this infrastructure you should consider buying one of the many SaaS options out today.

Disclaimer: I am not a native .net or F# developer, I think at this point in my career I've logged 2 weeks on an F# dev team so the implementations given below may not be idiomatic, however, my experience comes from being apart of both Devops and microservices dev teams in other teams and organizations.

That being said; let's start building an "observable" micro