Skip to content

Instantly share code, notes, and snippets.

@loganlinn
loganlinn / uuid_bytearray.kt
Created November 30, 2018 00:27
Kotlin extension function to convert UUID to ByteArray
import java.nio.ByteBuffer
import java.util.UUID
fun UUID.asBytes(): ByteArray {
val b = ByteBuffer.wrap(ByteArray(16))
b.putLong(mostSignificantBits)
b.putLong(leastSignificantBits)
return b.array()
}
@loganlinn
loganlinn / gist:2e07e914439218dfbeb0670d40d86be1
Created January 24, 2024 09:50
Details! Profile Import String
T31EVTnss(pnhUDb2eW3p(t5y7eJylNZuzMDWzygkjkjUHIuljvC0EyYN9RQQFWMVKPDCMjz3maZmYsn7U6QRUQF1JU5D63n7UGDf5RssJXpM)P4IO00WfPXrfHzX3xLxSEtuz1DNCxWIODv7lIdlIJsXgVb))W3xUlonDbVrBtkxSmQkc)C0(c6)hNfxS(a(PLrBJwhdFQ6UGI87dxfTmomjd6TP63faFyQXDt1EPb(77sJoexeUmUkkjTm8(KSL53JJB5IiGAXhO8JWJeCw6NE)f3fmhO4Q4pJK4DbbF8qAswm2p48H1xLHra5VUiF)U7MFxW(syUaeruwY2OQK8SsKelI3LxufItUqOl(yj2u2GxYO389vCcg)KcfVnb6P9BdLCX8TZJQcRs2IKRgm9JJQ2ewLNNwLSdMrlR2C3utBn5OwLhE)M87caMDAuzziWAxuc9tEXYsCmDmyJmoI26(2M6g2CkW0f(Kj(j67SyTbiRP6woUYht0ChdrZfn2H1AhtzBPU0G3ME7AdG25TM3sDr)YBNUOH6YUTMMhQTQZY2tVMTfMBEYg7iBT7atod76zNhF2P3pnyn0eRhMG9rMBDAUJZXATSX4eM68JT21T1kCdtdp9UCKUpIV8rKR3Ed3ChTH4GDARTR7rwi7S2OiC3dJHEol2ZH9TN(rKt701whPXT6zdh7JWX70yNJj(1P1UhJx3P1hv0UJyOJ)GRmDARR2XiK2nxP1dR2P9QVUMXWm9M72C1hKYBXt01mhEXPvNAm4o4wIh6AwhHr3wHJR5XyDT6ALg3JmDhXuZJTFPdRW(iesl1zo6dYmAl1z7CK9kTxKR3R0PF70uRJSTQLexfAaeHGSpJmxhVennJgSbdQvPX4xMTmSmUam1gUlQa(eANEhyIF(8I4pLqg0Xop4(8I0LcBXjLHvfrLBOg)PDHrLC8aq3ppp)JBJk(iHIiSm5FHwTbR8s8bO544LHGzEOp(uCksUw23fa)1IpgMufVnmng)EOZjKcu7PPNDBJ
(require
'[clojure.edn :as edn]
'[clojure.java.io :as io]
'[clojure.string :as str])
(defn read-workspace
([] (read-workspace "."))
([ws-dir]
(-> ws-dir
#!/usr/bin/env bash
run() {
while :; do
unset REPLY
printf %s "run $*? [Y/n/q] " > /dev/tty
read -r REPLY < /dev/tty
case ${REPLY:-y} in
[yY]*)
if ! "$@"; then
@loganlinn
loganlinn / alpha.clj
Last active December 3, 2022 10:25
Clojure C4 Model #hack
(ns c4.alpha
"A library for [C4 model](c4model.com)")
(declare rel)
(defrecord Shape [label description sprite tags link])
(def ^:dynamic *boundaries* (list))
(def ^:private hierarchy
(ns openmoji
(:require
[clojure.string :as str]
[clojure.data.csv :as csv]
[clojure.java.io :as io]
[babashka.fs :as fs]
[babashka.curl :as curl]
[clojure.string :as str]))
(defn download-data
@loganlinn
loganlinn / config.yml
Last active June 30, 2022 19:25
github cli config
aliases:
pv: pr view --web
land: pr merge --squash --delete-branch
config-export: '!cat ~/.config/gh/config.yml | jq --raw-input --slurp -r "{files: {\"config.yml\": {content: .}}}" | gh api -X PATCH /gists/ba5517759522578585830221e88c1658 --input - | jq .html_url | xargs open'
clone: |-
!mkdir -p "${CODE}/$1" && gh repo clone "$1" "${CODE}/$1"
v: repo view --web
@loganlinn
loganlinn / dijkstra.clj
Last active March 21, 2022 15:01
Dijkstra's Algorithm in Clojure
(def ^:private inf (Long/MAX_VALUE))
(defn neighbors
"Returns n's neighbors, optionally filtered if unvisited"
([g n] (get g n {}))
([g n uv] (select-keys (neighbors g n) uv)))
(defn update-costs
"Returns costs updated with any shorter paths found to curr's unvisisted
neighbors by using curr's shortest path"
@loganlinn
loganlinn / console.js
Created January 25, 2022 23:30
Bulk delete custom Slack emojis with filter
intervalId = setInterval(function() {
els = Array.from(
document.getElementsByClassName("c-virtual_list__item")
).filter(
(el) => el.innerText.includes(":azure_")
)
console.log("Matches found:", els.length)
if (!els.length) {
clearInterval(intervalId)
@loganlinn
loganlinn / spacemacs-keybindings
Created January 24, 2022 22:19 — forked from adham90/spacemacs-keybindings
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |