Skip to content

Instantly share code, notes, and snippets.

View mec's full-sized avatar

Meyric Rawlings mec

  • London, UK
  • 19:43 (UTC +01:00)
View GitHub Profile
@mec
mec / yubikey.md
Last active July 26, 2019 10:47
Yubikey notes

Add Yubkikey GPG to a machine

  • My yubikey GPG key is on Keybase.io so this imports it locally:

curl https://keybase.io/mecrawlings/key.asc | gpg --import

  • Once I have the key locally I need to trust it:

gpg --edit-key <keyid>

sudo ln -s /usr/lib/libSystem.B.dylib /usr/local/lib/libgcc_s.10.4.dylib

  • Install from Homebrew
  • start pg_ctl -D /usr/local/var/postgres start && brew services start postgresql
  • connect as 'postgres' psql postgres
  • add 'postgres' user createuser -s postgres
  • confirm user psql postgres - check 'postgres' user is listed

Save and open the page:

Capybara.save_and_open_page

@mec
mec / cli_cheatsheet.md
Last active July 2, 2019 12:49
CLI cheatsheet

tmux

ctrl-b > arrows move pane

ctrl-b > [ scrolling mode q exits

ctrl-b > " split horizontal

ctrl-b > % split vertical

@mec
mec / performance.rb
Created April 26, 2019 20:40
Rails perf helper
require 'benchmark'
def print_memory_usage
memory_before = `ps -o rss= -p #{Process.pid}`.to_i
yield
memory_after = `ps -o rss= -p #{Process.pid}`.to_i
puts "Memory: #{((memory_after - memory_before) / 1024.0).round(2)} MB"
end
@mec
mec / keybase.md
Created March 14, 2019 18:34
keybase.md

Keybase proof

I hereby claim:

  • I am mec on github.
  • I am mecrawlings (https://keybase.io/mecrawlings) on keybase.
  • I have a public key ASAPrWiDB-nPZY_WQpFRt-abXkm6vRJFG-WHtwlH_1tZ8wo

To claim this, I am signing this object:

@mec
mec / singleton.js
Last active June 5, 2018 10:50
Super simple node module pattern
// Private
let two = 2
// fucntion
function sum(x, y) {
return x + y
}
// arrow, has to be assigned
const multiply = (x,y) => x * y
@mec
mec / npm.md
Last active November 29, 2017 22:34
❤️ npm, tips

npm tips

Update npm

sudo npm update npm -g

List all global packages and versions, show only one level

npm ls -g --depth 0