Skip to content

Instantly share code, notes, and snippets.

View fabienjuif's full-sized avatar
🦝
meow!

Fabien JUIF fabienjuif

🦝
meow!
  • Cantina
  • Saumur, France
  • 12:59 (UTC +02:00)
View GitHub Profile
@fabienjuif
fabienjuif / Dockerfile
Created December 24, 2025 08:34
Vite / Runtime variables
ARG WEB_TAG=yourrepo/web:latest
# front assets
# we have to do this "from" as a workaround because --from does not support build args
FROM ${WEB_TAG} AS web_build
# generate-env image
FROM fabienjuif/generate-env:latest AS generate_env
FROM nginx:1.29.2
@fabienjuif
fabienjuif / batcher.go
Last active October 5, 2025 08:34
Golang pool batchers
package batcher
import (
"context"
"errors"
"log/slog"
"sync"
"sync/atomic"
"time"
)
@fabienjuif
fabienjuif / gist:f678311481d3d2dbce555943c50fd0fb
Last active March 2, 2022 09:25
windows forward port to wsl2
netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=172.26.17.154
netsh interface portproxy reset all
@fabienjuif
fabienjuif / cache.js
Last active June 30, 2019 10:04
Node.js / utils / cache
const crypto = require('crypto')
const toMD5 = object => crypto.createHash('md5').update(JSON.stringify(object)).digest('hex')
module.exports = ({
timeout = (/* 1 h */ 1 * 60 * 60 * 1000),
maxEntries = 100,
name = 'cache',
log = console.log,
} = {}) => {
package gziphandler
import (
"compress/gzip"
"log"
"net/http"
"strings"
"sync"
)