Skip to content

Instantly share code, notes, and snippets.

@marcosinger
marcosinger / channel.go
Last active July 2, 2019 17:17
Channel example
package main
import (
"fmt"
"sync"
"log"
"net/http"
)
type Response struct {
@marcosinger
marcosinger / main.go
Created July 19, 2019 20:31
Example of "errgroup" package
package main
import (
"fmt"
"net/http"
"time"
"golang.org/x/sync/errgroup"
)
@marcosinger
marcosinger / completions-gswitch.fish
Created October 16, 2019 19:40
Fish helpers to handle with gcloud config
# ~/.config/completions/gswitch.fish
#
# creates a variable with the name of gcloud named configurations. Ex.:
#
# ~ glist
# NAME IS_ACTIVE ACCOUNT PROJECT
# aluminium False [email protected] aluminium-123
# nickel True [email protected] nickel-001
# zinc False [email protected] zinc-project
#
@marcosinger
marcosinger / helper.go
Created March 26, 2020 14:24
Helper to align tables based on its content using the gofpdf library
func wrappedTable(document *gofpdf.Fpdf, encodingFunc report.EncodingFunc,
rows [][]string, cols []float64, marginCell float64, border bool) []position {
var (
padding = 10.0
paddingCell = 2. // padding of top/bottom of cell
rowsPositions []position
)
_, pageh := document.GetPageSize()