Skip to content

Instantly share code, notes, and snippets.

View mezis's full-sized avatar

Julien Letessier mezis

View GitHub Profile
--
-- PostgreSQL memory usage
-- Requires the pg_buffercache extension
--
SELECT
n.nspname, c.relkind, c.relname,
COUNT(1) AS buffers,
-- (100 * COUNT(1) * 8192.0 / pg_table_size(c.oid))::INT AS pct_cached,
RPAD(LPAD('', (COUNT(1) * 8192e1 / pg_table_size(c.oid))::INT, '█'), 10, '░') AS pct_cached,
#!/usr/bin/env ruby
puts "Press RETURN when the geocoder cache has been unpacked in tmp/cache/geocoder"
gets
Geocoder.config[:cache] = ActiveSupport::Cache::FileStore.new('tmp/cache/geocoder')
puts "Paste the correct Google API key:"
Geocoder.config[:api_key] = gets.strip
BackfillUserCityAreaService.new.run
@mezis
mezis / results.txt
Created August 23, 2016 07:59
MessagePack, JSON, YAML, Protobuf, BSON, Marshal: Ruby 2.3.1 benchmark results
Encode
======
Date: August 22, 2016
System Information
------------------
Operating System: OS X 10.11.6 (15G31)
CPU: Intel Core i7 2.5 GHz
Processor Count:
Memory: 16 GB
class TunesFillfactor < ActiveRecord::Migration
TABLES = %w[orders restaurant_assignment order_assignment order_item driver zone_metrics]
def up
TABLES.each do |table|
execute %{ALTER TABLE #{table} SET (fillfactor = 85)}
end
end
def down
@mezis
mezis / ec2-server.txt
Last active August 29, 2015 14:25
`ab` result for orderweb
This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking deliveroo.co.uk (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
@mezis
mezis / tex-live.md
Created June 30, 2015 14:51
Installed TeX Live packages

For reference, installed TeX Live packages as of 2015-06-30:

$ yum list installed | grep tex
tex-cm-lgc.noarch               0.5-17.1.el6           @base
tex-kerkis.noarch               2.0-23.el6             @base
tex-preview.noarch              11.85-10.el6           @base
texlive.x86_64                  2007-57.el6_2          @base
texlive-dvips.x86_64            2007-57.el6_2          @base
texlive-east-asian.x86_64       2007-57.el6_2          @base
@mezis
mezis / keybase.md
Created August 20, 2014 07:50
keybase.md

Keybase proof

I hereby claim:

  • I am mezis on github.
  • I am mezis (https://keybase.io/mezis) on keybase.
  • I have a public key whose fingerprint is 18F3 9C07 AF6D 731A 1D3B 04A0 FA02 40E8 5344 1C47

To claim this, I am signing this object:

@mezis
mezis / nav.html
Created May 13, 2014 15:40
Deriving from Bootstrap
<nav class="ht-navbar">
<div>
<a>Brand</a>
</div>
<div>
<ul>
<li><a>First tab</a></li>
<li><a>Second tab</a></li>
</ul>
</div>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>net.mezis.tunnels</string>
<key>ProgramArguments</key>
<array>
class FrozenString
module ClassMethods
def get(string)
@@repository ||= {}
@@repository[string.freeze] ||= new(string.freeze)
end
end
extend ClassMethods
def initialize(string)