Skip to content

Instantly share code, notes, and snippets.

@geofrey
geofrey / mandelbrap.gsp
Last active September 26, 2017 19:29
Crappy Mandelbrot Renderer
uses java.math.BigDecimal
uses java.lang.System
uses java.math.MathContext
uses java.lang.Math
var center = new Complex(0,0)
var zoom : BigDecimal = 10
var mathContext = new MathContext(java.lang.Math.log10(zoom.doubleValue()) as int + 2, java.math.RoundingMode.HALF_DOWN)
var grid : int = 34
var escape : int = 38
@geofrey
geofrey / drivingadvice.md
Created September 20, 2017 19:10
Driving Tips

GENERAL STUFF

Keep looking around you, keep practicing. There are a lot of things to do just right all at the same time and the only way to get good is practice.

You don't need to see the side of your own car in the side mirrors. Adjust them outward until things at the edge of the rear-view mirror are just coming into view in the side mirrors.

Leave the radio off until your're familiar enough with the driving controls to not fumble for e.g. the wiper control. Adjust the radio or your phone playlist etc. while you're parked. Apparently WA made it illegal to manipulate a phone in any way even while at a red light or stop sign. Find out what your specific rules are.

If some yahoo in a BMW just really needs to pass you, it's better to let them do it. At least that way they're ahead of you where you can keep an eye on them. And the faster they go, the sooner they get to their destination and the less time you have to share the road with that particular jerk.

@geofrey
geofrey / cryptocracker.gs
Last active April 5, 2018 21:00
Solving a puzzle posed years ago.
uses java.util.ArrayList
uses java.lang.Integer
uses java.lang.StringBuilder
uses java.util.Map
uses java.lang.Double
uses java.lang.Character
uses java.util.Iterator
uses java.util.HashMap
@geofrey
geofrey / learn-arithmetic.py
Last active November 5, 2015 00:21
re-inventing arithmetic
# better to define the successor relation explicitly and let order follow from that
successors = { '0':'1', '1':'2', '2':'3', '3':'4', '4':'5', '5':'6', '6':'7', '7':'8', '8':'9', '9':'0' }
# but it's certainly more verbose
def generate_successors(digits):
global successors
successors = {digits[i]:digits[i+1] for i in range(len(digits)-1)}
successors[digits[-1]] = digits[0] # wrap around
#generate_successors('0123456789abcdef') # any sequence