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
// g++ example.cc | |
#include <chrono> | |
#include <iostream> | |
#include <string> | |
#include <thread> | |
int main() | |
{ | |
std::chrono::milliseconds delay(1000); | |
while (true) |
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
make clean && make -pRrq | grep 'MAKE.*cc.o' | sed 's/.*..MAKE./make/' | while read -r cmd ; do /usr/bin/time -f "%e $cmd" $cmd -j1 -b > /dev/null ; done 2>&1 | tee compile-times.txt |
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
[2018-07-10 18:08] [ALPM] upgraded libsystemd (238.133-4 -> 239.0-2) | |
[2018-07-10 18:08] [ALPM] upgraded gdbm (1.14.1-1 -> 1.16-1) | |
[2018-07-10 18:08] [ALPM] upgraded perl (5.26.2-1 -> 5.26.2-2) | |
[2018-07-10 18:08] [ALPM] upgraded libsasl (2.1.26-12 -> 2.1.26-13) | |
[2018-07-10 18:08] [ALPM] upgraded apr-util (1.6.1-2 -> 1.6.1-3) | |
[2018-07-10 18:08] [ALPM] upgraded avahi (0.7+4+gd8d8c67-1 -> 0.7+16+g1cc2b8e-1) | |
[2018-07-10 18:08] [ALPM] upgraded brotli (1.0.4-1 -> 1.0.5-1) | |
[2018-07-10 18:08] [ALPM] upgraded harfbuzz (1.8.1-1 -> 1.8.2-1) | |
[2018-07-10 18:08] [ALPM] upgraded libmagick6 (6.9.10.3-1 -> 6.9.10.6-1) | |
[2018-07-10 18:08] [ALPM] upgraded systemd (238.133-4 -> 239.0-2) |
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
// #1 version without Result as return type | |
fn from_json(data: &str) -> humans::Humans { | |
let mut humans = Vec::new(); | |
let msg: Value = serde_json::from_str(data).expect("json error"); | |
for human in msg["people"].as_array().unwrap().iter() { | |
humans.push(humans::Human::new( | |
human["name"].as_str().unwrap(), | |
human["craft"].as_str().unwrap(), | |
)); |
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
% bin/python main.py | |
add_client: bot1 | |
_ _ _ | |
_ _ _ | |
_ _ _ | |
waiting for players | |
add_client: bot2 | |
_ _ _ | |
_ _ _ | |
_ _ _ |
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
fn sum(s : &str) { | |
let mut sum_1 = 0; | |
let mut sum_2 = 0; | |
for (i, c_this) in s.chars().enumerate() { | |
let c_comp_1 = s.chars().cycle().nth(i + 1).unwrap(); | |
let c_comp_2 = s.chars().cycle().nth(i + s.len()/2).unwrap(); | |
if c_this == c_comp_1 { | |
sum_1 += c_this.to_digit(10).unwrap(); | |
} |
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
fn main() { | |
let test_data = "pbga (66) | |
xhth (57) | |
ebii (61) | |
havc (66) | |
ktlj (57) | |
fwft (72) -> ktlj, cntj, xhth | |
qoyq (66) | |
padx (45) -> pbga, havc, qoyq | |
tknk (41) -> ugml, padx, fwft |
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
struct Mem { | |
mem : Vec<i32> | |
} | |
impl Mem { | |
pub fn new(mem : &Vec<i32>) -> Mem { | |
Mem { | |
mem : mem.clone() | |
} | |
} |
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
struct Cpu { | |
mem : Vec<i32>, | |
pc : i32, | |
cycles : u32, | |
ext : bool, | |
} | |
impl Cpu { | |
pub fn new(mem : &Vec<i32>, extention : bool) -> Cpu { | |
Cpu { |
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
inline void Device::set_allocated_id(::std::string* id) { | |
if (id != NULL) { | |
} else { | |
} | |
id_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), id); | |
// @@protoc_insertion_point(field_set_allocated:cc_ui.Device.id) | |
} |
NewerOlder