Skip to content

Instantly share code, notes, and snippets.

@rm-hull
rm-hull / einsteins-zebra-puzzle.md
Last active Dec 5, 2020
@swannodette: "Reminder Norvig could solve Einstein's Puzzle in 17s in '93 using Common Lisp, today milliseconds in your browser"
View einsteins-zebra-puzzle.md

From https://en.wikipedia.org/wiki/Zebra_Puzzle

  1. There are five houses.
  2. The Englishman lives in the red house.
  3. The Spaniard owns the dog.
  4. Coffee is drunk in the green house.
  5. The Ukrainian drinks tea.
  6. The green house is immediately to the right of the ivory house.
  7. The Old Gold smoker owns snails.
  8. Kools are smoked in the yellow house.
@rm-hull
rm-hull / maze.cljs
Last active Mar 29, 2020
Maze generator and solver using Dijkstra's graph search algorithm, served up in ClojureScript & rendered on a HTML5 canvas. Try adding ?draw=X to the URL where X is one of none, path, snake or snail
View maze.cljs
(ns maze.core
(:use [enchilada :only [canvas ctx value-of canvas-size]]
[monet.canvas :only [get-context stroke stroke-style stroke-cap begin-path close-path line-to move-to stroke-width]]
[monet.core :only [animation-frame]]
[jayq.core :only [$ document-ready data attr hide show]]
[maze.util :only [coord->pos]]
[maze.generator :only [create-maze]]
[maze.solver :only [solve]]))
(defn draw-path-segments [ctx snake start end]
@rm-hull
rm-hull / script.pl
Created Jul 20, 2019 — forked from bessarabov/script.pl
Script to generate data shown in post 'At what time of day does famous programmers work? Part 2. Workweek vs Weekend.' — https://ivan.bessarabov.com/blog/famous-programmers-work-time-part-2-workweek-vs-weekend
View script.pl
#!/usr/bin/perl
# This script is made to show graphs with git commit time made on workweek vs weekend
#
# The desription of this script and results of its usage is avaliable at:
# https://ivan.bessarabov.com/blog/famous-programmers-work-time-part-2-workweek-vs-weekend
#
# usage:
#
# git log --author="Sebastian Riedel" --format="%H %ai" | perl script.pl
@rm-hull
rm-hull / psychedelic-animation.cljs
Last active May 14, 2019
ClojureScript re-implementation of a js1k.com runner up, originally by Piotr Stosur: "Animated fractal shapes (mainly rotating spirals) similar to CEVs after taking psychedelic/dissociative drugs. :P Based on copying previous frame into 4 smaller fragments (once per frame, no other kind of iterations) so it's much faster than per-pixel fractal g…
View psychedelic-animation.cljs
; rewritten in Clojurescript from javascript (originally by Piotr Stosur: http://js1k.com/2013-spring/demo/1431)
(ns psychedelic-animation.demo
(:use [enchilada :only [canvas svg ctx]]
[jayq.core :only [show hide]]
[monet.core :only [animation-frame]]
[monet.canvas :only [fill-style fill-rect draw-image rotate translate]]))
(show canvas)
(hide svg)
View keybase.md

Keybase proof

I hereby claim:

  • I am rm-hull on github.
  • I am rhu (https://keybase.io/rhu) on keybase.
  • I have a public key ASAlyPkfDitTkB4MCdhTjMXTFIdzrBMeS1n4MyUgahQ3VQo

To claim this, I am signing this object:

View pixel_spaceships.pde
// Pixel Spaceships
// David Bollinger - July 2006
// http://www.davebollinger.com
// for Processing 0115 beta
// (updated for 0119 Beta)
/**
Click mouse to advance early to next pattern<br>
*/
@rm-hull
rm-hull / flower-of-life.cljs
Last active Dec 10, 2017
Flower of Life, in ClojureScript ... originally in JavaScript by Tristan Brehaut [http://js1k.com/2013-spring/details/1362]: "Randomly generated spiraling energetic patterns depicting the flower of life in 5 dimensions, or something :) Refresh window for a new flower."
View flower-of-life.cljs
;; Adapted from javascript version by Tristan Brehaut at
;; http://js1k.com/2013-spring/details/1362
(ns flower-of-life.demo
(:use [monet.canvas :only [save restore begin-path end-path translate rotate
stroke stroke-style fill-style fill-rect move-to
bezier-curve-to composition-operation]]
[monet.core :only [animation-frame]]
[jayq.core :only [show]]
[enchilada :only [ctx canvas]]))
@rm-hull
rm-hull / unknown-pleasures.cljs
Last active Oct 10, 2017
PSR B1919+21 is a pulsar with a period of 1.3373 seconds, and a pulse width of 0.04 second. It was the first radio pulsar discovered (on November 28, 1967 by Jocelyn Bell Burnell and Antony Hewish). The power and regularity of the signals was thought to resemble a beacon, so for a time the source was nicknamed "LGM-1" (for "Little Green Men"). A…
View unknown-pleasures.cljs
(ns big-bang.examples.unknown-pleasures
(:require
[jayq.core :refer [show]]
[enchilada :refer [ctx canvas canvas-size value-of]]
[big-bang.examples.unknown-pleasures.data :refer [data-points]]
[monet.canvas :refer [begin-path move-to line-to close-path
fill fill-rect fill-style
stroke-join stroke-cap stroke-width stroke-style stroke
translate scale save restore]]))
@rm-hull
rm-hull / three.cljs
Last active Apr 11, 2017 — forked from michiakig/three.cljs
Simple demonstration of using THREE.js with ClojureScript [from a fork of https://gist.github.com/spacemanaki/1157978], now working with thanks to @seabre
View three.cljs
(ns three.demo
(:require [THREE :as THREE]))
(def camera
(THREE/PerspectiveCamera.
75
(/ 800 600)
1
10000))
You can’t perform that action at this time.