Skip to content

Instantly share code, notes, and snippets.

View ryanoboril's full-sized avatar

Ryan Oboril ryanoboril

  • Philadelphia, PA
View GitHub Profile
@ryanoboril
ryanoboril / gist:11321986
Last active August 29, 2015 14:00
SSH Key Issues - Could not connect to authentication agent
eval `ssh-agent -s`
@ryanoboril
ryanoboril / gist:11335151
Created April 27, 2014 01:01
Setting up a PostgreSQL database for the first time...
CREATE USER "app-dev" WITH PASSWORD 'app-dev'; --PASSWORD MUST HAVE SINGLE QUOTE!
CREATE DATABASE "skillbadges_development";
GRANT ALL PRIVILEGES ON DATABASE "skillbadges_development" TO "app-dev";
@ryanoboril
ryanoboril / sc_usage
Created June 19, 2014 15:17
Run any command as a service in windows
sc [Servername] Command Servicename [Optionname= Optionvalue...]
@ryanoboril
ryanoboril / sign_in_helper.rb
Created July 12, 2014 01:32
Sign in helper for a Devise project's rspec tests
require 'rails_helper'
include Warden::Test::Helpers
module SignInHelper
def sign_in_as_a_valid_user
Warden.test_mode!
user = FactoryGirl.create(:user)
login_as(user, :scope => :user)
end
@ryanoboril
ryanoboril / gist:278197b04cb8c838d72b
Last active June 13, 2019 18:09
Setup PhantomJS on CentOS 6.5
# Use one of the download links here: http://phantomjs.org/download.html
# In this case, it's the 32-bit version.
sudo yum install freetype fontconfig
cd ~
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2
bunzip2 phantomjs*.tar.bz2
tar xvf phantomjs*.tar
sudo cp phantomjs*/bin/phantomjs /usr/bin/phantomjs
phantomjs -v
@ryanoboril
ryanoboril / RESTORE_DB.sql
Last active August 29, 2015 14:04
Scripted DB restore of SQL Server database
-- TODO Parameterize me!
RESTORE FILELISTONLY
FROM DISK = 'C:\dbname-snapshot-20140410.bak'
GO
-- Put database in single-user mode.
-- This will also close existing connections.
ALTER DATABASE dbName
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
-- 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';
@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....
@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 / 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' {} \;