Skip to content

Instantly share code, notes, and snippets.

jrunning / base58.rb
Last active Nov 17, 2020
UUID to Base 58 in Ruby
View base58.rb
# base58_to_int and int_to_base58 loosely based on base58 gem by Douglas F. Shearer
ALPHABET = "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ".chars
def base58_to_int(base58_val)
.reduce(0) do |int_val, (char, index)|
swrobel /
Last active Aug 29, 2015
Send OpsWorks log files to Papertrail using the remote_syslog gem
  1. Add remote_syslog to your Gemfile
  2. Add papertrail.rake to lib/tasks
  3. Add remote_syslog.yml to config/
  4. Add before_restart.rb to deploy/
  5. Set the PAPERTRAIL_PORT ENV var to the one provided by Papertrail for your system

Inspiration from Scott W. Bradley

mrdanadams / .buildpacks
Created Jun 22, 2013
Adding Geos and Proj4 support to Heroku using buildpacks
View .buildpacks
joshdholtz /
Last active Dec 6, 2020
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);
mattconnolly / gist:4158961
Created Nov 28, 2012
RSpec basic authentication helper module for request and controller specs
View gist:4158961
module AuthHelper
def http_login
user = 'username'
pw = 'password'
request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials(user,pw)
module AuthRequestHelper
jboner / latency.txt
Last active May 15, 2021
Latency Numbers Every Programmer Should Know
View latency.txt
Latency Comparison Numbers (~2012)
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD