Skip to content

Instantly share code, notes, and snippets.

View aphyr's full-sized avatar
💭
be gay, do crimes

Kyle Kingsbury aphyr

💭
be gay, do crimes
View GitHub Profile
Dear Alderman,
I know you have a lot on your plate, but I would like to take a moment of your time to express my urgent support for the Police Accountability Task Force's recommendations for the Chicago Police Department.
Policing is difficult work, and pervasive distrust between police and their communities can only make it harder. We should improve officer training for youth and people in mental crisis, and focus on de-escalation techniques. Community Empowerment and Engagement Districts, and a commitment to beat-based policing, could help officers get to know the concerns of the neighborhoods they protect.
Hiring and promoting more officers of color is necessary, but we should go further: the statistics on CPD's use of guns and tasers suggest endemic racism. We should implement universal bias training, and implement an early intervention system to identify officers with problems.
As with the OPS, the IPRA appears neither motivated nor equipped to ensure the safety and just treatment of Chicago residen
aphyr@waterhouse ~> spotify --force-device-scale-factor=1.36
[0622/084744:ERROR:browser_main_loop.cc(203)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
[0622/084744:ERROR:main_delegate.cc(764)] Could not load cef_extensions.pak
[0622/084744:ERROR:main_delegate.cc(764)] Could not load cef_extensions.pak
13:47:45.490 I [dns.cpp:63 ] resolved apresolve.spotify.com to 104.154.126.0
13:47:45.490 I [dns.cpp:63 ] resolved apresolve.spotify.com to 194.68.30.66
13:47:45.490 I [dns.cpp:63 ] resolved apresolve.spotify.com to 194.68.30.86
13:47:45.493 5 [playlist_be_pl4_context.cpp:70 ] [spotify:user:aphyr_null:rootlist] Creating context
13:47:45.493 5 [playlist_be_pl4_context.cpp:70 ] [spotify:user:aphyr_null:publishedrootlist] Creating context
13:47:45.513 D [gaia_manager.cpp:705 ] GAIA: TIMING(433337) GaiaManager::start, _servic
@aphyr
aphyr / pdf-sign
Created June 10, 2016 15:40
Script to sign the final page of a PDF using inkscape and pdfseparate/pdfunite.
#!/bin/bash
DIR=`mktemp -dt pdf-sign.XXXXXXXX` || exit 1
cd "$DIR"
pdfseparate "$1" "$DIR/page%d.pdf"
inkscape `ls | tail -1`
pdfunite page*.pdf "$1 signed.pdf"
rm -rf "$DIR"
@aphyr
aphyr / svg-fix-viewbox.rb
Created June 2, 2016 21:44
Script to fix the root viewbox on simple svg diagrams
#!/usr/bin/env ruby
require 'xml'
require 'pp'
require 'bigdecimal'
unless ARGV.first
puts "No file"
exit 1
end
@aphyr
aphyr / results.clj
Created April 15, 2016 03:23
Clojure range (next) thread safety issue?
FAIL in (range-test) (range_test.clj:18)
expected: 1000
actual: 927
Ran 1 tests containing 1 assertions.
1 failures, 0 errors.
Reloading scratch.range-test ... done.
Testing scratch.range-test
#!/usr/bin/env ruby
# Takes a directory and turns music in it to mp3s; deleting originals.
require 'find'
require 'fileutils'
# Find files
files = []
Find.find(ARGV.first) do |file|
riemann.bin=> (def s (sreduce (fn [acc event] (assoc event :metric
#_=> (max (:metric event) (:metric acc))))
#_=> prn))
#'riemann.bin/s
riemann.bin=> (s {:metric 1 :foo "hi"})
nil
riemann.bin=> (s {:metric 0 :foo "there"})
{:foo "there", :metric 1}
true
riemann.bin=> (s {:metric 4 :foo "stranger"})
@aphyr
aphyr / with-retry.clj
Created January 20, 2016 03:14
Recur from within catch block
(defrecord Retry [bindings])
(defmacro with-retry
"It's really fucking inconvenient not being able to recur from within (catch)
expressions. This macro wraps its body in a (loop [bindings] (try ...)).
Provides a (retry & new bindings) form which is usable within (catch) blocks:
when this form is returned by the body, the body will be retried with the new
bindings."
[initial-bindings & body]
(assert (vector? initial-bindings))
> Also, would love to hear feedback of what you'd like in such a community.
Jokes aside, this deserves a serious reply. Things I'd like to see in such a
community would start with:
- Trans people
- People of color
- Women
- Queer people
So I'm trying to pass the config: "update" options so I can do an upsert.
(r/insert (r/table (r/db db) tbl)
{:val value}
{"conflict" "update"}))
expands to
{:rethinkdb.query-builder/term :INSERT,
:rethinkdb.query-builder/args