Skip to content

Instantly share code, notes, and snippets.

View aresnick's full-sized avatar

Alec Resnick aresnick

View GitHub Profile
@aresnick
aresnick / servo.py
Created October 23, 2018 22:54
A simple example of controlling a servo motor with RPi.GPIO
import RPi.GPIO as GPIO
import time
servoPIN = 21
GPIO.setmode(GPIO.BCM)
GPIO.setup(servoPIN, GPIO.OUT)
p = GPIO.PWM(servoPIN, 50) # GPIO 21 for PWM with 50Hz
p.start(0) # Initialization

Aaron Swartz was an extraordinarily dear friend; I have no idea what to say about his suicide. But this is what I did say in my eulogy for him at his funeral yesterday, scribbled out on the flight to Chicago.


Aaron is the first person I’ve loved who has died. I bought this suit at the mall on my way to the airport. Which means this is also my first funeral. And it’s the first time I’ve had to figure out how to remember someone. Since Taren called me with the news, I’ve been compulsively reading blog posts, trying to escape into other people’s thoughts and memories of Aaron. But none of them seem to fit.

When you love someone, when you look up to them, at first you don’t really know what you’re doing and you’re just drawn to them, kind of the way plants are drawn toward light. You grow towards them, toward their ideals, toward what they represent—or at least, what you want them to represent. And then if you’re very, very lucky, eventually—unlike a plant—you arrive, you reach them. And all of a sudden

I still don’t know what to say about Aaron’s suicide. But again, this is what I did say, this time at the memorial service this week at the MIT Media Lab.


When we say we “know” a fact like our phone number, we mean something different than we we say we “know” how to ride a bicycle. And we mean something still different when we say we “know someone.” The first and last time I spoke publicly about Aaron was at his funeral. At the time, I said that it has been the first time I’ve to figure out how to remember someone—much less someone I loved. And I’ve come to the conclusion that I can’t. Because, like “knowing someone,” “remembering someone” can mean too many things.

Nonetheless, I’d like to share the anecdote that’s come closest to capturing what I mean when I say that I want to remember Aaron. I’ve lifted it from Peter Drucker:

A new hospital administrator, holding his first staff meeting, thought that a rather difficult matter had been set

CollectionViewSwift4

This is Xcode 9.1 / Swift 4 version of https://github.com/klaas/CollectionViewElCapitan from two years ago:

Apple changed the way NSCollectionView works in OS 10.11 as shown in the talk "What's New in NSCollectionView" at WWDC 2015. They also provide a complex example written in Objective-C: CocoaSlideCollection

This is a simple sample project written in Swift.

It uses the standard Cocoa Application template and has a single view controller containing two collection views. One is setup with Interface Builder. The other is coded programmatically. There are also two collection view items. Again, one inside a .xib file the other programmatically. They show simple labels. You can select and double click the items.

<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
.hide {
display: none;
}
.show {
display: block;
@aresnick
aresnick / -
Created November 20, 2017 21:02
/Users/aresnick/Library/Containers/com.powderhs.atlas/Data
├── Desktop -> ../../../../Desktop
├── Documents
│   └── iChats -> ../../../../../Documents/iChats
├── Downloads -> ../../../../Downloads
├── Library
│   ├── Application\ Scripts
│   │   └── com.powderhs.atlas -> ../../../../../Application\ Scripts/com.powderhs.atlas
│   ├── Application\ Support
│   │   ├── AddressBook -> ../../../../../Application\ Support/AddressBook
#board_title {
color: red;
}
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<title>Memory demo for Molly (1 September 2017)</title>
<style>
body {
margin: 0;
}