Skip to content

Instantly share code, notes, and snippets.

@dazld
dazld / Makefile
Created July 21, 2020 14:56
KMS encryption / decryption example
KEY_ID=arn:aws:kms:eu-central-1:ef96e7f3:key/ef96e7f3-d6f1-4e69-8444-55d90ca3fa25
.PHONY: encrypt-text
encrypt-text: ## encrypt text in format make SECRET_TEXT=foo encrypt-text into a binary that can be piped to a file
@aws kms encrypt --key-id ${KEY_ID} --plaintext ${SECRET_TEXT} --query CiphertextBlob --output text | base64 --decode
.PHONY: decrypt-text
decrypt-text: ## decrypt an encrypted binary via make SECRET_BINARY=some_file.bin decrypt-text into plaintext std output
@aws kms decrypt --ciphertext-blob fileb://`pwd`/${SECRET_BINARY} --query Plaintext --output text | base64 --decode
[
{
"iso2": "AD",
"name": "Andorra"
},
{
"iso2": "AE",
"name": "United Arab Emirates"
},
{

Top fifty films for children up to the age of 14

Rescued from http://www.bfi.org.uk/education/conferences/watchthis/top50.html and compiled originally by the BFI.

In alphabetical order:

  • A Day at the Races (Sam Wood, 1937, USA)
  • The Adventures of Robin Hood (Michael Curtiz/William Keighley, 1938, USA)
  • Au revoir les enfants (Louis Malle, 1987, France/W.Germany)
  • Back to the Future (Robert Zemeckis, 1985, USA)
@dazld
dazld / post.md
Last active January 21, 2020 17:27
datomic forum post draft

I'm trying to understand how to use the datoms API better - and doing so with a specific objective in mind, for optimising some sorting and aggregation queries.

Setup is as follows:

(require '[datomic.api :as d])

(def uri "datomic:mem://golfing")

(d/create-database uri)
echo 200 | sudo tee /sys/class/backlight/edp-backlight/brightness values from 0-255
dazld, a "%U" is missing in the long Exec line in /usr/share/applications/chromium-browser.desktop Just add %U at the end of the longest Exec=... line
@dazld
dazld / core.clj
Last active October 14, 2018 13:51
accumulate values for processing in another thread
(ns batches.core
(:require [clojure.core.async :as a]))
(defprotocol Accumulating
(add [this v])
(stop [this]))
(defn accumulate
"Periodically invoke action with values, which can be conj'd onto the store with add. Allows the invocation to be cancelled´´
by calling (stop (accumulate identity))"
(deftest middlewares
(testing "chain"
(let [add (fn [f v]
(fn [input]
(+ (f input) v)))
sub (fn [f v]
(fn [input]
(- (f input) v)))
chain (-> identity
[dan@work react-event-listener]$ cloc .
19665 text files.
16281 unique files.
Complex regular subexpression recursion limit (32766) exceeded at /usr/local/Cellar/cloc/1.78/libexec/bin/cloc line 9013.
Complex regular subexpression recursion limit (32766) exceeded at /usr/local/Cellar/cloc/1.78/libexec/bin/cloc line 9013.
Complex regular subexpression recursion limit (32766) exceeded at /usr/local/Cellar/cloc/1.78/libexec/bin/cloc line 9013.
Complex regular subexpression recursion limit (32766) exceeded at /usr/local/Cellar/cloc/1.78/libexec/bin/cloc line 9013.
Complex regular subexpression recursion limit (32766) exceeded at /usr/local/Cellar/cloc/1.78/libexec/bin/cloc line 9013.
5316 files ignored.
@dazld
dazld / go.sh
Last active October 12, 2018 12:15
imagemagick.. magic
#!/usr/local/bin/bash
shopt -s globstar nullglob
in=""
out=""
process () {
local in=$1
local out=$2
convert "$in" -intent relative -black-point-compensation -colorspace RGB -bordercolor white -border 5\% -thumbnail "1000000@>" -gravity center -bordercolor "rgba(64,64,64,0.3)" -border 1 \( +clone -background black -shadow 30x16-10+20 \) +swap -background "#F5F5F5" -layers merge +repage -extent 1350x1350+15+0 "$out"
➜ ios re-natal init foo
Creating foo
☕ Grab a coffee! I will use yarn, but fetching deps still takes time...
Creating Leiningen project
Updating Leiningen project
Creating React Native skeleton.
Creating Re-Natal config
Compiling ClojureScript
To get started with your new app, first cd into its directory: