Skip to content

Instantly share code, notes, and snippets.

View ryanoboril's full-sized avatar

Ryan Oboril ryanoboril

  • Philadelphia, PA
View GitHub Profile
#!/bin/bash
sudo yum install -y wget gcc
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable/src
make redis-cli
sudo cp redis-stable/src/redis-cli /usr/local/bin/
@ryanoboril
ryanoboril / import-db.sh
Created June 6, 2018 20:49 — forked from hartleybrody/import-db.sh
Copy data from Heroku Postgres into local database
# copy/import data from heroku postgres to localhost pg database
# useful for copying admin's work on live site into local database to reproduce errors
# https://devcenter.heroku.com/articles/heroku-postgres-import-export
# take heroku pg snapshot and download
heroku pg:backups:capture
heroku pg:backups:download
# load the dump into local postgres database, assuming $DATABASE_URL set locally
div
= @safe JST["templates/carrier_reference_number"]({order: @order, user_id: @user_id, edit: true})
@ryanoboril
ryanoboril / gist:43708f5fc42a1f538960
Created September 25, 2015 03:03
retrieve 192 ip address via bash script
echo `ifconfig | grep '192.168' | awk '{ print $2 }' | sed 's/addr://g'`
@ryanoboril
ryanoboril / gist:90829ff86a076d067e24
Last active August 29, 2015 14:15
Find 10 largest folders in *nix
sudo du -k / | sort -n | tail -10
@ryanoboril
ryanoboril / migration_with_email
Created February 9, 2015 14:25
Sending email when something finishes or stops
RAILS_ENV=production rake db:migrate; echo "Done" | mail -s "Interrupted `date`" [email protected]
this requires mail server to be set up in /etc/ssmtp/ssmtp.conf
@ryanoboril
ryanoboril / find_and_replace.sh
Last active August 25, 2018 23:14
Global search and replace at the command line
find /path/to/files -type f -exec sed -i '' 's/oldstring/new string/g' {} \;
@ryanoboril
ryanoboril / fix_bundle_exec.sh
Last active August 29, 2015 14:06
Fixing Vagrant box to automatically handle bundle exec
# ~/.bashrc
alias rails="bundle exec rails"
alias rake="bundle exec rake"
alias rspec="bundle exec rspec"
alias cap="bundle exec cap"
@ryanoboril
ryanoboril / gist:77f67460ab5e868d637d
Created July 28, 2014 17:52
Where the hell is ODBC 32-bit??
C:\Windows\SysWOW64\odbcad32.exe
Useful when you can't find ODBC connections that you KNOW are there....
-- Backup Database to .bak File
-- Need to pass in FILENAME and DB arguments
DECLARE @fileName VARCHAR(90);
DECLARE @db_name VARCHAR(20);
DECLARE @fileDate VARCHAR(20);
SET @fileName = FILENAME;
SET @db_name = DB;
SET @fileDate = CONVERT(VARCHAR(20), GETDATE(),112);
SET @fileName = @fileName + @db_name + '_' + RTRIM(@fileDate) + '.bak';