Skip to content

Instantly share code, notes, and snippets.

View markbastian's full-sized avatar

Mark Bastian markbastian

View GitHub Profile
@markbastian
markbastian / numbermaze.md
Last active September 25, 2025 15:06
Number Maze

Write a program that computes the minimum number of steps required to go from a starting number to an ending number given the following rules:

  • A number may be doubled
  • You may add 2 to a number
  • A number may be halved if it is even

Example:

  • 2 → 9
  • Potential steps to get from 2 to 9:
  • 2, 4, 8, 16, 18, 9 (This can be done twice, doubling 2 or 2 + 2)
@markbastian
markbastian / MacInstall.md
Last active June 19, 2021 22:52
Tips for all you need to do to set up a new Mac
  • Install homebrew with /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Install Oh My Zsh with sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  • Install Clojure Tools Deps with brew install clojure/tools/clojure
  • Install babashka
  • Install Docker for Mac
  • Fix desktop switching at System Preferences... > Keyboard > Shortcuts > Mission Control. Note that this is NOT in Mission Control. Map Mission Control, Move left a space, and Move right a space to ctrl+opt+X vs. ctrl+X as ctrl+X will intefere with slurp and barf.
  • Change terminal shell to homebrew them at Terminal > Preferences > Profiles > Homebrew, then click "Default" at the bottom of the left side panel. Also, change the font size to something larger like 24pt.
  • Ma
@markbastian
markbastian / kafka-es-docker-compose.yaml
Created October 16, 2020 15:27
Trying to get kafka streams and connectors working
kafka:
image: landoop/fast-data-dev:latest
container_name: kafka
ports:
- 2181:2181
- 3030:3030
- 8081-8083:8081-8083
- 9581-9585:9581-9585
- 9092:9092
environment:
@markbastian
markbastian / enablejavaosx
Created July 19, 2020 04:34
Tip to get Java working on OS X
sudo spctl --master-disable
sudo spctl --master-enable
(defn easter [year]
(let [qm (juxt quot mod)
a (mod year 19)
[b c] (qm year 100)
[d e] (qm b 4)
f (quot (+ b 8) 25)
g (quot (inc (- b f)) 3)
h (mod (+ (* a 19) b (- d) (- g) 15) 30)
[i k] (qm c 4)
l (mod (+ 32 (* 2 e) (* 2 i) (- h) (- k)) 7)
@markbastian
markbastian / questions.md
Last active April 1, 2020 13:38
Compelling questions
  • What is the purpose of tests?
  • What is the purpose of documentation?
  • What is the opposite of complex?
  • Complete the quote by Edsger W. Dijkstra: "blank is the prerequisite for reliability" (Simplicity)
  • Does using a consistent language give you more immediate access to a problem?
  • How long should it take a person to get "up to speed" on:
    • a codebase?
    • a project?
  • a domain?
@markbastian
markbastian / system.clj
Last active July 23, 2021 00:48
Standard boilerplate for creating systems
(defonce ^:dynamic *system* nil)
(defn system [] *system*)
(defn start
([config] (alter-var-root #'*system* (fn [s] (or s (ig/init config)))))
([] (start config)))
(defn stop []
(alter-var-root #'*system* (fn [s] (some-> s ig/halt!))))
  1. Never do hardware
  2. Never do infrastructure
  3. Understand the problem
  4. Start with a press release
  5. Always be demo ready
  6. State features as "I can..."
  7. Paying down technical debt is not a feature and should not be a goal
  8. Data flows from the left, money flows from the right
  9. More prose, less code
@markbastian
markbastian / unfamiliar.html
Last active October 23, 2019 13:10
Unfamilar vs. Complex
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css">
<script src="http://cmx.io/v/0.1/cmx.js" charset="utf-8"></script>
<style>.cmx-user-scene4 .cmx-text-border .cmx-path {stroke: orange}</style>
<body>
<div style="max-width:900px; -webkit-transform:rotate(0deg)">
<scene id="scene1">
<label t="translate(0,346)">
@markbastian
markbastian / fullscreen.md
Created October 8, 2019 19:24
Full screen html tips
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>My File</title>
</head>
<body style="margin:0;padding:0;">
<canvas id="root" style="position:absolute; width:100%;height:100%;"/>