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
| static const int BLUE = 7; | |
| static const int GREEN = 8; | |
| void setup() { | |
| Serial.begin(115200); | |
| pinMode(BLUE, OUTPUT); | |
| pinMode(GREEN, OUTPUT); | |
| digitalWrite(BLUE, LOW); | |
| digitalWrite(GREEN, LOW); | |
| } |
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 _CRT_SECURE_NO_WARNINGS | |
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <inttypes.h> | |
| #include <stdbool.h> | |
| #include <windows.h> | |
| #include <assert.h> | |
| #include "fixed_buffer_allocator.h" |
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 <string.h> | |
| // Fully connected graph of transformations: | |
| // Message (enum) | |
| // MessageIndex (enum) | |
| // | |
| // Index -> Key | |
| // Index -> Value | |
| // Value -> Index (reverse lookup) |
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
| fn main() { | |
| let mut rng = thread_rng(); | |
| println!("Vector"); | |
| for size in [1_000, 10_000, 50_000].into_iter() { | |
| let mut xs = Vec::with_capacity(size); | |
| for _ in 0..size { | |
| xs.push(rng.gen_range(0..size)); | |
| } |
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
| //! Factory scheduling | |
| use std::collections::HashMap; | |
| use galapagos::{Config, Goal}; | |
| use rand::{thread_rng, Rng}; | |
| use textplots::{Chart, Plot}; | |
| type JobId = i32; | |
| type MacId = i32; |
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
| #[derive(Debug, Clone, Copy)] | |
| enum ThreadState { | |
| Unstarted, | |
| InProgress, | |
| Panicked, | |
| Success, | |
| } | |
| fn main() { | |
| let mut init = Vec::with_capacity(3); |
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
| #[derive(Debug, Clone, Copy)] | |
| enum ThreadState { | |
| Unstarted, | |
| Panicked, | |
| Success, | |
| } | |
| fn main () { | |
| let x = Arc::new(Mutex::new(ThreadState::Unstarted)); |
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
| import signal | |
| import time | |
| import random | |
| import json | |
| import os | |
| import threading | |
| import hashlib | |
| lock = threading.Lock() |
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
| lock = threading.Lock() | |
| state = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| def persist_state(): | |
| print("Persisting state...") | |
| tmp = "/tmp/buffer.json" | |
| dst = "/tmp/dump.json" | |
| with lock: | |
| content = json.dumps(state) | |
| with open(tmp, "w") as f: |
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
| import signal | |
| import time | |
| import json | |
| import os | |
| state = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
| def persist_state(): | |
| print("Persisting state...") | |
| tmp = "/tmp/buffer.json" |
NewerOlder