I hereby claim:
- I am joachifm on github.
- I am joachifm (https://keybase.io/joachifm) on keybase.
- I have a public key whose fingerprint is 8861 86AB 67A8 1027 B645 7717 66EA B6B1 4F6B 6E0D
To claim this, I am signing this object:
#! /usr/bin/env bash | |
awslocal() { | |
env \ | |
AWS_ACCESS_KEY_ID=test \ | |
AWS_SECRET_ACCESS_KEY=test \ | |
aws --region=us-east-1 --endpoint-url=http://127.0.0.1:4566 ${*} | |
} | |
set -u |
I hereby claim:
To claim this, I am signing this object:
The ideal service runs with the minimum set of privileges necessary to perform the task it is configured to do.
When writing new services, consider the following:
#pragma once | |
#include <stdbool.h> | |
/** A data table, with fast membership testing. | |
* | |
* Data tables are static arrays of data, with keys ranging from 0 to N-1. To | |
* distinguish unset elements from 0 values, tables also contain an array | |
* indicating whether a value has been set. | |
* |
#pragma once | |
/** Define an "optional" value, where the first bit indicates | |
* whether the value has been set and the remaining bits are used | |
* for the actual value. | |
* | |
* The up-side of this definition is that it is equally space efficient | |
* as simply storing an array of the underlying type. | |
* | |
* The down-side of this definition is that you lose a whole bit of possible |
{ pkgs ? import <nixpkgs>{} | |
, lib ? pkgs.lib | |
, configuration ? import ./configuration.nix | |
, nixos ? import <nixpkgs/nixos>{ inherit configuration; } | |
}: | |
let | |
inherit (lib) filterAttrs mapAttrs; | |
inherit (builtins) hasAttr getAttr; |
{-| | |
Hashing the concatenation of two strings leaves a "gap" between the | |
inputs, so that the hash may be recreated using any two substrings | |
of the original input: | |
@ | |
H("banana" <> "split") = H("banan" <> "asplit") = H("b" <> "ananasplit") | |
@ | |
Hashing the inputs before concatenation removes this gap: |
sbcl --load /usr/share/cl-quicklisp/quicklisp.lisp \ | |
--eval '(quicklisp-quickstart:install)' \ | |
--eval '(ql:add-to-init-file)' \ | |
--eval '(quit)' |
{-# LANGUAGE OverloadedStrings #-} | |
module Commitment ( Message, Commitment, Opening, commit, reveal ) where | |
import Crypto.Cipher.AES (initAES, encryptCTR, decryptCTR) | |
import qualified Data.ByteString.Lazy as LB | |
import qualified Data.ByteString as SB | |
-- |
import Control.Monad (guard) | |
import Control.Applicative ((<|>), (*>), pure) | |
import Data.Maybe (mapMaybe) | |
import Data.Monoid ((<>)) | |
fizzBuzz :: [Integer] -> [String] | |
fizzBuzz = mapMaybe (\x -> g 3 "Fizz" x <> g 5 "Buzz" x <|> pure (show x)) | |
where g d s x = guard ((x `rem` d) == 0) *> pure s |