This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# add ssh keys | |
PROG=${0##*/} | |
KEY_DIR=~/.ssh | |
PUB_SFX='.pub' | |
# on non-MacOS systems, comment this line out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# git-copy [options] SOURCEFILE NEWFILE | |
usage() { | |
cat 1>&2 <<USAGE | |
usage: git-copy [options] SOURCEFILE NEWFILE | |
Copies a SOURCEFILE within a git repo to a NEWFILE in a way | |
that preserves the change history so that changes in SOURCEFILE | |
are still viewable in NEWFILE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
require 'redis' | |
require 'securerandom' | |
require 'awesome_print' | |
class RedisTest | |
attr_reader :name, :redis | |
HOW_MANY = (1..5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git helpers | |
alias gadd='git add' | |
alias gci='git commit' | |
alias gco='git checkout' | |
alias gdiff='git diff' | |
alias gpull='git pull' | |
alias gpush='git push' | |
alias grba='git rebase --abort' | |
alias grbc='git rebase --continue' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- query a large table for its size without doing a full-table scan | |
-- replace the table name as needed | |
SELECT to_char(reltuples::bigint,'999,999,999,999') AS estimate | |
FROM pg_class | |
WHERE relname='BIG_TABLE'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
PROG="${0##*/}" | |
DIR="${0%/*}" | |
current_pg_version() { | |
asdf current postgres | cut -d' ' -f1 | |
} | |
DEFAULT_PG_VERSION=`current_pg_version` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -ropenssl -e "p OpenSSL::X509::DEFAULT_CERT_FILE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FREEZE_DATETIME = '2020/02/20 10:20:30 GMT' | |
shared_context 'freeze_time' do | |
around do |example| | |
Timecop.freeze(FREEZE_DATETIME) | |
example.run | |
Timecop.return | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# | |
# Wait.until { expr } -- waits until expr is true | |
# Wait.while { expr } -- waits while expr is true | |
# | |
# Each iteration contains a `sleep(sleep_time)`, where the default sleep time is | |
# Wait::DEFAULT_SLEEP_TIME (0.1 seconds). | |
# | |
# The sleep interval can be specified with the `sleep_time` argument: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# merge-branches [options] -f BRANCHES_FILE TARGET_BRANCH | |
PROG="${0##*/}" | |
DIR="${0%/*}" | |
GCLOG='.git/gc.log' | |
usage() { | |
if (( $# > 0 )) ; then |