These are my notes on instaling NixOS 16.03 on a Lenovo ThinkPad X1 Carbon (4th generation) with an encrypted root file system using UEFI.
Most of this is scrambled from the following pages:
(def prime-numbers | |
((fn f [x] | |
(cons x | |
(lazy-seq | |
(f (first | |
(drop-while | |
(fn [n] | |
(some #(zero? (mod n %)) | |
(take-while #(<= (* % %) n) prime-numbers))) | |
(iterate inc (inc x)))))))) |
; Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/ | |
; in project.clj dependencies | |
; [com.impossibl.pgjdbc-ng/pgjdbc-ng "0.5"] | |
(ns pglisten.core | |
(:import [com.impossibl.postgres.jdbc PGDataSource] | |
[com.impossibl.postgres.api.jdbc PGNotificationListener])) |
These are my notes on instaling NixOS 16.03 on a Lenovo ThinkPad X1 Carbon (4th generation) with an encrypted root file system using UEFI.
Most of this is scrambled from the following pages:
(defn classes-of | |
"Get the classes of an element as a Clojure keyword vector." | |
[e] | |
(let [words (-> e (.getAttribute "class") (string/split " "))] | |
(mapv keyword words))) | |
(defn classes->str | |
"Change a Clojure keyword seq into an HTML class string." | |
[classes] | |
(->> classes (mapv name) (string/join " "))) |
Short (72 chars or less) summary
More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).
Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
use --property print.key=true | |
Example : ./kafka-console-consumer.sh --bootstrap-server <BROKERS_ADDRESS> --topic <YOUR_TOPIC> --property print.key=true |
-- important: compile with -threaded | |
import Control.Concurrent.STM | |
import Control.Applicative | |
-- |Wait for STM action specified amount of time and return value of action or default value if action times out | |
stmTimeout' :: Int -> a -> STM a -> IO a | |
stmTimeout' microseconds defVal f | |
= registerDelay microseconds |
Recently two different administrative users of a Haskell app I maintain started a long-running background job at the same time. This resulted in some Bad Things happening which I would like to prevent in the future!
So I want a lock. This app runs on at least two servers at any given time, so it needs to be a distributed lock, and for Reasons (not relevant to this blogpost) I can't use our Redis cache. So the PostgreSQL database it is!
This document is a short how-to. It doesn't contain a lot of details about each change you need to implement, but it contains lots of links to the corresponding documents. Please read these docs for refetence.
ESLint is the main tool to find deprecations in the code so first of all we need to configure it properly.