Skip to content

Instantly share code, notes, and snippets.

@pbnjay
pbnjay / barbers.go
Created November 3, 2020 19:08
Sleeping Barbers
// I was inspired by @goinggodotnet to implement the sleeping barbers problem
// https://twitter.com/goinggodotnet/status/1323664013264375809
//
// https://en.wikipedia.org/wiki/Sleeping_barber_problem
package main
import (
"flag"
"log"
@pbnjay
pbnjay / lockitron.go
Created August 22, 2016 04:08
Code to control a Locktron Bolt using bluetooth on OSX
// Written by Jeremy Jay <jeremy@pbnjay.com>
// github.com/pbnjay
//
// This uses a bunch of copy-pasta from around the web for BLE support in Go, and
// behind-the-scenes bluetooth snooping and reverse engineering to get working.
// I had to do some more hacking on github.com/paypal/gatt to get it running on
// the Wink Hub, but it isn't very reliable yet (it has issues with connection state).
//
// USAGE: ./golockitron -id <BLUETOOTH-PERIPHERIAL-ID> -key <LOCKITRON-ACCESS-KEY> unlock|lock
//

Keybase proof

I hereby claim:

  • I am pbnjay on github.
  • I am pbnjay (https://keybase.io/pbnjay) on keybase.
  • I have a public key whose fingerprint is C52C 52BD AA2D C462 1B0D 7F9C 9F03 70BB 4A86 45B4

To claim this, I am signing this object:

@pbnjay
pbnjay / cayley_example
Last active December 18, 2023 03:08
Some examples for testing traversal in the Gremlin-Cayley dialect.
var movie1 = g.V().Has("name", "The Net")
var movie2 = g.V().Has("name", "Speed")
var actor1 = g.V().Has("name", "Sandra Bullock")
var actor2 = g.V().Has("name", "Keanu Reeves")
////////////////////////////////////
// (film) -> starring -> (actor)
var filmToActor = g.Morphism().Out("/film/film/starring").Out("/film/performance/actor")
@pbnjay
pbnjay / com.apple.spotlight.plist
Created August 31, 2012 06:30
Allow Dictionary re-ordering in Spotlight
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>version</key>
<integer>2</integer>
<key>orderedItems</key>
<array>
<dict>
<key>enabled</key>
@pbnjay
pbnjay / pbnjay_bibtex.js
Created February 15, 2012 15:13
Zotero BibTeX translator with tags as citekeys (updated 23rd Apr 2012)
{
"translatorID": "7b4cd20f-4c4e-4d1c-b622-cfb6e2269a1c",
"translatorType": 3,
"label": "BibTeX-citekey",
"creator": "Simon Kornblith and Richard Karnesky",
"target": "bib",
"minVersion": "2.1.9",
"maxVersion": null,
"priority": 2,
"inRepository": false,