Skip to content

Instantly share code, notes, and snippets.


Saager Mhatre dexterous

View GitHub Profile
View factorial.clj
(defn how-not-to-factorial [x]
(condp #(< %2 %1) x
1 (throw (IllegalArgumentException.))
3 x
(loop [acc (bigint x) prev (dec x)]
(if (= prev 2) (* acc 2) (recur (* acc prev) (dec prev))))))
;; when you want to factorial...
(defn just-factorial [n] (apply * (range 1N (inc n))))
dexterous /
Last active Jun 4, 2021
Article text from "Is DevOps Falling into the Maturity Trap?"

Is DevOps Falling into the Maturity Trap?

@DevOpsSummit #CloudNative #Serverless #DevOps


APRIL 29, 2018 07:00 PM EDT

Guest post by Intellyx Principal Analyst Charles Araujo

I was at a conference recently when I saw it. I sighed and shook my head.


Art is Not About You

Forked from a community statement about Clojure

The only people entitled to say how art 'ought' to work are people who make art, and the scope of their entitlement extends only to their own art.

Just because someone creates something does not imply they owe the world a change in their status, focus and effort, e.g. from artist to community manager.

As an appreciator of a piece of art you are not thereby entitled to anything at all. You are not entitled to a say in how it evolves. You are not entitled to timely updates. You are not entitled to the attention of the artist. You are not entitled to having value attached to your complaints. You are not entitled to this explanation.

View path_props.clj
(->> (System/getProperties)
(filter #(clojure.string/ends-with? (key %) ".path"))
(map #(clojure.string/join "\n\t" (cons (key %) (clojure.string/split (val %) (re-pattern
(clojure.string/join "\n\n")
#!/bin/bash -e
if [[ -n "$DEBUG" ]]; then
set -x
PS4='+ [ $(date +%T) ] '
if [[ -f ./main.exe && ./main.exe -ot ./main.cs ]]; then
echo -n "Compiled binary outdated; removing... "
View vimium-options.json
"settingsVersion": "1.67",
"exclusionRules": [
"pattern": "https?://(mail|calendar|keep|photos|groups|drive|meet|chat)*",
"passKeys": ""
"pattern": "https?://*",
"passKeys": ""
dexterous /
Last active Jan 21, 2022
Some people just don't get how to do concurrency/parallelism right. (sigh!)
import boto3
import sys
import Queue
import threading
work_queue = Queue.Queue()
sqs = boto3.resource('sqs')
from_q_name = sys.argv[1]
dexterous / TestHarnessHTTPServer.groovy
Last active Oct 21, 2020
Quick and dirty HTTP server for functional tests that presents itself as a Future.
View TestHarnessHTTPServer.groovy
import java.util.concurrent.CompletableFuture
import java.util.concurrent.TimeUnit
import java.util.concurrent.CancellationException
import java.util.concurrent.TimeoutException
View sum-of-squares.clj
(defn sum [coll]
(apply + coll))
(defn squares [coll]
(map #(* % %) coll))
(def first-n take)
(defn integers []
(iterate inc 1))
dexterous / fizzbuzz
Created Oct 7, 2017
A succinct bash fizzbuzz
View fizzbuzz
#!/bin/bash -e
#set -o xtrace
if [[ $# -lt 1 ]]; then
echo '
Usage: fizzbuzz upto
upto: The number upto which to count