Skip to content

Instantly share code, notes, and snippets.

View titouanc's full-sized avatar

iTitou titouanc

  • Belgium
View GitHub Profile
def distance [D] (p1: [D]f32) (p2: [D]f32): f32 =
map2 (-) p1 p2
|> map (\x -> x*x)
|> reduce (+) 0f32
|> (** 0.5)
def nearest [D][N] (data_points: [N][D]f32) (query_point: [D]f32): f32 =
map (distance query_point) data_points
|> reduce f32.min f32.inf
#include <avro.h>
#define OUTFILE "out.avro"
#define OUTCODEC "null"
#define SCHEMA \
"{\"type\":\"record\","\
" \"name\":\"Person\","\
" \"fields\":["\
" {\"name\": \"ID\", \"type\": \"long\"},"\
@titouanc
titouanc / test-avro.c
Last active January 16, 2020 17:15
A minimal (working ?) example of writing data with avro-c
/* Compile with:
* gcc -std=c99 -Wall -Wextra -Werror $(pkg-config --cflags avro-c) -o test-avro test-avro.c $(pkg-config --libs avro-c)
*/
#include <avro.h>
#define OUTFILE "out.avro"
#define OUTCODEC "null"
#define SCHEMA \
output/build/buildroot-config/conf --help
output/build/buildroot-config/conf: unrecognized option '--help'
Usage: output/build/buildroot-config/conf [-s] [option] <kconfig-file>
[option] is _one_ of the following:
--listnewconfig List new options
--oldaskconfig Start a new configuration using a line-oriented program
--oldconfig Update a configuration using a provided .config as base
--syncconfig Similar to oldconfig but generates configuration in
include/{generated/,config/}
--olddefconfig Same as oldconfig but sets new symbols to their default value
/dts-v1/;
/memreserve/ 0x00000000081e4000 0x0000000000019000;
/ {
serial-number = "526e84fcaa8e34b9";
compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399";
interrupt-parent = <0x1>;
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "Firefly roc-rk3399-pc";
@titouanc
titouanc / Exercise.md
Last active January 9, 2019 16:53
The NMEA coding challenge - Railnova programmer interview https://jobs.railnova.eu/o/embedded-c-programmer-core-team

Coding exercise: NMEA parsing

Copyright (c) 2012-2018 RAILNOVA - All rights reserved

This exercise was originally written by Jeremie Stilmant.

2018 update by Titouan Christophe

1. Exercise scope and goals

@titouanc
titouanc / Config.in.host
Created August 30, 2018 17:49
Buildroot package for the GNU Embedded Toolchain for Arm
################################################################################
#
# gcc-arm-none-eabi
#
################################################################################
config BR2_PACKAGE_HOST_GCC_ARM_NONE_EABI_SUPPORTS
bool
default y
depends on BR2_HOSTARCH = "x86_64"
@titouanc
titouanc / slack.py
Created September 27, 2017 11:51
Slack status push for Buildbot
from buildbot.util import httpclientservice
from buildbot.process.properties import Interpolate, Properties
from buildbot.reporters.http import HttpStatusPushBase
from buildbot.process.results import (CANCELLED, EXCEPTION, FAILURE, RETRY,
SKIPPED, SUCCESS, WARNINGS)
from twisted.internet import defer
from urllib.parse import urlparse
def format_timedelta(td):
@titouanc
titouanc / 0-conv1d.fut
Last active March 18, 2017 13:07
Futhark changes
fun convk1(kern: [x]f32, input: [x]f32): f32 =
reduceComm (+) 0f32 (map (*) kern input)
-- Futhark from a few weeks ago
fun conv1d(kern: [m]f32, input: [n]f32): []f32 =
map (fn i => convk1(kern, input[i:i+m]))
(iota (1 + n - m))
-- Futhark ca9f992
fun conv1d(kern: [m]f32, input: [n]f32): []f32 =
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.