Skip to content

Instantly share code, notes, and snippets.

View akhenakh's full-sized avatar
🏠
Working from home

Fabrice Aneche akhenakh

🏠
Working from home
View GitHub Profile
@sstolz
sstolz / tva_intracom_fr.sh
Last active January 12, 2017 13:51
TVA intracommunautaire FR
# Calcul GRATUIT et pour tous du numéro de TVA intracom français
# !! le contrôle de ces clés n'implique pas l'existence réelle du numéro de TVA intracommunautaire !!
# Source : https://fr.wikipedia.org/wiki/Code_Insee#Le_num.C3.A9ro_de_TVA_Intracommunautaire
SIREN=111222333 && echo "FR $(echo '(12 + (3*(${SIREN} % 97))) % 97' | bc) ${SIREN}"
@joshrotenberg
joshrotenberg / embedded.go
Last active August 4, 2023 08:56
embedded nsqd
package main
// This is a basic example of running an nsqd instance embedded. It creates
// and runs an nsqd with all of the default options, and then produces
// and consumes a single message. You are probably better off running a
// standalone instance, but embedding it can simplify deployment and is
// useful in testing.
// See https://github.com/nsqio/nsq/blob/master/nsqd/options.go and
// https://github.com/nsqio/nsq/blob/master/apps/nsqd/nsqd.go for
@elithrar
elithrar / use.go
Last active January 5, 2023 11:19
go/use: Little middleware chains that could. Inspired by comments here: https://github.com/gorilla/mux/pull/36
r := mux.NewRouter()
// Single handler
r.HandleFunc("/form", use(http.HandlerFunc(formHandler), csrf, logging)
// All handlers
http.Handle("/", recovery(r))
// Sub-routers
apiMiddleware := []func(http.Handler) http.Handler{logging, apiAuth, json}
@akhenakh
akhenakh / tools.py
Created June 19, 2012 14:47
flask jsonify with support for MongoDB from tools import jsonify
try:
import simplejson as json
except ImportError:
try:
import json
except ImportError:
raise ImportError
import datetime
from bson.objectid import ObjectId
from werkzeug import Response
@skeeet
skeeet / xcode_ramdisk.sh
Created April 12, 2012 13:35 — forked from MaximKeegan/xcode_ramdisk.sh
Create a RAM disk for using with XCode
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"