Skip to content

Instantly share code, notes, and snippets.

View mulder's full-sized avatar

Nicholas Mulder mulder

  • Wealthsimple
  • Waterloo, Ontario
View GitHub Profile
#!/usr/bin/env ruby
require File.expand_path('../../lib/themer', __FILE__)
Themer::CLI.start
def self.new(t);t.class==Class ? t.new : t;end;def method_missing(*a);c=Kernel.const_get(a[0]) rescue(nil);c ? c.new(*a[1..-1]) : super; end
@mulder
mulder / larch.notes
Created September 11, 2014 10:48
Move email from one gmail account to another
gem install larch
larch --from imaps://imap.gmail.com --to imaps://imap.gmail.com --from-folder '[Gmail]/All Mail' --to-folder '[Gmail]/All Mail'

Keybase proof

I hereby claim:

  • I am mulder on github.
  • I am mulder (https://keybase.io/mulder) on keybase.
  • I have a public key whose fingerprint is FB42 6F57 4384 DDB5 CE0D CB53 4341 E202 3926 9967

To claim this, I am signing this object:

@mulder
mulder / licences.rb
Created January 7, 2013 13:53
Grab ruby gem licences from your bundle
File.open("licences", "w+") do |file|
Bundler.environment.specs.each do |spec|
Dir["#{spec.full_gem_path}/LICENSE*"].each do |f|
file.write("======================= #{spec.name} - #{spec.version} =======================\n")
file.write(File.read(f))
file.write("------------------------------------------------------------------------------\n #{f}\n------------------------------------------------------------------------------\n\n")
end
end
end
@mulder
mulder / ruby.rb
Created August 20, 2012 17:47 — forked from haifeng/meta.rb
i18n positions
# heavily based on Masao Mutoh's gettext String interpolation extension
# http://github.com/mutoh/gettext/blob/f6566738b981fe0952548c421042ad1e0cdfb31e/lib/gettext/core_ext/string.rb
module I18n
INTERPOLATION_PATTERN = Regexp.union(
/%%/,
/%\{(\w+)\}/, # matches placeholders like "%{foo}"
/%<(\w+)>(.*?\d*\.?\d*[bBdiouxXeEfgGcps])/ # matches placeholders like "%<foo>.d"
)
@mulder
mulder / proc_marshal.rb
Created July 23, 2012 10:23 — forked from headius/proc_marshal.rb
Jruby - seriaalize Proc
require 'jruby'
module Serialize
def self.serialize(obj)
baos = java.io.ByteArrayOutputStream.new
oos = java.io.ObjectOutputStream.new(baos)
oos.write_object(JRuby.reference(obj))
oos.close
% pv -cN bunzip < huge_db_snapshot.sql.bz2 | bunzip2 | pv -cN import | mysql -uroot -p database
Enter password:
bunzip: 3.75MB 0:00:07 [ 400kB/s] [> ] 0% ETA 0:19:20
import: 16.9MB 0:00:08 [2.55MB/s] [ <=> ]
brew/apt/yum install pv
% pv huge_db_snapshot.sql.bz2 | bunzip2 | mysql -uroot -p database
Enter password:
62.9MB 0:05:02 [ 223kB/s] [==> ] 10% ETA 0:45:02