Skip to content

Instantly share code, notes, and snippets.

@rm-hull
rm-hull / DHT.c
Last active December 18, 2022 15:40
// How to access GPIO registers from C-code on the Raspberry-Pi
// Example program
// 15-January-2012
// Dom and Gert
//
/*
$ wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.8.tar.gz
$ tar -zxvf bcm2835-1.8.tar.gz
$ cd bcm2835-1.8
@rm-hull
rm-hull / einsteins-zebra-puzzle.md
Last active October 14, 2022 05:25
@swannodette: "Reminder Norvig could solve Einstein's Puzzle in 17s in '93 using Common Lisp, today milliseconds in your browser"

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 / three.cljs
Last active March 27, 2021 10:13 — 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
(ns three.demo
(:require [THREE :as THREE]))
(def camera
(THREE/PerspectiveCamera.
75
(/ 800 600)
1
10000))
@rm-hull
rm-hull / maze.cljs
Last active March 29, 2020 21:18
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
(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 July 20, 2019 08:26 — 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
#!/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 06:23
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…
; 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)

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:

// 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 December 10, 2017 04:19
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."
;; 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]]))