Skip to content

Instantly share code, notes, and snippets.

@exupero
exupero / latitudes.geojson
Created July 9, 2025 13:42
XKCD's possible latitudes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@exupero
exupero / stack-math.clj
Last active December 31, 2023 16:29
Stack math evaluator
#!/usr/bin/env bb
(ns stack-math
(:require [clojure.string :as str]
[clojure.core.match :refer [match]]
[clojure.tools.cli :as cli]))
(defn parse-stack [s]
(read-string (format "[%s]" s)))
#!/usr/bin/env bb
(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {org.clojars.askonomm/ruuter {:mvn/version "1.3.2"}}})
(require '[clojure.java.browse :as browse]
'[clojure.string :as str]
'[cheshire.core :as json]
'[org.httpkit.server :as srv]
'[ruuter.core :as ruuter]
@exupero
exupero / serve.clj
Created January 30, 2023 16:11
Babashka HTTP server that watches files
#!/usr/bin/env bb
(ns server
(:require [clojure.string :as string]
[clojure.java.browse :as browse]
[clojure.tools.cli :refer [parse-opts]]
[babashka.fs :as fs]
[org.httpkit.server :as server])
(:import [java.net URLDecoder]
[java.time Instant]))
@exupero
exupero / README.md
Last active February 6, 2024 22:24
Mid-oceanic ridge

Traced from this image of crustal age and assuming an equirectangular projection.

I've imagined a connection between where the ridge disappears under Alaska and where it emerges from eastern Siberia.

If you know where I can find proper geographical coordinates for the mid-oceanic ridge, please leave a comment.

@exupero
exupero / README.md
Last active January 20, 2022 17:00
Michigan county line roads
  • Orange roads use "County Line" names
  • Red roads use hyphenated names
  • Blue roads use portmanteaus
@exupero
exupero / README.md
Last active January 28, 2022 18:15
Michigan Big Trees
@exupero
exupero / IntellijNrepl.java
Created April 17, 2019 15:01
Launching a Clojure nREPL from IntelliJ
package squij;
import clojure.lang.*;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
@exupero
exupero / advent-of-code-2018.clj
Last active December 25, 2018 20:09
Advent of Code 2018
(ns exupero.advent-of-code.2018
(:require [clojure.string :as string]
[clojure.set :refer [intersection rename-keys map-invert]]
[clojure.zip :as zip]
[net.cgrand.xforms :as xf]))
(def parse-int #(Integer/parseInt %))
; Day 1, puzzle 1
(def input-1 (map parse-int (string/split-lines (slurp "./resources/advent-of-code/2018/day-1-input.txt"))))
@exupero
exupero / building.clj
Created October 23, 2018 00:55
A state machine example
; Constructing a physical building is, ideally, a linear process, but in reality there can be twists
; and turns and backtracking to previous steps. Here's a state machine that models a simple,
; hypothetical construction process:
(def construction-process
{:concept {:revised-concept :concept
:township-approved :township-permission
:township-rejected :terminated}
:township-permission {:blueprints-delivered :blueprints}
:blueprints {:code-violations :blueprints-in-revision