Skip to content

Instantly share code, notes, and snippets.

View lucasepe's full-sized avatar
🎯
Focusing ...

Luca Sepe lucasepe

🎯
Focusing ...
View GitHub Profile
@lucasepe
lucasepe / throttled_transport.go
Created June 26, 2023 11:30 — forked from zdebra/throttled_transport.go
NewThrottledTransport wraps transportWrap with a rate limitter, improvement of https://gist.github.com/MelchiSalins/27c11566184116ec1629a0726e0f9af5 since it allows use of *http.Client
package main
import (
"net/http"
"time"
"golang.org/x/time/rate"
)
// ThrottledTransport Rate Limited HTTP Client
@lucasepe
lucasepe / logging-custom.zig
Last active May 20, 2023 20:46
[Zig] Define logFn to override the std implementation
// cfr. https://ziglang.org/documentation/master/std/#A;std:log
//
const std = @import("std");
pub fn main() void {
std.log.err("A bug has been detected or something has gone wrong but it is recoverable", .{});
std.log.info("general messages about the state of the program", .{});
const my_log = std.log.scoped(.my_scope);
my_log.info("general messages about the state of the program", .{});
@lucasepe
lucasepe / hashes.go
Created April 2, 2023 16:15
Compute the hash of a stream of data
package hashes
import (
"hash"
"io"
)
func Compute(r io.Reader, h hash.Hash) (res []byte, err error) {
_, err = io.Copy(h, r)
if err == nil {
@lucasepe
lucasepe / tiled-lines.g2d
Last active January 1, 2021 22:23
Geometric Art: g2D Tiled Lines
// Drawing size
size(1024)
// White background
fillColor(255, 255, 255)
clear()
// Smaller size
s := min(WIDTH, HEIGHT)
// Segment lenght
step := 0.05 * s
@lucasepe
lucasepe / ebiten-gfx-blocks.go
Created November 11, 2020 15:22 — forked from peterhellberg/ebiten-gfx-blocks.go
Blocks rendered by Ebiten with gfx.
package main
import (
"github.com/hajimehoshi/ebiten"
"github.com/peterhellberg/gfx"
)
const (
title = "Ebiten GFX Blocks"
scale = 4
@lucasepe
lucasepe / card.go
Created December 12, 2019 15:02
Dematerialize your loyalty card
package main
import (
"fmt"
"math"
"github.com/boombuler/barcode"
"github.com/boombuler/barcode/ean"
"github.com/fogleman/gg"
@lucasepe
lucasepe / golang_pipe_http_response.go
Created July 10, 2019 15:55 — forked from ifels/golang_pipe_http_response.go
golang pipe the http response
package main
import (
"io"
"net/http"
"os/exec"
)
var (
BUF_LEN = 1024
@lucasepe
lucasepe / test-case-template.md
Last active June 26, 2024 03:38
Test Case Template

[TC-ID] : Title of the test

Description

The description should tell the tester what they’re going to test and include any other pertinent information such as the test environment, test data, and preconditions/assumptions.

Precondition

Any preconditions that must be met prior to the test being executed.

@lucasepe
lucasepe / API.md
Created September 12, 2017 15:04
Documenting Rest API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method: