Skip to content

Instantly share code, notes, and snippets.

View Manzanit0's full-sized avatar

Javier García Manzanit0

View GitHub Profile
@Manzanit0
Manzanit0 / parse_receipt.py
Created June 26, 2024 14:03
Python script to parse receipts with Chat GPT
#!/usr/bin/python3
import base64
import requests
# OpenAI API Key
api_key = "<INSERT KEY HERE>"
# Function to encode the image
def encode_image(image_path):
@Manzanit0
Manzanit0 / main.go
Created May 6, 2024 16:10
Using secrets manager
package main
import (
"context"
"log"
"strings"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/secretsmanager"
@Manzanit0
Manzanit0 / how-to.md
Last active February 27, 2024 20:46
Using container-structure-test to check if image runs as root
@Manzanit0
Manzanit0 / main.go
Created February 27, 2023 09:25
Go: Wrap HTTP mux
package main
import (
"fmt"
"log"
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
)
@Manzanit0
Manzanit0 / gingko_subtests_test.go
Created February 22, 2023 09:23
Transcription of Ginkgo example with subtests
package gingko_subtests_test
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestCheckingBooksOutOfLibrary(t *testing.T) {
t.Run("when the library has the book in question", func(t *t.Testing) {
t.Run("if the book is available, it lends it to the reader", func(t *t.Testing) {
@Manzanit0
Manzanit0 / main.go
Created October 4, 2022 08:07
Go naive worker pool toy
package main
import (
"fmt"
"log"
"sync"
)
type Input struct {
Id string
@Manzanit0
Manzanit0 / cancel.go
Last active September 29, 2022 20:40
Understanding how cancellation works
package main
import (
"context"
"fmt"
"sync"
"time"
)
// simply runs a program to showcase how to properly leverage
@Manzanit0
Manzanit0 / main.go
Last active July 12, 2022 21:26
Go: Running a request through an SSH tunnel
package main
import (
"io"
"io/ioutil"
"log"
"net"
"net/http"
"golang.org/x/crypto/ssh"
@Manzanit0
Manzanit0 / notes.md
Created July 7, 2022 12:29
The Many Meanings of Event-Driven Architecture
@Manzanit0
Manzanit0 / child_rows_as_json.sql
Last active August 22, 2022 09:47
Random bits and bobs when learning MySQL
-- This is simply an example of how to get child records as JSON.
--
SELECT ii.id AS invoice_id,
JSON_PRETTY(JSON_OBJECT('items',
(
SELECT
CAST(CONCAT('[',
GROUP_CONCAT(JSON_OBJECT(
'id', li.id,
'name', li.name,