Skip to content

Instantly share code, notes, and snippets.

View Manzanit0's full-sized avatar

Javier García Manzanit0

View GitHub Profile
@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,
@Manzanit0
Manzanit0 / .ideavimrc
Created April 21, 2022 14:53
Idea Vim Config
# Sources:
# https://gist.github.com/zchee/9c78f91cc5ad771c1f5d
# https://github.com/JetBrains/ideavim
let mapleader=";"
nnoremap <Leader>nc :e ~/.ideavimrc<CR>
nnoremap <Leader>nr :action IdeaVim.ReloadVimRc.reload<CR>
nnoremap <Leader>q :q<CR>
@Manzanit0
Manzanit0 / notes.md
Last active April 19, 2022 15:51
REST: I don't Think it Means What You Think it Does

REST: I don't Think it Means What You Think it Does

Talk: https://www.youtube.com/watch?v=pspy1H6A3FM

Def: An architectural style defined by the constraints Client-Server, Stateless Communications, Cachin, Uniform Interface, Layered System and (optionally) Code-on-demand.

Rest is perfectly defined. There is a set of rules that define it. If you follow them, it's REST, if not, then it's not.