Skip to content

Instantly share code, notes, and snippets.

@ykon
ykon / Program.cs
Last active November 14, 2017 15:02
Mail Parser in C# (in development)
/*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@ykon
ykon / Program.cs
Last active November 19, 2017 15:11
sendmail test
/*
* Copyright (c) 2017 Yuki Ono
* Licensed under the MIT License.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
@ykon
ykon / fizzbuzz.elm
Created November 23, 2017 12:52
FizzBuzz in Elm
{--
Copyright (c) 2017 Yuki Ono
Licensed under the MIT License.
--}
import Html exposing (..)
import List
import String
type FizzBuzzType
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;
@ykon
ykon / test_verify.cpp
Created July 21, 2018 11:04
CMS Verify
// 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>
@ykon
ykon / test_sign.cpp
Created July 21, 2018 11:06
CMS Sign
// 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>
@ykon
ykon / test_enc.cpp
Created July 21, 2018 11:09
CMS Encrypt
// 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>
@ykon
ykon / test_dec.cpp
Created July 21, 2018 11:11
CMS Decrypt
// 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>
@ykon
ykon / fizzbuzz_imp.py
Last active August 4, 2018 07:50
FizzBuzz Imperative
# 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')
@ykon
ykon / fizzbuzz_oop.py
Created August 4, 2018 07:54
FizzBuzz OOP
# FizzBuzz OOP
from abc import ABC, abstractmethod
class BaseFizzBuzz(ABC):
def __init__(self, n: int) -> None:
self.number = n
@staticmethod