This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
| // http://www.giocc.com/writing-a-lexer-in-java-1-7-using-regex-named-capturing-groups.html | |
| // javac Lexer.java && java Lexer | |
| import java.util.ArrayList; | |
| import java.util.regex.Pattern; | |
| import java.util.regex.Matcher; | |
| public class Lexer { | |
| private static enum Token { | |
| NUMBER("-?[0-9]+"), OPERATOR("[*|/|+|-]"), SKIP("[ \t\f\r\n]+"); |
This file contains hidden or 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 <Adafruit_PN532.h> | |
| #define PN532_IRQ (2) | |
| #define PN532_RESET (3) // Not connected by default on the NFC Shield | |
| // Shield with an I2C connection: | |
| Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET); | |
| void setup(void) { | |
| Serial.begin(115200); |
This file contains hidden or 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
| 'use strict' | |
| const levenshtein = (a, b) => { | |
| if (a.length == 0) return b.length | |
| if (b.length == 0) return a.length | |
| // swap to save some memory O(min(a,b)) instead of O(a) | |
| if (a.length > b.length) | |
| b = [a, a = b][0] | |
| let row = [] | |
| for (let i = 0 ; i <= a.length ; ++i) |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| type Plop struct { | |
| A string | |
| } |
This file contains hidden or 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
| package main | |
| import ( | |
| "errors" | |
| "fmt" | |
| ) | |
| type queue struct { | |
| Type string | |
| Q []interface{} |
This file contains hidden or 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
| let rec appartenance f e = match e with | |
| |[]-> false | |
| |t::q-> if f=t then true else (appartenance f q);; | |
| let res = appartenance ["valkheim"] ["valkheim";"niflheim";"muspelheim"];; | |
| let rec ajout f e = match e with | |
| |[]-> [f] | |
| |t::q-> if f=t then e else t::(ajout f q);; |
This file contains hidden or 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
| #define _ F-->00 || F-OO--; | |
| long F=00,OO=00; | |
| main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO() | |
| { | |
| _-_-_-_ | |
| _-_-_-_-_-_-_-_-_ | |
| _-_-_-_-_-_-_-_-_-_-_-_ | |
| _-_-_-_-_-_-_-_-_-_-_-_-_-_ | |
| _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ | |
| _-_-_-_-_-_-_-_-_-_-_-_-_-_-_ |