Skip to content

Instantly share code, notes, and snippets.

View brinchj's full-sized avatar
💭
Vacation

Johan Brinch brinchj

💭
Vacation
View GitHub Profile
@brinchj
brinchj / Gækkebrev.py
Created June 24, 2020 19:39
Mit navn det står med python
str = lambda x: x.__str__()
l=[42]
class o(list):
def __add__(s,a): list.append(s, str(a))
def __xor__(s,a): map(str,[a[0]]*a[1]); s+a[0]
def __str__(s): return ''.join(s)
def d(_):
def d_(f):
@brinchj
brinchj / Gækkebrev.hs
Created June 24, 2020 19:37
Mit navn det står i Haskell
import List
data AllToTheRight = AllToTheRight {
clown :: Int
, joker :: Int
} deriving (Show)
el h l a = reverse b where
(_, b) = foldl(\(a,b) h->(a+h,(l!!a):b))(a,[])h
> cargo benchcmp bench-old bench-new
name bench-old ns/iter bench-new ns/iter diff ns/iter diff %
crypto::auth::hmacsha256::bench_m::bench_auth 208,235 207,778 -457 -0.22%
crypto::auth::hmacsha256::bench_m::bench_verify 209,958 209,404 -554 -0.26%
crypto::auth::hmacsha512256::bench_m::bench_auth 220,250 218,981 -1,269 -0.58%
crypto::auth::hmacsha512256::bench_m::bench_verify 221,501 223,381 1,880 0.85%
crypto::auth::hmacsha512::bench_m::bench_auth 219,931 219,618 -313 -0.14%
crypto::auth::hmacsha512::bench_m::bench_verify 224,430 225,280 850 0.38%
crypto::box_::curve25519xsalsa20poly1305::bench::bench_precompute 6,209,422

Keybase proof

I hereby claim:

  • I am brinchj on github.
  • I am brinchj (https://keybase.io/brinchj) on keybase.
  • I have a public key whose fingerprint is E0B5 1271 F515 BF55 0037 71C3 D1D0 5EF1 0654 067A

To claim this, I am signing this object:

extern mod sqlite;
use sqlite::types::SQLITE_OK;
fn open_db(path: ~str) -> sqlite::database::Database {
match sqlite::open(path) {
Ok(db) => db,
Err(r) => fail!(r)
}
(lblX, SIf cond lblY) <- ifP
body1 <- untilLabel lblY
case lastMay body1 of
-- if with else (body1 ends in GOTO)
Just (_, SGoto lblZ) -> do
body2 <- untilLabel lblZ
return [(lblX, SIfElse cond body2 (init body1))]
-- if with no else
(lblX, SIf cond lblY) <- ifP
 body1 <- untilLabel lblY
 case lastMay body1 of
   -- if with else (body1 ends in GOTO)
   Just (_, SGoto lblZ) -> do
     body2 <- untilLabel lblZ
     return [(lblX, SIfElse cond body2 (init body1))]
   -- if with no else
> git clone https://github.com/MateVM/hs-java.git
Cloning into 'hs-java'...
remote: Counting objects: 494, done.
remote: Compressing objects: 100% (183/183), done.
remote: Total 494 (delta 299), reused 494 (delta 299)
Receiving objects: 100% (494/494), 103.25 KiB | 98 KiB/s, done.
Resolving deltas: 100% (299/299), done.
> cd hs-java
> l
module Main where
-- A MoreList is either a More value which contains a list of MoreList's, or
-- an Elem value, which contains a single value of type a
data MoreList a = More [MoreList a]
| Elem a
-- printE takes a MoreList and prints all its Elem values,
-- recursing on More values
module Main where
import System.Environment
import Data.ByteString.Char8 as B
import Data.Map as M
import Data.List as L
import Data.Maybe