Skip to content

Instantly share code, notes, and snippets.

@irevoire
irevoire / helloworld.rb
Last active October 15, 2018 14:41
bonjour
ablablabla
@irevoire
irevoire / IoT
Created February 26, 2019 17:57
#include <platform.h>
#include <stdint.h>
#include <stdlib.h>
#include <printf.h>
#include <string.h>
#include <time.h>
#include "phy.h"
#include "soft_timer.h"
#include "event.h"
@irevoire
irevoire / lala.rs
Created July 16, 2019 08:55
hashmap with float rust
use std::hash::{Hash, Hasher};
use std::collections::HashMap;
#[derive(Debug, Clone)]
struct Lala {
a: u32,
b: f64,
}
impl PartialEq for Lala {
@irevoire
irevoire / bash.sh
Created July 16, 2019 16:45
snabb apps/intel_mp/selftest.sh
% sudo SNABB_PCI_INTEL0=0000:04:00.0 SNABB_PCI_INTEL1=0000:04:00.1 apps/intel_mp/selftest.sh
Using deterministic random numbers, SNABB_RANDOM_SEED=2896935582.
Using deterministic random numbers, SNABB_RANDOM_SEED=2896935582.
[memory: Provisioned a huge page: sysctl vm.nr_hugepages 34 -> 35]
[memory: Provisioned a huge page: sysctl vm.nr_hugepages 35 -> 36]
[memory: Provisioned a huge page: sysctl vm.nr_hugepages 36 -> 37]
[memory: Provisioned a huge page: sysctl vm.nr_hugepages 37 -> 38]
[memory: Provisioned a huge page: sysctl vm.nr_hugepages 38 -> 39]
[memory: Provisioned a huge page: sysctl vm.nr_hugepages 39 -> 40]
[memory: Provisioned a huge page: sysctl vm.nr_hugepages 40 -> 41]
@irevoire
irevoire / showily.c
Created October 2, 2019 14:09
son truc
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#define panic(s) \
{ \
perror(s); \
exit(-1); \
}
@irevoire
irevoire / phd
Last active October 8, 2019 12:43
Title:
Reoptimizing meta-tracing
Synopsis:
Meta-tracing enables virtual machines (VMs) to decide which part
of a program should be optimized. When a VM gets some code to execute, it
needs to convert the code to instructions that can be executed on the
hardware. The VM can either convert the code to assembly or try to
optimize the code before generating assembly. Optimizing code is an
expensive operation; that is why most VMs usually identify ahead which
portion of code could be worth optimizing (in the sense that you would
@irevoire
irevoire / py
Created December 3, 2019 13:29
draw python
import sys
import numpy as np
import scipy.stats as stats
from scipy.fftpack import fft
import matplotlib.pyplot as plt
import sys
if len(sys.argv) < 2:
print("mettre le nom du / des fichiers en argument")
sys.exit()
@irevoire
irevoire / prout.md
Last active December 8, 2019 16:19
aoc

--- Day 8: Two-Factor Authentication ---

You come across a door implementing what you can only assume is an implementation of two-factor authentication after a long game of requirements telephone .

To get past the door, you first swipe a keycard (no problem; there was one on a nearby desk). Then, it displays a code on a little screen , and you type that code on a keypad. Then, presumably, the door unlocks.

Unfortunately, the screen has been smashed . After a few minutes, you've taken everything apart and figured out how it works. Now you just have to work out what the screen would have displayed.

The magnetic strip on the card you swiped encodes a series of instructions for the screen; these instructions are your puzzle input. The screen is 50 pixels wide and 6 pixels tall ,

exception Error of string
type 'a node =
| Cons of { current: 'a; next: 'a node }
| Nil
module Node = struct
let empty = Nil
let add a b = Cons { current = a; next = b }
const IDLE1: [u8; 636] = [
0, 0, 126, 126, 24, 60, 102, 66, 0, 12, 28, 112, 112, 28, 12, 0, 116, 116, 20, 20, 124, 104, 0,
124, 124, 0, 112, 120, 44, 36, 124, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 128, 64, 64, 32, 32, 32, 32, 16, 16, 16, 16, 16, 8, 8, 4, 4, 4, 8, 48,
64, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 0, 0, 0, 0, 192, 96, 48, 24,
12, 132, 198, 98, 35, 51, 17, 145, 113, 241, 113, 145, 17, 51, 35, 98, 198, 132, 12, 24, 48,
96, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 100, 130, 2, 2, 2, 2, 2, 1,
0, 0, 0, 0, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 0, 48, 48, 0, 192, 193, 193, 194, 4, 8,
16, 32, 64, 128, 0, 0, 0, 128, 128, 128, 128, 64, 64, 64, 64, 32, 32, 32, 32, 16, 16, 16, 16,