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
#!/usr/bin/env ruby | |
require 'mysql2' | |
while 1 | |
client = Mysql2::Client.new( | |
host: "", | |
username: "", | |
password: "") | |
slave_status = client.query("show slave status;") |
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
#!/usr/bin/env ruby | |
require 'aws-sdk' | |
require 'logger' | |
s3 = AWS::S3.new( | |
access_key_id: '<ACCESS KEY>', | |
secret_access_key: '<SECRET KEY>' | |
) | |
logger = Logger.new('./s3_restores.log') |
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
#!/usr/bin/env ruby | |
require 'fileutils' | |
#----- Modify this block for environment -----# | |
# Set mysql_params to the username and password params for the environment. | |
# mysql_params = "-u root -psecret" | |
mysql_params = "-u root" | |
# Length of time in days to keep files |
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
def random_password(size = 10) | |
chars = (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a) - %w(i o 0 1 l 0 I O) | |
(1..size).collect{ |a| chars[rand(chars.size)] }.join | |
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
require 'mail' | |
module MailFile | |
def email_it | |
options = { address: "email.server.example.com" } | |
Mail.defaults { delivery_method :smtp, options } | |
Mail.deliver do | |
from '[email protected]' | |
to ['[email protected]', '[email protected]'] | |
subject 'Here is an awesome email for you' |