This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
char wav_to_char(const float f) | |
{ | |
return "_,.-*`''"[(unsigned char)((f + 1.f) * (7.f / 2.f))]; | |
} | |
int main(void) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
extern char __executable_start; | |
extern char __etext; | |
static void dump(const void* data, size_t size) | |
{ | |
char ascii[17]; | |
size_t i, j; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Implementation of Dekker's algorithm */ | |
/* It allows two threads to share a single-use resource without conflict */ | |
/* It uses only a shared memory for communication. */ | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <pthread.h> | |
/* The counter threads will increment */ | |
static unsigned int c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Lamport's bakery algorithm */ | |
/* Improve safety in the usage of shared resources among multiple threads by */ | |
/* means of mutual exclusion */ | |
/* Communications of the ACM, August 1974, Volume 17, Number 8, P.453 */ | |
#include <pthread.h> | |
#include <stdbool.h> | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Ballhausen's solution to classical reader-writers fairness problem */ | |
/* Initial problem : a continual flow of readers blocks writers from updating */ | |
/* Ballhausen's solution : | |
* * one readers takes up the same space as all readers reading together | |
* * a semaphore access_db is used by readers to enter the database with a | |
* an initial value equalling the number of readers | |
* * every time a reader is accessing the db, the semaphore value is | |
* decremented | |
* * every time a reader is leaving the db, the semaphore value is incremented | |
* * writers want exclusive access to the db. It occupies all spaces step by |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEBUG = true; | |
const logger = (fn, label) => { | |
if (!DEBUG) | |
return fn | |
return function() { | |
console.debug('='.repeat(3), !!fn.name ? fn.name + ': ' + label : label) | |
console.debug(arguments) | |
console.debug(fn.toString()) | |
fn.apply(this, arguments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const DEBUG = true; | |
const logger = (fn, label) => { | |
if (!DEBUG) | |
return fn | |
return function() { | |
console.debug('='.repeat(3), !!fn.name ? fn.name + ': ' + label : label) | |
console.debug(arguments) | |
console.debug(fn.toString()) | |
fn.apply(this, arguments) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
web: | |
image: odoo:12.0 | |
depends_on: | |
- db | |
ports: | |
- "8069:8069" | |
volumes: | |
- odoo-web-data:/var/lib/odoo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0 1 2 3 4 5 6 7 8 9 A B C D E | |
# X X X X X X X X X X (parity row) | |
# +--------------------------- | |
# 64 X| X X | |
# | | |
# 32 X|X X X X | |
# | | |
# 16 X|X X X X X X | |
# | | |
# 8 | X X X X X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_alma(df): | |
alma = pd.DataFrame(columns=["ALMA"]) | |
close = df["close"] | |
size = len(close) | |
def ALMA(data, sigma=6, offset=0.90, size=40): | |
""" | |
Arnaud Legoux Moving Average | |
:param data: data array |