View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
View ElCapitan.applescript
-- Disable Time Machine Local Backups
sudo tmutil disablelocal
-- Disable Automatic Spell Checker
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
-- Disable animations when opening and closing windows.
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
-- Disable animations when opening a Quick Look window.
defaults write -g QLPanelAnimationDuration -float 0
-- Accelerated playback when adjusting the window size (Cocoa applications).
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
#!/bin/bash -ex
### More info:
### configuration
PKGS_TO_ADD="$PKGS_TO_ADD curl git etckeeper python-software-properties"
PKGS_TO_REMOVE="$PKGS_TO_REMOVE geoip-database popularity-contest"
PKGS_TO_REMOVE="$PKGS_TO_REMOVE pppoeconf pppconfig ppp"
PKGS_TO_REMOVE="$PKGS_TO_REMOVE ubuntu-standard memtest86+" # warning: be careful about what you remove after this
View gist:1e269401306e28232d03
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
WARNING: You're about to perform actions on production server(s)
Please confirm that all your intentions are kind and friendly
View gist:8674141
# First, we need to add an empty key/value tuple (just an empty fork) to this `execution`, in preperation for
# making a `locals` list to store variables on.
# ┌ - we have to assume that native juxtaposition of `infrastructure` against the root-level `execution` will
# │ somehow “fall through.” I haven’t yet figured out the semantics of Nuclear-level scoping/fall-through.
# │ - considering: if `<this> locals` nothingnesses-out, then we juxtapose against enclosing scope at the
# │ interpreter level (which would imply, at this root scope, juxtaposing against the global scope I suppose)
# │ ┌ - no `call()` implemented at this level, so we have to assume that the native-default juxtaposition for
View arel mapped template ids.rb
module Sq
class Template < Sequel::Model
one_to_many :fields
def mapped_template_ids
join(Field.named(:f), id: :field_id, template_id: id).
join(Field.named(:mf), id: :m__mapped_field_id).
View kawaii_phrase.rb
module KawaiiPhrase
# Makes awesome random phrases such as "Enjoyable Green Turtle"
ADJ_1 = [
View 0_sha1_scrypt .md

Upgrade sha1 => scrypt without user logging in/pw reset:


We hash passwords with one-way hash functions to reduce the impact of password database compromise. Passwords hashed with salted SHA or MD5 can ofen be brute forced. Newer password hashhing techniques like Scrypt/Bcrypt/PBKDF2 add computational work to make brute forcing prohibitively expensive.


Your service already has users with salted sha1 password hashes. Since you don't have their original passwords you can't upgrade to a modern password hash without getting each user to log in and enter their password.

You have (salt,sha(salt+password)), you want (salt, scrypt(salt,password))

View memstats.rb
#!/usr/bin/env ruby
# Aggregate Print useful information from /proc/[pid]/smaps
# pss - Roughly the amount of memory that is "really" being used by the pid
# swap - Amount of swap this process is currently using
# Reference:
View rspec_with_pry.rb
it "should do something" do
@user = Factory(:user)
@item.user = @user
rescue Exception => e
raise e