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
break for 15+ minutes every 2 hours | |
limit on towing weight | |
do not use horn when stationary or 11:30pm-7am in built-up area | |
sidelights and rear registration must be lit half an hour either side of sunset/sunrise | |
headlights must be lit at night unless there are streetlights | |
when stationary, apply the parking brake and release the foot brake to reduce dazzle | |
use dipped headlights in daytime, built-up areas, overtaking until level | |
hazard warning lights should be used at night in built-up areas, or dull daytime | |
start/stop braking lightly, for safety | |
try to avoid wheellock in emergency brake |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <openssl/ec.h> | |
//#include <openssl/ecdsa.h> | |
#include <openssl/obj_mac.h> | |
int main() | |
{ | |
BN_CTX *bn_ctx = BN_CTX_new(); |
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
int BN_bn2bin(const BIGNUM *a, unsigned char *to) | |
{ | |
int n,i; | |
BN_ULONG l; | |
bn_check_top(a); | |
n=i=BN_num_bytes(a); | |
while (i--) | |
{ | |
l=a->d[i/BN_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
static int drbg_ec_generate(DRBG_CTX *dctx, | |
unsigned char *out, size_t outlen, | |
const unsigned char *adin, size_t adin_len) | |
{ | |
DRBG_EC_CTX *ectx = &dctx->d.ec; | |
BIGNUM *t, *r; | |
BIGNUM *s = ectx->s; | |
/* special case: check reseed interval */ | |
if (out == NULL) | |
{ |
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 Node<D> { | |
edges: Vec<Edge<D>>, | |
pub data: D | |
} | |
impl<D> Node<D> { | |
pub fn new(data: D) -> Node<D> { | |
Node{data: data, edges: Vec::new()} | |
} | |
} |
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 std::collections::HashMap; | |
use std::num::Int; | |
use std::num::Float; | |
use std::io; | |
use std::uint; | |
use std::io::File; | |
#[deriving(Show)] | |
pub struct Graph<D,E> { | |
pub nodes: Vec<Node<D>>, |
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
U.S. First Strike | |
USSR First Strike | |
NATO/Warsaw Pact | |
Far East Strategy | |
US USSR Escalation | |
Middle East War | |
USSR China Attack | |
India Pakistan War | |
Mediterranean War | |
HongKong Variant |
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
c64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''), l64 = {}; | |
for (i=0; i<64; i++) | |
l64[c64[i]] = i; | |
function alphar(s) { | |
// I only pray--let me be ready. | |
var i; | |
// s must contain only base-64 characters! | |
s = s.replace(/[^0-9A-Za-z+\/]+/g, ''); | |
s = s.split(''); |
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
from random import randint | |
# ALPHAC encryption method | |
# From http://www.myersdaily.org/joseph/javascript/alphac.html | |
# This a much cleaner Python reimplementation for Cryptanalysis. | |
class Alphac: | |
c64 = list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/") | |
# s = input string (only characters in c64) | |
# k = key string (only characters in c64) |
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
import random, heapq | |
def ax2_bx_c(x, (a, b, c)): | |
return a * x**2 + b * x + c | |
def ax2_bx_c_fitness(x_range, ideal_params, test_params): | |
fitness = 0.0 | |
for x in x_range: | |
x = float(x) | |
fitness += ax2_bx_c(x, test_params) - ax2_bx_c(x, ideal_params) |