Skip to content

Instantly share code, notes, and snippets.

View chendo's full-sized avatar

chendo chendo

View GitHub Profile
### Keybase proof
I hereby claim:
* I am chendo on github.
* I am chendo (https://keybase.io/chendo) on keybase.
* I have a public key whose fingerprint is A4DE F0C8 847D 31DB 8B81 5264 EB16 FAE3 D887 BCDF
To claim this, I am signing this object:
@chendo
chendo / test_helper.rb
Created November 27, 2013 02:29
I wrote a helper that helps one debug `rand`-based test failures by running `srand` with the same number before every test. That way, if a test fails in a full run due to a `rand` issue, by using the same `--seed`, it should fail whether you run just the file or the individual test.
class ConsistentRandomness
def self.setup_rng
if !@seed
@seed = srand(1)
puts "Using seed #{@seed} for every test"
end
srand(@seed)
end
end
@chendo
chendo / gist:7130668
Created October 24, 2013 03:07
A dtrace of Objc message sends matching class *KSImageNamed* when changing **any** text in Xcode.
-> -[DVTTextCompletionController(KSImageNamed) swizzle_acceptCurrentCompletion]
<- -[DVTTextCompletionController(KSImageNamed) swizzle_acceptCurrentCompletion]
-> -[DVTTextCompletionController(KSImageNamed) swizzle_textViewShouldChangeTextInRange:replacementString:]
-> +[KSImageNamed sharedPlugin]
<- +[KSImageNamed sharedPlugin]
-> -[KSImageNamed imageCompletionsForIndex:]
-> -[KSImageNamed imageCompletions]
<- -[KSImageNamed imageCompletions]
<- -[KSImageNamed imageCompletionsForIndex:]
-> -[KSImageNamedIndexCompletionItem fileName]
@chendo
chendo / chatMEInterface.lua
Last active December 25, 2015 04:39
A ComputerCraft script that lets you wirelessly request items into an Ender Chest attached to the ME bridge. Requires a MiscPeripheral Chat Box (by default on the left), a ME Bridge (on the bottom), and then you define where players chests are in relation to the ME Bridge. To use, say `give <item id/meta> <amount>`. The script has it capped to 6…
local cb = peripheral.wrap('left')
local me = peripheral.wrap('bottom')
local chestMapping = {}
function getUuid(id,meta)
return id + meta * 32768
end
chestMapping['_chendo_'] = 0 -- down
import lldb
import re
import shlex
# This script allows Xcode to selectively ignore Obj-C exceptions
# based on any selector on the NSException instance
def getRegister(target):
if target.triple.startswith('x86_64'):
return "rdi"
@chendo
chendo / output
Last active May 13, 2016 20:40 — forked from lmarburger/output
Bundler CDN benchmarking with Fastly and Cloudflare (without HTTPS). The version on Cloudflare won't match the rubygems.org exactly as I can only take a snapshot, but the file size will be similar.
$ curl -s https://gist.github.com/chendo/6545822/raw/time.sh | bash
== Fastly ==
DNS: 0.003 CONNECT: 0.217 REQSENT: 0.650 STARTTX: 1.378 TOTAL: 3.739
X-Served-By: cache-v44-ASH
X-Cache: MISS
DNS: 0.001 CONNECT: 0.248 REQSENT: 0.746 STARTTX: 1.018 TOTAL: 3.734
X-Served-By: cache-v44-ASH
X-Cache: HIT
@chendo
chendo / gist:6533177
Created September 12, 2013 04:50
My first assembly! Wrote a bootloader that just prints gibberish in colours. I tried to slow it down but couldn't figure out the interrupt handler stuff.
use16
org 0x7c00
xor ax, ax
xor bx, bx
xor cx, cx
xor dx, dx
mov ds, ax
mov fs, ax
class Metrics
extend ::NewRelic::Agent::MethodTracer
class << self
def trace_execution(*metric_names, &block)
Benchmark.realtime do
self.trace_execution_scoped(metric_names.map { |name| prepend_custom_tag(name) }, &block)
end
end
@chendo
chendo / results.md
Last active December 19, 2015 05:49
Results of a poll on which finger people use to press Space when typing and their handed-ness. https://twitter.com/chendo/status/351575333348192256

Right Handed

  • Right Thumb: notahat, bawpcwpn, madpilot, jr_plusplus, phantomwhale, pda, tecniek, damncabbage, j10io, bclarkrobinson, simonbaird, miarshmallow, johnsyweb, ineal (14, 50%)
  • Right Index Finger: charliesome, secoif, twe4ked (3, 10.7%)
  • Left Thumb: louis_simoneau, zbender, vonconrad, ajmalafif (4, 12.2%)
  • Both Thumbs: mariovisic, teeerevor, modsognir (3, 10.7%)

Left Handed

  • Left Thumb: nkpart (1, 3.6%)
@chendo
chendo / gist:5702083
Created June 3, 2013 22:40
Searchable accessibility roles for Shortcat
Application
Browser
BusyIndicator
Button
Cell
CheckBox
ColorWell
Column
ComboBox
DisclosureTriangle