Skip to content

Instantly share code, notes, and snippets.

@nahurst
nahurst / gist:386b54fc0da7e06b7cc87f5bbb2a9629
Last active November 17, 2020 03:18 — forked from seachai/gist:948ed1eeafa32ce03db6685edb879f71
iTerm 2 Natural Text Editing Preset
Go to Preferences... > Profiles > Keys
Press Load Preset...
Select Natural Text Editing
Then, you can move a word backwards using Option ⌥ + ← and a word forwards using Option ⌥ + →, move to the start of the line using fn + ← and to the end of the line with fn + →. Also you can delete a word backwards using Option ⌥ + ⌫, delete the whole line using Command ⌘ + ⌫.
If the preset doesn't appear, reinstall iTerm2. If you installed it using Homebrew+Cask:
brew cask reinstall iterm2
Also add undo as a Profile > Keys
@nahurst
nahurst / sinatra+thin+ssl.rb
Created January 15, 2016 00:05 — forked from TakahikoKawasaki/sinatra+thin+ssl.rb
Sinatra + Thin + SSL
#!/usr/bin/env ruby
#
# This code snippet shows how to enable SSL in Sinatra+Thin.
#
require 'sinatra'
require 'thin'
class MyThinBackend < ::Thin::Backends::TcpServer
def initialize(host, port, options)
@nahurst
nahurst / latency.txt
Created September 13, 2012 01:34 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers Time Light Distance Approximate Light Distance
-------------------------- ---- -------------- --------------------------
L1 cache reference 0.5 ns 0.15 m Diagonal across your smartphone
Branch mispredict 5 ns 1.5 m Height of Natalie Portman
L2 cache reference 7 ns 2.1 m Height of Shaq
Mutex lock/unlock 25 ns 7.5 m Height of a school flag pole
Main memory reference 100 ns 30 m Half a Manhattan city block (North/South)
Compress 1K bytes with Zippy 3,000 ns 900 m Width of Central Park
Send 1K bytes over 1 Gbps network 10,000 ns 3,000 m Width of Manhattan
Read 4K randomly from SSD* 150,000 ns 45,000 m NYC to Hempstead on Long Island