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
# To Edit Root Cron Jobs | |
#sudo crontab -e | |
# Reboot 1 minute past every hour, log errors if any generate | |
01 * * * * /sbin/reboot > /home/calvin2/miner_cron_job_log.txt 2>&1 | |
# Reboot every 30 minutes, log errors if any generate | |
*/30 * * * * /sbin/reboot > /home/calvin2/miner_cron_job_log.txt 2>&1 |
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
require 'active_record' | |
require 'mysql2' | |
# Database Connection | |
ActiveRecord::Base.establish_connection( | |
adapter: 'mysql2', # or 'postgresql' or 'sqlite3' | |
host: 'localhost', | |
database: 'chc_user_auth_direct_login', | |
username: 'root', | |
password: '' |
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
# lib/paperclip_processors/cropper.rb | |
module Paperclip | |
class Cropper < Thumbnail | |
def transformation_command | |
if crop_command | |
puts "CROP: #{crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ')}" | |
crop_command + super.join(' ').sub(/ -crop \S+/, '').split(' ') | |
else | |
super | |
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
# ------- | |
# rubocop | |
# ------- | |
# example usage: | |
# check a directory: rubocop app/controllers | |
# check a file: rubocop app/controllers/application_controller.rb | |
# check rspec directory: rubycop spec/controllers | |
# check rspec file: rubycop spec/controllers/application_controller_spec.rb | |
run_rubocop(){ | |
if gem list | gem list | grep 'rubocop\|rubocop-rspec' ; then |
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
http://stackoverflow.com/questions/24081473/how-to-install-therubyracer-gem-on-10-10-yosemite | |
gem uninstall libv8 | |
brew install v8 | |
gem install therubyracer | |
gem install libv8 -v '3.16.14.3' -- --with-system-v8 |
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
consignment_items_controller.rb | |
def show | |
@consignment_item = ConsignmentItem.find(params[:id]) | |
@magnified_images = "" | |
@consignment_item.images.each_with_index do |image, index| | |
@magnified_images += "jQuery('#magnifyimage_#{index}').iZoom();" | |
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
1) Install Keka | |
http://www.kekaosx.com/en/ | |
2) (optional) split your import file(http://www.webmaster-source.com/2011/09/26/how-to-import-a-very-large-sql-dump-with-phpmyadmin/) | |
3) Compress your sql dump file(s) into a 7z file using Keka. | |
4) From the terminal, run: | |
7z x -so backup_some_app_data.sql.7z | mysql -u root some_app_db |
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
How to clear all those 'mysql-bin.00000**' files from /usr/local/var/mysql: | |
1) mysql -u root | |
2) flush logs; | |
3) reset master; | |
DONE! |
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
Rhodes application stack needs required gem unpacked to the lib directory. | |
frankkany:rhodesprojects $ gem unpack mechanize --target ~/Desktop | |
Unpacked gem: '/Users/frankkany/Desktop/mechanize-2.5.1' |
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
http://www.wyliethomas.com/blog/2011/08/24/rvm-rake-and-cron-on-ubuntu/ | |
RVM, Rake and Cron on Ubuntu | |
by admin on August 24th, 2011 | |
Tennnngh! I read countless blog posts, tried numerous approaches that I found and rebuilt the server more than a couple times. And finally I found what the missing piece was for getting a rake command to run in cron with rvm. | |
Most of the results I found (on stackoverflow) flagged the solution as adding the path to your rvm in your line item in crontab. Something like /home/username/.rvm/gems/rake my_awesome_task… etc. I tried every variation of that I could think of and got the same results. | |
I dont use cron every day so this was a revelation to me. I found out that you can set variables, environment variables in your crontab file. |
OlderNewer