Skip to content

Instantly share code, notes, and snippets.

View bjensen's full-sized avatar

Brian Jensen bjensen

View GitHub Profile
@bjensen
bjensen / gist:3049038
Created July 4, 2012 19:14 — forked from timothyekl/gist:1217887
Cross-platform: recompile LaTeX documents using Ruby, Guard
# Tested with Ruby 1.9
# Needs gem "guard" (https://github.com/guard/guard)
# Needs gem "guard-shell" (https://github.com/guard/guard-shell)
# Uses process "growlnotify" (http://growl.info/extras.php)
# Uses process "pdflatex" from standard TeXLive distribution
guard 'shell' do
watch(%r{(.+)\.tex}) do |m|
`growlnotify -m #{m[0]} Recompiling`
`pdflatex -interaction=batchmode #{m[0]} >/dev/null`
@bjensen
bjensen / gist:4114045
Created November 19, 2012 21:22 — forked from rud/gist:4045605
class ToggleLogging
def self.setup
Signal.trap('USR1') do
toggle
end
end
def self.toggle
level_before = Rails.logger.level == Logger::DEBUG
Rails.logger.level = debug_before ? Logger::INFO : Logger::DEBUG
@bjensen
bjensen / 0-readme.md
Created December 11, 2012 12:57 — forked from burke/0-readme.md
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@bjensen
bjensen / user.rb
Created August 3, 2013 18:25 — forked from moeffju/user.rb
class User < ActiveRecord::Base
alias :devise_valid_password? :valid_password?
def valid_password?(password)
begin
devise_valid_password?(password)
rescue BCrypt::Errors::InvalidHash
return false unless Digest::SHA1.hexdigest(password) == encrypted_password
logger.info "User #{email} is using the old password hashing method, updating attribute."
self.password = password
@bjensen
bjensen / how-to-copy-aws-rds-to-local.md
Last active March 10, 2021 12:08 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.

https://computingforgeeks.com/install-postgresql-12-on-ubuntu/

sudo apt update
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
sudo apt update
sudo apt -y install postgresql-client-12