Skip to content

Instantly share code, notes, and snippets.

Nicolas Trangez NicolasT

View GitHub Profile
NicolasT /
Created Apr 1, 2020
Dumb Python implementation to get the IP address assigned to an interface
import sys
import fcntl
import socket
import struct
#include <stdio.h>
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
NicolasT / calico-cni-plugin.spec
Last active Feb 7, 2019
Calico cni-plugin RPM spec
View calico-cni-plugin.spec
%global provider github
%global provider_tld com
%global project projectcalico
%global repo cni-plugin
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%ifarch x86_64
%global built_arch amd64
%global calico_sha256 5736d46dc8f3d17eafd1d7874c49457244b698d5fccf726066c60c136ac5a318
%global calico_ipam_sha256 ae32622d5c904e216cd914031e560e481c9ea9c213153172d0eacabadbb5e984
NicolasT /
Last active Jun 20, 2018
PaxosLease question

An e-mail I sent to the authors of the PaxosLease paper back in the day. One of them replied explaining how in their actual implementation of the protocol ( they added phase separation/tracking (bool preparing and bool proposing), which would indeed solve the issue with the protocol outlined in the paper as explained in the e-mail.

NicolasT / test.hs
Created Sep 12, 2017
Enhancing type inference of indexed monads, removing type annotations?
View test.hs
-- See below
-- {-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RebindableSyntax #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Prelude hiding ((>>=), (>>), return)
import qualified Prelude as P
import Data.Functor.Identity (Identity, runIdentity)
View abstract.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ViewPatterns #-}
module Main where
import Data.Monoid
import Control.Lens
View testepoll.c
* $ make testepoll CFLAGS="-Wall -Werror -ggdb3"
* One console:
* $ nc -l 8000
* Other console:
* $ ./testepoll
NicolasT / slice_xor.c
Created Jan 23, 2017
Slicing XOR hashing
View slice_xor.c
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <x86intrin.h>
#include <avx2intrin.h>
#ifdef __cplusplus
extern "C" {
void slice_xor(const unsigned char *data, size_t len, uint64_t *p1, uint64_t *p2);
NicolasT / cryptosplice.c
Created May 10, 2016
Demonstration of splice, tee and AF_ALG hashing for zero-copy storage and data hash calculation
View cryptosplice.c
/* Usage:
* $ make cryptosplice
* cc cryptosplice.c -o cryptosplice
* $ rm -f cryptosplice.out
* $ ./cryptosplice
* Now, in another terminal:
NicolasT / .gitignore
Last active Oct 15, 2015
CRC32 benchmark
View .gitignore
NicolasT / crc32_prop.hs
Created Oct 15, 2015
Combining intermediate CRC32 results
View crc32_prop.hs
module Main where
import Data.Word (Word8, Word32)
import Foreign.C (CUInt(..), CULong(..))
import Foreign.Ptr (Ptr)
import System.IO.Unsafe (unsafePerformIO)
import qualified Data.ByteString as BS
import Test.QuickCheck
You can’t perform that action at this time.