Skip to content

Instantly share code, notes, and snippets.

View yves-chevallier's full-sized avatar

Yves Chevallier yves-chevallier

View GitHub Profile
@yves-chevallier
yves-chevallier / notes.md
Created November 1, 2020 16:35
Remarques sur les labos

Remarques générales sur les labos

Dans l'ensemble vous faites du bon travail. Le code est minimaliste, propre et souvent fonctionnel.

Rappelez-vous que c'est le résultat qui compte. Donc si vous avez un joli code mais qu'il ne passe pas les tests, vous perdez des points.

Voici quelques points d'amélioration utiles pour les futures labos.

@yves-chevallier
yves-chevallier / score.py
Created October 21, 2020 06:18
Score file
#!/usr/bin/env python3
import yaml
def note(got, total):
return round(got / total * 5. + 1., 1)
def get_points(u):
got = 0
total = 0
for k, v in u.items():
@yves-chevallier
yves-chevallier / tire.c
Last active October 18, 2020 12:01
Tire Code
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
/**
* Convert a regex match into an integer
*/
int to_integer(regmatch_t match, const char* str) {
@yves-chevallier
yves-chevallier / altium.md
Created August 25, 2020 16:29
Analyse préliminaire des besoins : gestion des composants
author date company department institute
Pascal Albert Zosso
2020-08-25
HEIG-VD
TIN
IAI

Gestion des éléments EDA

@yves-chevallier
yves-chevallier / binary.md
Created June 8, 2020 08:12
UON précisions binaire

Précisions sur le format binaire UON

Introduction

La plupart des langages de sérialisation de données permettent la génération d'un flux texte comme XML, JSON ou YAML qui permet une lecture facile mais qui n'est pas optimal du point de vue du médium de transmission : un encodage minimal serait préférable.

UON offre deux solutions pour minimiser la charge utile :

  1. Partager la charge utile entre un schéma de description et une charge de données
  2. Encoder UON en format binaire
@yves-chevallier
yves-chevallier / heap.c
Created May 26, 2020 16:00
Max-Heap for strings
/**
* Max-Heap for strings implemented with a max-heap binary tree
* Insertion (enqueue) in O(log n)
* Deletion (dequeue) in O(log n)
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
@yves-chevallier
yves-chevallier / gallimard.c
Created March 10, 2020 20:46
Correction du laboratoire Gallimard
/**
* Gallimard text analyser.
*
* See the help below to get information about how this proogram works.
*/
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define WIDTH (30)
/**
* ANSI color sequences
* http://www.lihaoyi.com/post/BuildyourownCommandLinewithANSIescapecodes.html
@yves-chevallier
yves-chevallier / sudoku-solve.c
Created December 13, 2019 22:09
Sudoku Solver (brute force)
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BLOCK (3)
#define WIDTH (BLOCK * BLOCK)
#if WIDTH % BLOCK > 0
# error "Invalid block size"
@yves-chevallier
yves-chevallier / spiral.c
Created December 13, 2019 22:08
Draw a spiral in text mode
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
#define W (30)
const double pi = 3.1415;
void display(bool tab[W][W]) {