Skip to content

Instantly share code, notes, and snippets.

View michaelrockhold's full-sized avatar

Michael Rockhold michaelrockhold

  • Rockhold Consulting
  • Seattle, WA
View GitHub Profile
//
// main.swift
// string-permuter
//
// Created by Michael Rockhold on 8/22/20.
// Copyright © 2020 Michael Rockhold. All rights reserved.
//
import Foundation
import Foundation
func waitAroundThenReturn(continuation: @escaping ()->Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
continuation()
}
}
print("Hello, World!")
let curr = CFRunLoopGetCurrent()
// heapsort.swift
//
// Created by Michael Rockhold on 10/4/19.
// Copyright © 2019 Michael Rockhold. All rights reserved.
//
import Foundation
extension MutableCollection where Self.Index == Int {
//
// linkedlist.swift
// CommandLinePlayground
//
// Created by Michael Rockhold on 9/24/19.
// Copyright © 2019 Michael Rockhold. All rights reserved.
//
import Foundation
@michaelrockhold
michaelrockhold / Marsaglia.swift
Last active February 18, 2019 00:23
Swift code to use Marsaglia's method to generate a stream of standard normal random variables
//
// Marsaglia.swift
//
// Created by Michael Rockhold on 2/16/19.
// Copyright © 2019 Michael Rockhold. All rights reserved.
//
import Foundation
struct Marsaglia {
@michaelrockhold
michaelrockhold / CSVReader.swift
Created February 15, 2019 18:03
Very simple CSV reader in Swift; probably not suitable for very large files
//
// CSVReader.swift
//
// Created by Michael Rockhold on 2/15/19.
// Copyright © 2019 Michael Rockhold. All rights reserved.
//
import Foundation
struct CSVReader: Sequence {

It is pretty funny to read an essay about autonomous vehicles from Rodney Brooks, the subject of the documentary, 'Fast, Cheap, and Out of Control’. Like the author, I too in a previous life encountered many of the same automotive navigation dilemmas on the streets of Cambridge, Massachusetts. In fact, I was back there just a few months ago for a family gathering, and the re-discovery of the massive pain it is to operate a motor vehicle in the Boston/Cambridge/Somerville area neatly balanced out the years of nostalgia I still feel for my erstwhile home.

As Brooks describes, every day of driving a car in Cambridge offers the operator genuine dilemmas, which while seldom (never, maybe) rising to the level of the trolley problem, seem to me genuinely to require the full cognitive capacity of a typical human for their resolution. The author asks how we are likely to solve them, offering perhaps changes in the laws, new technologies, or changes in user

// Based on pseudocode at https://en.wikipedia.org/wiki/PID_controller#Pseudocode
import Foundation
protocol PIDControllee {
func measured_value() -> Float;
func output(_ v:Float);
}