Skip to content

Instantly share code, notes, and snippets.

View gulien's full-sized avatar

Julien Neuhart gulien

  • Hermès
  • Paris
View GitHub Profile
package main
import (
"encoding/json"
"testing"
)
type foo struct {
ID string `json:"_id"`
Index int `json:"index"`
This file has been truncated, but you can view the full file.
9254835974458887629672873635789957411886024698554157393849494864228024962939550688297074527198420261051675205999609689838587412
7948702662533481896767559573369920938242346354580061545409242090168773727371802699309443935396635866263937828773324526334321892
7929250312741837331511829643632683169694074912332726993582394725302853411901337696207186358524323117172520907433878952968176465
9486937364148093931718552300016332142708943190856638524388888569011747617956915519539025796115901484762122047712200094207683584
0703675740855407318047361595661595146837376373951978537785605481083388906490085533348547865459237835407372374738389274773789264
3524314516560200536698529022539598732463389124803873184044464663165630452635665559603483233341839268186056673186867104904449866
3388466377320953222057779182433549144340237502432464295061371141084500222833875925546082542869030852833895137466510262849050187
2359980877010447170873386178573828860442255448874794721230413368694441497441338856684036949118353204002591974711928301953002372
@rushilgupta
rushilgupta / GoConcurrency.md
Last active December 11, 2025 13:17
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@matryer
matryer / gopherize.me.artwork.json
Created August 1, 2017 12:36
Response of Artwork API for Gopherize.me
{
"categories": [{
"id": "artwork/010-Body",
"name": "Body",
"images": [{
"id": "artwork/010-Body/blue_gopher.png",
"name": "blue gopher",
"href": "https://storage.googleapis.com/gopherizeme.appspot.com/artwork/010-Body/blue_gopher.png",
"thumbnail_href": "https://lh3.googleusercontent.com/2WSrI5x6u8LqWQ-xBzogIu3QrthPiawLH2zCPvrOgpMPU0K240di8pOKSwhz_IL0xiq5I2pBJkWrhyZDJeAPWD4=s71"
}, {
@ebraminio
ebraminio / upload.go
Last active October 20, 2025 02:05
golang upload client and server
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload
package main
import (
"fmt"
"io"
"net/http"
"os"
"time"
@ngauthier
ngauthier / timeout_and_tick.go
Created February 10, 2015 18:14
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout: