This file contains hidden or 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
/** | |
* @author Freddie Mercury | |
* @copyright Sony/ATV Music Publishing LLC | |
*/ | |
let BohemianRhapsody = function(){ | |
// Is this the real life? | |
// Is this just fantasy? | |
try { |
This file contains hidden or 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
# Migrate schema and data from Mongoid to MySQL ActiveRecord | |
class MongoidMysqlMigrator | |
def randomize_auto_increment_values(source_models, from=5500, to=10500) | |
source_models.each do |model| | |
value = rand(from-to)+from | |
sql = %(ALTER TABLE #{model.name.tableize} AUTO_INCREMENT=#{value}) | |
puts sql | |
ActiveRecord::Base.connection.execute(sql) | |
end |
This file contains hidden or 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
Methionylthreonylthreonylglutaminylarginyltyrosylglutamylserylleucylphenylalanylalanylglutaminylleuc yllysylglutamylarginyllysylglutamylglycylalanylphenylalanylvalylprolylphenylalanylvalylthreonylleucylgl ycylaspartylprolylglycylisoleucylglutamylglutaminylserylleucyllysylisoleucylaspartylthreonylleucylisoleu cylglutamylalanylglycylalanylaspartylalanylleucylglutamylleucylglycylisoleucylprolylphenylalanylseryla spartylprolylleucylalanylaspartylglycylprolylthreonylisoleucylglutaminylasparaginylalanylthreonylleucyl arginylalanylphenylalanylalanylalanylglycylvalylthreonylprolylalanylglutaminylcysteinylphenylalanylglu tamylmethionylleucylalanylleucylisoleucylarginylglutaminyllysylhistidylprolylthreonylisoleucylprolylisol eucylglycylleucylleucylmethionyltyrosylalanylasparaginylleucylvalylphenylalanylasparaginyllysylglycyli soleucylaspartylglutamylphenylalanyltyrosylalanylglutaminylcysteinylglutamyllysylvalylglycylvalylaspa rtylserylvalylleucylvalylalanylaspartylvalylprolylvalylglutaminylglutamylserylalanylprolylphen |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'twitter' | |
require 'json' | |
require 'faraday' | |
# things you must configure | |
PATH_TO_DROPBOX = "/Users/your_name/Dropbox/backup/tweets/" # you need to create this folder | |
TWITTER_USER = "your_twitter_username" |
This file contains hidden or 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
class Admin::DelayedJobsController < AdminController | |
# GET /admin/delayed_jobs | |
def index | |
@delayed_jobs = Delayed::Backend::Mongoid::Job.desc(:created_at) | |
.paginate :page => params[:page], :per_page => 20 | |
end | |
end |
This file contains hidden or 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
# system-specific logs may be also be configured here. | |
/home/*/logs/*_log /home/*/domains/*/logs/*_log { | |
rotate 5 | |
weekly | |
compress | |
postrotate | |
cp /dev/null /path/to/where/the/apache/log/file/lives | |
cp /dev/null /path/to/where/the/other/files/is | |
cp /dev/null /path/to/where/the/other/files/is/etc/etc | |
endscript |
This file contains hidden or 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 'fog' | |
puts "Starting.." | |
today = Time.now.strftime("%Y%m%d") | |
puts "Today is #{today}" | |
@fog = Fog::Compute.new(:provider => 'AWS', :aws_access_key_id => 'YOUR_ACCESS_KEY', :aws_secret_access_key => 'YOUR_SEKRET_ACCESS_KEY') | |
volumes = @fog.volumes.all | |
volumes.each do |vol| |
This file contains hidden or 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
#!/usr/bin/env bash | |
if [ $# -lt 1 ] ; then | |
echo "Usage: " $0 " <start | stop> " | |
exit 1 | |
fi | |
action=$1 | |
rails_root=`pwd` | |
logfile=$rails_root/log/monit_delayed_job.log |
This file contains hidden or 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
class Date | |
def to_words | |
if self == Date.today | |
"Today" | |
elsif self <= Date.today - 1 | |
if self == Date.today - 1 | |
"Yesterday" | |
elsif ((Date.today - 7)..(Date.today - 1)).include?(self) | |
"Last #{self.strftime("%A")}" | |
elsif ((Date.today - 14)..(Date.today - 8)).include?(self) |