Skip to content

Instantly share code, notes, and snippets.

@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@itod
itod / split_keyboards.md
Last active April 24, 2024 16:06
Every "split" mechanical keyboard currently being sold that I know of
@ssrihari
ssrihari / clojure-learning-list.md
Last active April 24, 2024 03:06
An opinionated list of excellent Clojure learning materials

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language
#!/usr/bin/perl
# This filter changes all words to Title Caps, and attempts to be clever
# about *un*capitalizing small words like a/an/the in the input.
#
# The list of "small words" which are not capped comes from
# the New York Times Manual of Style, plus 'vs' and 'v'.
#
# 10 May 2008
# Original version by John Gruber:
@technomancy
technomancy / style.md
Last active January 22, 2024 22:45
Clojure Style Guide: commentary

The Clojure Style Guide is pretty good overall. It's very detailed and most of its advice is solid. There are handful of places it makes bad recommendations or is missing some advice.

Many of these criticisms apply to the output of linters like clj-kondo as well.

threading macros vs let

@ericnormand
ericnormand / 00_script.clj
Last active January 6, 2024 07:13
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@miketheman
miketheman / zook_grow.md
Created July 22, 2013 21:36
Adding nodes to a ZooKeeper ensemble

Adding 2 nodes to an existing 3-node ZooKeeper ensemble without losing the Quorum

Since many deployments may start out with 3 nodes and so little is known about how to grow a cluster from 3 memebrs to 5 members without losing the existing Quorum, here is an example of how this might be achieved.

In this example, all 5 nodes will be running on the same Vagrant host for the purpose of illustration, running on distinct configurations (ports and data directories) without the actual load of clients.

YMMV. Caveat usufructuarius.

Step 1: Have a healthy 3-node ensemble

@sudodoki
sudodoki / flatten-maps.clj
Last active November 29, 2023 00:26
Flatten nested maps using clojure / clojurescript using compound keys
(defn get-key
[prefix key]
(if (nil? prefix)
key
(str prefix "-" key)))
(defn flatten-map-kvs
([map] (flatten-map-kvs map nil))
([map prefix]
(reduce
(fn [memo [k v]]
@aktau
aktau / imessage
Last active June 11, 2023 20:30
Send iMessage from the commandline
#!/bin/sh
if [ "$#" -eq 1 ]; then stdinmsg=$(cat); fi
exec <"$0" || exit; read v; read v; read v; exec /usr/bin/osascript - "$@" "$stdinmsg"; exit
-- another way of waiting until an app is running
on waitUntilRunning(appname, delaytime)
repeat until my appIsRunning(appname)
tell application "Messages" to close window 1
delay delaytime
end repeat
@bhb
bhb / README.md
Last active May 15, 2023 01:28
Clojure friendly mode, inspired by https://github.com/slipset/friendly