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 / 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]) {
@yves-chevallier
yves-chevallier / group-generator.c
Created November 20, 2019 21:36
Generate random students groups with some suspense...
/**
* Generate random students groups with some suspense...
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
int randint(int max)
{
@yves-chevallier
yves-chevallier / menu.c
Created November 18, 2019 08:54
Menu en C
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include <ctype.h>
void q(void) {
char d;
if(scanf("%hhd", &d)) {
printf("Info: Scanf got %hhd\n", d);