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 std::collections::HashMap; | |
| use std::fs::File; | |
| use std::io; | |
| use std::io::prelude::*; | |
| use regex::Regex; | |
| use itertools::Itertools; | |
| type MailHeader = HashMap<String, Vec<String>>; | |
| fn read_file(path: &str) -> io::Result<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
| use std::collections::HashMap; | |
| use std::fs::File; | |
| use std::io::{BufRead, BufReader, Result}; | |
| type MailHeader = HashMap<String, Vec<String>>; | |
| fn proc_folding_line(line: String, prev_fname: &String, mail_header: &mut MailHeader) { | |
| if prev_fname == "" { | |
| eprintln!("prev-key error: line: {}", line); | |
| } |
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
| # FizzBuzz FP | |
| from typing import Callable, Iterable, List, TypeVar, Tuple | |
| T = TypeVar('T') | |
| def foreach(f: Callable[[T], None], l: Iterable[T]) -> None: | |
| for x in l: |
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
| # FizzBuzz OOP | |
| from abc import ABC, abstractmethod | |
| class BaseFizzBuzz(ABC): | |
| def __init__(self, n: int) -> None: | |
| self.number = n | |
| @staticmethod |
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
| # FizzBuzz Imperative | |
| i = 1 | |
| while i < 101: | |
| if i % 15 == 0: | |
| print('FizzBuzz') | |
| elif i % 3 == 0: | |
| print('Fizz') | |
| elif i % 5 == 0: | |
| print('Buzz') |
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
| // original: openssl/demos/cms/cms_dec.c | |
| // g++ test_dec.cpp -lcrypto -o test_dec | |
| #include <iostream> | |
| #include <string> | |
| #include <openssl/bio.h> | |
| #include <openssl/err.h> | |
| #include <openssl/ssl.h> | |
| #include <openssl/pkcs7.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
| // original: openssl/demos/cms/cms_enc.c | |
| // g++ test_enc.cpp -lcrypto -o test_enc | |
| #include <iostream> | |
| #include <string> | |
| #include <openssl/bio.h> | |
| #include <openssl/err.h> | |
| #include <openssl/ssl.h> | |
| #include <openssl/pkcs7.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
| // original: openssl/demos/cms/cms_sign.c | |
| // g++ test_sign.cpp -lcrypto -o test_sign | |
| #include <iostream> | |
| #include <string> | |
| #include <openssl/bio.h> | |
| #include <openssl/err.h> | |
| #include <openssl/ssl.h> | |
| #include <openssl/pkcs7.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
| // original: openssl/demos/cms/cms_ver.c | |
| // g++ test_verify.cpp -lcrypto -o test_verify | |
| #include <iostream> | |
| #include <string> | |
| #include <openssl/bio.h> | |
| #include <openssl/err.h> | |
| #include <openssl/ssl.h> | |
| #include <openssl/pkcs7.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
| interface FizzBuzz { kind: 'fizzbuzz'; num: number; } | |
| interface Fizz { kind: 'fizz'; num: number; } | |
| interface Buzz { kind: 'buzz'; num: number; } | |
| interface Other { kind: 'other'; num: number; } | |
| type FizzBuzzType = FizzBuzz | Fizz | Buzz | Other; | |
| const range_100: () => number[] = () => Array.apply(0, Array(100)).map((x, y) => y + 1); | |
| const is_fizzbuzz: (n: number) => boolean = n => (n % 15) === 0; |