I've been working with Apache Kafka for over 7 years. I inevitably find myself doing the same set of activities while I'm developing or working with someone else's system. Here's a set of Kafka productivity hacks for doing a few things way faster than you're probably doing them now. 🔥
I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.
Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."
The question was asked why I (as a programmer who prefers dynamic languages) don't consider static types "worth it". Here | |
is a short list of what I would need from a type system for it to be truely useful to me: | |
1) Full type inference. I would really prefer to be able to write: | |
(defn concat-names [person] | |
(assoc person :full-name (str (:first-name person) | |
(:second-name person)))) | |
And have the compiler know that whatever type required and produced from this function was acceptible as long as the |
(defn invoke-private-method [obj fn-name-string & args] | |
(let [m (first (filter (fn [x] (.. x getName (equals fn-name-string))) | |
(.. obj getClass getDeclaredMethods)))] | |
(. m (setAccessible true)) | |
(. m (invoke obj args)))) | |
(defn private-field [obj fn-name-string] | |
(let [m (.. obj getClass (getDeclaredField fn-name-string))] | |
(. m (setAccessible true)) | |
(. m (get obj)))) |
# .ebextensions/01-ebs.config | |
commands: | |
01clear-if-unmounted: | |
command: if ! mount | grep /media/ebs_volume > /dev/nul; then rm -rf /media/ebs_volume; fi | |
02attach-volume: | |
command: aws ec2 attach-volume --region eu-central-1 --volume-id vol-ddb08e34 --instance-id $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --device /dev/sdh | |
ignoreErrors: true | |
03wait: | |
command: sleep 10 | |
04trymount: |
This is a simple launchd config that will start your default
docker-machine on startup. You can customize the machine that is started by updating lines 11 and 16 with the correct machine name.
- Copy the file
com.docker.machine.default.plist
below to~/Library/LaunchAgents/com.docker.machine.default.plist
. - Run the following in a terminal:
launchctl load ~/Library/LaunchAgents/com.docker.machine.default.plist
- Profit!
Updated: Just use qutebrowser (and disable javascript). The web is done for.
import java.time.format.DateTimeFormatter; | |
import java.time.Instant; | |
import java.time.ZonedDateTime; | |
import java.time.ZoneId; | |
import java.time.ZoneOffset; | |
Instant.now(); | |
// java.time.Instant = 2015-08-13T09:28:27.141Z | |
DateTimeFormatter.ISO_INSTANT.format(Instant.now()); |
""" | |
This is a batched LSTM forward and backward pass | |
""" | |
import numpy as np | |
import code | |
class LSTM: | |
@staticmethod | |
def init(input_size, hidden_size, fancy_forget_bias_init = 3): |
#!/bin/bash | |
for f in $(egrep -o -R "defn?-? [^ ]*" * --include '*.clj' | cut -d \ -f 2 | sort | uniq); do | |
echo $f $(grep -R --include '*.clj' -- "$f" * | wc -l); | |
done | grep " 1$" |