Skip to content

Instantly share code, notes, and snippets.

View wiseleyb's full-sized avatar

Ben Wiseley wiseleyb

  • Monterey, CA
View GitHub Profile
@wiseleyb
wiseleyb / docker-alias.md
Last active December 15, 2023 15:39
Docker aliases

Docker Aliases

Some aliases used

alias dcbundle='docker-compose run web bundle'
alias dccomp='docker-compose'
alias dccop='docker-compose run web rubocop'
alias dcup='docker-compose up'
alias dcdown='docker-compose down'
class HerokuUtils
class << self
# example
# create_dyno(cmd: 'rake --tasks',
# size: 'performance-l',
# type: 'jobs')
# cmd: any command you can pass to heroku - you don't need to include
# run:detached
# size: any heroku size https://devcenter.heroku.com/articles/dyno-types
# type: this can be anything - when you run "heroku ps" it organizes things
You can customize your console this way:
In ~/.spring.rb
irbrc = "~/.irbrc"
require File.expand_path(irbrc) if File.exist?(irbrc)
In ~/.irbrc
require 'irb/ext/save-history'
=begin
This is a somewhat hacky user-recovery script that I hacked out at 3am after accidently deleting a bunch of users.
To use:
* get a good copy of the prod-db before you fucked up
* an array of user-ids you want to restore
* run users_to_yaml(user-ids)
* create a secret gist for each yml file created
* plug the urls of the gists into the Gists class
* paste this entire script into prod-con and pray
@wiseleyb
wiseleyb / setup new box
Last active February 24, 2016 16:03
Process I followed setting up a new mac
* install homebrew
* brew install coreutils
* install https://github.com/sds/dot
* rm -rf ~/.vim
* install https://github.com/sds/.vim
* brew install tmux
* in settings > keyboard > modifier keys map caplocks to ctrl
* ln -s /Users/benwiseley/.dotfiles/plugins/tmux/tmux.conf .tmux.conf
* in terminal preferences set default to pro - change font to courier 14pt
* brew install postgres
@wiseleyb
wiseleyb / setup-rails-nginx-https-dev-box-mac.md
Last active February 23, 2016 16:37
Setup a Rails, NGINX, HTTPS dev box

Setup a Rails, NGINX, HTTPS dev box

I was implementing https://layer.com/ on https://zeemee.com and they require https for the callbacks. Since this was new to me and took me a while here's a how to if anyone is looking.

Assumptions

You already have a rails app running on localhost:3000

Static IP Address

{
templates: {
'position2' => {
content_text: 'Guns, Germs and Steel',
action_url: 'https://www.getaccord.com/positions/1'
},
'platform' => {
content_text: 'Bob eats lunch',
action_url: 'https://www.getaccord.com'
}
# This is a way to parallelize long running operations between multiple
# tmux sessions. Basically a poor mans map-reduce for use on caujob02 (or
# other high memory production machines).
#
# See UserAddressUpdate for an example of how to implement something being
# run. Basically you just create a class that inherits from
# RunTmuxSession and supply a query and some code to run for each row
# result of that query. More on this in RunTmuxSession.
#
# This launches {steps} number of tmux sessions and splits the id
pa_ids = Invitation.find_by_sql(<<-SQL)
SELECT profile_administrations.id AS profile_administration_id
FROM invitations
INNER JOIN invitation_batches ON
invitation_batches.id = invitations.invitation_batch_id
INNER JOIN people ON
people.id = invitations.invitee_id
INNER JOIN profiles ON profiles.subject_id = people.id
INNER JOIN profile_administrations ON
profile_administrations.profile_id = profiles.id
# download latest libevent2 and tmux sources, and extract them somewhere
# (thx bluejedi for tip on latest tmux URL)
#
# at the time of writing:
cd ~
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
wget http://sourceforge.net/projects/tmux/files/latest/download?source=files
tar -zxvf libevent-2.0.21-stable.tar.gz
tar -zxvf tmux-1.9a.tar.gz