For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
sieve [] = [] | |
sieve (x:xs) = x: sieve notMutipleOfX | |
where notMutipleOfX = filter (\n -> n `mod` x /= 0 ) xs | |
primes = sieve [2..] | |
main = print $ take 5000 primes |
For excessively paranoid client authentication.
Organization & Common Name: Some human identifier for this server CA.
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
import itertools | |
from itertools import islice | |
from itertools import ifilter | |
def sieve(numbers): | |
head = next(numbers) | |
yield head | |
for x in sieve(ifilter(lambda x: x % head, numbers)): | |
yield x |
import Data.List | |
import qualified Data.Map as Map | |
sieve xs = sieve' xs Map.empty | |
sieve' [] table = [] | |
sieve' (x:xs) table = | |
case Map.lookup x table of | |
Nothing -> x: sieve' xs (Map.insert (x+x) [x] table) | |
Just facts -> sieve' xs (foldl' reinsert (Map.delete x table) facts) |
from itertools import ifilter | |
from itertools import islice | |
def sieve_worker(numbers, table): | |
head = next(numbers) | |
if head not in table: | |
yield head | |
table[head+head] = [head] | |
else: |
(defn decreasing-from-last [v] | |
(loop [start (dec (.length v))] | |
(let | |
[prev-start (dec start)] | |
(cond | |
(< prev-start 0) 0 | |
(neg? (compare (get v prev-start) (get v start))) start | |
:else (recur (dec start)))))) | |
(defn next-permutation [v] |
(defn veckey-to-set [veckey] | |
(reduce (fn [[column set-key] k] | |
(if (contains? set-key k) | |
[column set-key] | |
[(conj column k) (conj set-key k)])) | |
[[] #{}] | |
veckey)) | |
(defn handle-rest-char [set-key] | |
(let [char-seq (map char (range (int \A) (inc (int \Z))))] |
import timeit | |
t1 = timeit.default_timer() | |
# run a long long time | |
t2 = timeit.default_timer() | |
print(t2 - t1) |
[1,[[2],3]] |> List.flatten |> Enum.reverse |> Enum.map(fn(x) -> x * x end) |
(def b '[3 - - - - 5 - 1 - | |
- 7 - - - 6 - 3 - | |
1 - - - 9 - - - - | |
7 - 8 - - - - 9 - | |
9 - - 4 - 8 - - 2 | |
- 6 - - - - 5 - 1 | |
- - - - 4 - - - 6 | |
- 4 - 7 - - - 2 - | |
- 2 - 6 - - - - 3]) |