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
use crypto_bench; | |
use openssl::{rand, symm}; | |
use openssl::error::ErrorStack; | |
use test; | |
fn generate_sealing_key(algorithm: symm::Cipher) -> Result<Vec<u8>, ()> { | |
let mut key_bytes = vec![0u8; algorithm.key_len()]; | |
try!(rand::rand_bytes(&mut key_bytes).map_err(|_| ())); | |
Ok(key_bytes) | |
} |
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
using System; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using System.Threading; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ |
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
// x86_64-w64-mingw32-gcc tfo.c -o tfo -lws2_32 -static -g -O0 | |
#define TARGET_URL "localhost" | |
#define TARGET_PORT 8000 | |
#ifndef _WINSOCK_H | |
#define _WINSOCK_H | |
#ifdef __MINGW32__ |
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
/** | |
* http://d.hatena.ne.jp/odz/20070507/1178558340 | |
*/ | |
// x86_64-w64-mingw32-gcc echo.c wepoll.c -O0 -o echo -g -lws2_32 -static | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
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
{-# LANGUAGE RankNTypes #-} | |
module Nat where | |
import Prelude hiding (succ, pred) | |
class Nat a where | |
zero :: a | |
succ :: a -> a | |
pred :: a -> a | |
fold :: (b -> b) -> b -> a -> b |
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
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE TypeOperators #-} | |
module Main where | |
import Data.Char (ord, chr) | |
import Text.PrettyPrint.ANSI.Leijen hiding (pretty) | |
import qualified Data.Ord as DO (compare) | |
import Prelude hiding (compare) |
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
#!/usr/bin/env python | |
''' | |
Fix the rpath issue when cabal (ghc) links dynamically on Linux and OS X. | |
Put this script in your .cabal/bin for execution. | |
''' | |
import os | |
import re | |
import sys |
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
#!/usr/bin/env python | |
#-*- encoding: utf-8 -*- | |
# | |
# Opera Mobile Off-Road Proxy Modifier | |
# By Linus Yang <[email protected]> | |
# Licensed under GPLv3 | |
# | |
from optparse import OptionParser | |
from zipfile import ZipFile, ZipInfo, ZIP_DEFLATED |
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
#!/usr/bin/env python | |
# | |
# By Linus Yang <[email protected]> | |
# Written on iPad using Textastic Code Editor | |
# Licensed under GPL v3 | |
# | |
''' | |
Function: | |
Transform an NFA to DFA then simplify it |