I hereby claim:
- I am aleksandersumowski on github.
- I am aleksander (https://keybase.io/aleksander) on keybase.
- I have a public key whose fingerprint is 563B 3A4F 87CE 2346 1158 1919 E279 75D0 E823 3EA1
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
from transit.reader import Reader | |
from kafka import KafkaConsumer | |
from StringIO import StringIO | |
topic = '' | |
kafka_brokers = [] | |
consumer = KafkaConsumer(topic, | |
group_id='my_group', | |
bootstrap_servers=kafka_brokers, |
(defn tap [msg in] | |
(println msg in) | |
in) |
import Data.Char | |
import Debug.Trace | |
vigenere input keyword = let in_ord = trace "1" (map ((subtract 65) . ord) input) | |
key_ord = (map ((subtract 65) . ord) $ take (length input) (cycle keyword)) | |
sum_ord = zipWith (+) in_ord key_ord | |
next = map (mod 25) sum_ord | |
last = map (+ 65) sum_ord | |
in map chr last |
I hereby claim:
To claim this, I am signing this object:
(defn a-d-d [delay-size] | |
(fn [rf] | |
(let [state (volatile! [])] | |
(fn | |
([] (rf)) | |
([result] | |
(let [buffer @state] | |
(-> (if (seq buffer) | |
(rf result buffer) | |
result) |
The problem was to pattern match on two values with a guard predicate checking condition across both values.
Specifically to check whether account has enough limit to perform a transaction. I wanted to extract current account limit and transaction amount from incoming event, then check whether amount is less then the limit.
Below are implementations in three different pattern matching libraries.
Meander is the nicest. Supports the behaviour I would expect.
core.match couldn't bind the values from the matched maps to pass to the guard predicate. I had to destructure the maps to get the values within the predicate, kinda defeating the purpose of the pattern matching.
2020/06/19 18:08:14 [INFO] Terraform version: 0.12.26 | |
2020/06/19 18:08:14 [INFO] Go runtime version: go1.12.13 | |
2020/06/19 18:08:14 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/2.0.0/versions/0.12.26/terraform", "plan", "-out=tf.out"} | |
2020/06/19 18:08:14 [DEBUG] Attempting to open CLI config file: /Users/aleksandersumowski/.terraformrc | |
2020/06/19 18:08:14 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
2020/06/19 18:08:14 [INFO] CLI command args: []string{"plan", "-out=tf.out"} | |
2020/06/19 18:08:14 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config | |
2020/06/19 18:08:14 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory | |
2020/06/19 18:08:14 [DEBUG] New state was assigned lineage "a2b02c48-d401-473e-e2ac-07e1f5d03d62" | |
2020/06/19 18:08:14 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend) |
#!/opt/homebrew/bin/python3 | |
# CLI program to control the mediakeys on OS X. Used to emulate the mediakey on a keyboard with no such keys. | |
# Easiest used in combination with a launcher/trigger software such as Quicksilver. | |
# Main part taken from http://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac | |
# Glue to make it into cli program by Fredrik Wallner http://www.wallner.nu/fredrik/ | |
# requires installing `pyobjc` eg via `/opt/homebrew/bin/pip3 install -U pyobjc` | |
import Quartz | |
import sys |