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
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
@aphyr
aphyr / 1.txt
Created October 13, 2015 18:42
Spideroak
Aphyr
Oct 11, 9:12 PM
Hi there!
First time user here--I bought a 5TB plan for the year, checked my homedir in
"Backup", and hit save. It did a bunch of disk IO for a few minutes, then just
sat at 100% CPU for the last 8 hours. The "Scan Now" spinner is rotating and it
says "Scanning folders for new backup items". The Activity tab is empty and the
Actions log says "Application: save backup selection" is finalizing. I killed