Skip to content

Instantly share code, notes, and snippets.

View telekid's full-sized avatar
👨‍🚀

Jake telekid

👨‍🚀
View GitHub Profile
@reborg
reborg / rich-already-answered-that.md
Last active May 8, 2024 14:20
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@Azel4231
Azel4231 / intro.clj
Last active May 11, 2020 19:24
Dependent types with clojure.spec (requires clojure-1.9alpha16+)
;; "Can you model dependent types in clojure.spec?"
;; What are dependent types?
;; -> Parts of the data depend on each other
;; -> The structure of the data depends on certain values in the data itself
[3 "A" "B" "C"]
;; [count & elements]
;; Valid:

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@fnky
fnky / ANSI.md
Last active June 5, 2024 17:07
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@ericnormand
ericnormand / 00_script.clj
Last active May 18, 2024 08:30
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='
@Omar-Ikram
Omar-Ikram / EndpointSecurityDemo.m
Last active May 30, 2024 23:57
A demo of using Apple's EndpointSecurity framework - tested on macOS Monterey 12.2.1 (21D62)
//
// main.m
// EndpointSecurityDemo
//
// Created by Omar Ikram on 17/06/2019 - macOS Catalina 10.15 Beta 1 (19A471t)
// Updated by Omar Ikram on 15/08/2019 - macOS Catalina 10.15 Beta 5 (19A526h)
// Updated by Omar Ikram on 01/12/2019 - macOS Catalina 10.15 (19A583)
// Updated by Omar Ikram on 31/01/2021 - macOS Big Sur 11.1 (20C69)
// Updated by Omar Ikram on 07/05/2021 - macOS Big Sur 11.3.1 (20E241)
// Updated by Omar Ikram on 04/07/2021 - macOS Monterey 12 Beta 2 (21A5268h)
(require '[clojure.core.async.impl.protocols :as impl]
'[clojure.core.async.impl.dispatch :as dispatch])
;;=> nil
(extend-type java.util.concurrent.CompletionStage
impl/ReadPort
(take! [this handler]
(.whenCompleteAsync this
(reify
@juskrey
juskrey / auto.clj
Created April 1, 2020 10:48
Clojure FSM sample
(ns sentinel.auto
(:require [taoensso.timbre :as timbre]
[clojure.core.match.date :refer :all]
[clojure.core.match :refer [match]]
[clojure.core.match.regex :refer :all]
[clojure.string :as st]
[clojure.core.async :refer [chan close! buffer go-loop to-chan <! >! >!! <!!] :as async]
[clojure.core.async.impl.protocols :as impl]
[clojure.spec.alpha :as s]
[clojure.core.async :as async]))
@borkdude
borkdude / macro.clj
Last active August 19, 2020 12:40
shell macro
(require '[clojure.java.shell :as sh]
'[clojure.string :as str])
(defn format-arg [arg]
(cond
(symbol? arg) (str arg)
(seq? arg) (let [f (first arg)]
(if (and (symbol? f) (= "unquote" (name f)))
(second arg)
arg))