Skip to content

Instantly share code, notes, and snippets.

View jhawthorn's full-sized avatar
⌨️

John Hawthorn jhawthorn

⌨️
View GitHub Profile
# Have you ever wanted lldb to break in a certain place, but you weren't
# sure where to set the breakpoint? Look no further than this script!
#
# This script creates a chunk of executable code that uses the int3 x86
# instruction. This instruction is defined for use by debuggers, and you can
# read more about it here: https://en.wikipedia.org/wiki/INT_%28x86_instruction%29#INT3
#
# When that instruction is executed, the debugger will halt and you can do
# what you need!
#
@ELLIOTTCABLE
ELLIOTTCABLE / nerd-patcher-input-mono.sh
Created May 23, 2017 16:24
How to make a Nerd Fonts-patched (‘Powerline’) version of the Input Mono font
# Creating this because I'm *sure* I'll forget how to do this.
# 1. Customize your Input fontface, and download it from their website:
open -a Safari \
"http://input.fontbureau.com/download/index.html?size=14&language=javascript&theme=base16-dark&family=InputMono&width=200&weight=300&line-height=1.2&a=0&g=ss&i=serif&l=serifs_round&zero=slash&asterisk=height&braces=straight&preset=dejavu&customize=please"
# 2. Download the ‘patcher script’:
# (I have no idea why the hell this script requires the `changelog.md` as well; and we [ab]use
# GitHub's SVN bridge to download *just* the `src/glyphs`, instead of the 100s of megabytes of
# pre-patched fonts)
Ruby 2.1.0 in Production: known bugs and patches
Last week, we upgraded the github.com rails app to ruby 2.1.0 in production.
While testing the new build for rollout, we ran into a number of bugs. Most of
these have been fixed on trunk already, but I've documented them below to help
anyone else who might be testing ruby 2.1 in production.
@naruse I think we should backport these patches to the ruby_2_1 branch and
release 2.1.1 sooner rather than later, as some of the bugs are quite critical.
I'm happy to offer any assistance I can to expedite this process.
# Method instrumentation decorator with Ruby 2.1's new "method definition returns method name" feature
class Module
def instrument(notification_name, mid)
meth = instance_method(mid)
define_method(mid) { |*args, &bk|
ActiveSupport::Notifications.instrument(notification_name) do
meth.bind(self).call(*args, &bk)
end
}
find ~/Downloads/Gmail -type f | grep -v '\.git' | ruby -rdate -e 'today = Date.today; STDIN.each { |path| content = File.read(path.strip); begin; from = content.grep(/^From:/).fetch(0); date = content.grep(/^Date:/).fetch(0); puts from if Date.parse(date) > today - 365; rescue IndexError; end }' | while read line; do echo "$line" | ~/.mutt/add-aliases.sh; done