Skip to content

Instantly share code, notes, and snippets.

Avatar

Nels Nelson nelsnelson

View GitHub Profile
@nelsnelson
nelsnelson / dupefixer.rb
Created Mar 2, 2016
Remove duplicate bookmarks in Firefox quickly
View dupefixer.rb
# Did Mozilla F1 and Firefox Sync manage to duplicate your bookmarks 57814 times (like they did mine)?
# Did CheckPlaces and other misc addons completely fail at the task of removing duplicate bookmarks?
# Does the bookmarks manager grind to a halt even selecting an item?
# This is the fix for you..
# Backup the bookmarks in Firefox using the Backup function
# (from the star icon in the bookmarks manager) to JSON.
# Invoke this script as following:
# ruby dupefixer.rb /Users/yourname/Desktop/bookmarks.json
@nelsnelson
nelsnelson / latency.markdown
Created Oct 25, 2012 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Syscall on Intel 5150 ...................... 105 ns
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Context switch on Intel 5150 ............. 4,300 ns  =   4 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
@nelsnelson
nelsnelson / non_persistent_test.rb
Created Mar 2, 2012 — forked from jeremyevans/non_persistent_test.rb
Testing non-persistent fields on persisted identity-mapped entity instances in JRuby and Sequel through jdbc-postgres
View non_persistent_test.rb
#! /usr/bin/env jruby
require 'rubygems'
require 'sequel'
gem 'jdbc-postgres'
DB = Sequel.connect('jdbc:postgresql://localhost:5432/test?user=test&password=test')
DB.create_table? :test do