Skip to content

Instantly share code, notes, and snippets.

Jérôme Renard jeromer

Block or report user

Report or block jeromer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
extern crate hyper;
extern crate tokio;
extern crate tokio_signal;
use futures::Stream;
use hyper::rt::Future;
use hyper::service::service_fn_ok;
use hyper::{Body, Request, Response, Server};
use futures::sink::Sink;
jeromer / graphql_datetime.go
Created Jun 17, 2017
DateTime scalar for GraphQL
View graphql_datetime.go
// DateTime Scalar for the
// See:
package graphqldatetime
import (
View riemann.config
(require '[org.spootnik.riemann.collectd :refer [rewrite-service-with]])
(require '[org.spootnik.riemann.thresholds :refer [threshold-check]])
(include "thresholds.clj")
(include "services.clj")
(logging/init {:file "/var/log/riemann/riemann.log"})
(let [host ""]
(tcp-server {:host host})
jeromer / storageaggregations.conf
Created Nov 11, 2016
Graphite's storage aggregations for collectd metrics
View storageaggregations.conf
# This is a work in progress. Any improvement welcome :)
pattern = \.entropy\.entropy$
xFilesFactory = 0.3
aggregationMethod = last
pattern = \.tcp_connections.*$
xFilesFactory = 0.3
#! /usr/bin/env python
# Tested on Postgres 9.5
import psycopg2
import datetime
conn = psycopg2.connect("dbname=sandbox user=postgres")
cursor = conn.cursor()
View numbers.everyone.should.know.txt
Numbers Everyone Should Know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
jeromer /
Last active Nov 21, 2019
compass bearing between two points in Python
# LICENSE: public domain
def calculate_initial_compass_bearing(pointA, pointB):
Calculates the bearing between two points.
The formulae used is the following:
θ = atan2(sin(Δlong).cos(lat2),
cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong))
jeromer /
Created Feb 22, 2012
Orthodromic distance using the Harversine formula in Python
# -*- coding: utf-8 -*-
import math
def calculate_orthodromic_distance(pointA, pointB):
Calculates the great circle distance between two points.
The great circle distance is the shortest distance.
This function uses the Haversine formula :
You can’t perform that action at this time.