Skip to content

Instantly share code, notes, and snippets.

View mv's full-sized avatar

Marcus Vinicius Ferreira mv

View GitHub Profile
@mv
mv / aws-cw.rb
Last active December 18, 2015 23:48
AWS: Cloudwatch
require 'aws-sdk'
AWS.config({
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
:region => 'sa-east-1'
})
cw = AWS::CloudWatch.new
require 'aws-sdk'
AWS.config({
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
:region => 'sa-east-1'
})
ec2 = AWS::EC2.new
@mv
mv / aws-x509.md
Created November 30, 2012 19:25
AWS x509 SelfSigned User Certificate

X.509 self-signed key

1. Generate Private key

# create private key
openssl genrsa -des3 -out pk.encrypted.key 2048

Remove passphrase from encrypted key

@mv
mv / aws.sh
Created November 30, 2012 19:04
AWS Command Line Tools: using MacOS and brew
#!/bin/bash
#
# using ec2 tools
#
# Marcus Vinicius Fereira ferreira.mv[ at ].gmail.com
# 2011-11
###
### programs
@mv
mv / check_aws_status.rb
Created October 16, 2012 12:35 — forked from ktheory/check_aws_status.rb
Nagios plugin to check AWS Status RSS feeds
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'net/http'
# check_aws_status.rb
# A nagios plugin for fetching RSS feeds from http://status.aws.amazon.com.
# Source: https://gist.github.com/1604786
# Written by Aaron Suggs: https://github.com/ktheory
@mv
mv / redis2txt.rb
Created August 18, 2012 09:27 — forked from nono/redis2txt.rb
Export data from redis to a plain text files
#!/usr/bin/env ruby
require "redis"
redis = Redis.new
redis.keys("*").each do |key|
val = case redis.type(key)
when "string"
redis.get key
when "list"
@mv
mv / gist:2819323
Created May 28, 2012 13:55 — forked from matthewhudson/good-commit.md
Linus Torvalds describes a good commit message. See https://github.com/torvalds/subsurface/blob/master/README#L161
A good commit message looks like this:
Header line: explaining the commit in one line
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
@mv
mv / cronjob.sh
Created January 21, 2012 18:06
Script to transform Amazon RDS slow log table into the MySQL slow query log format
#!/bin/bash
(/usr/local/bin/db2log | \
mk-query-digest --fingerprints \
--filter '$event->{user} !~ m/^(bi|memonic)$/') 2>&1 | \
mail -s "MySQL slow logs" root
# Rotate slow logs. Will move them into the backup table slow_log_backup. If
# that table exists it's overwritten with the primary slow log.
# So with this strategy we can still access yesterday's slow log by querying
# slow_log_backup.
@mv
mv / facter.log
Created December 31, 2011 20:14
Bug 10271: cap command line execution in 7 instances
$ cat facter.log
** [out :: ec2-107-22-149-65.compute-1.amazonaws.com] Amazon Linux AMI release 2011.09
** [out :: ec2-107-22-149-65.compute-1.amazonaws.com] operatingsystem => Amazon
** [out :: ec2-107-22-149-65.compute-1.amazonaws.com] operatingsystemrelease => 2.6.35.14-97.44.amzn1.x86_64
** [out :: ec2-174-129-92-129.compute-1.amazonaws.com] Amazon Linux AMI release 1 (beta)
** [out :: ec2-174-129-92-129.compute-1.amazonaws.com] operatingsystem => Amazon
** [out :: ec2-174-129-92-129.compute-1.amazonaws.com] operatingsystemrelease => 2.6.34.6-54.24.amzn1.x86_64
** [out :: ec2-184-72-202-223.compute-1.amazonaws.com] Amazon Linux AMI release 1 (beta)
** [out :: ec2-184-72-202-223.compute-1.amazonaws.com] operatingsystem => Amazon
** [out :: ec2-184-72-202-223.compute-1.amazonaws.com] operatingsystemrelease => 2.6.34.7-56.40.amzn1.x86_64
@mv
mv / Capfile
Created December 31, 2011 20:11
Capistrano: executing facter from local source
load "server.rb"
default_run_options[:pty] = true
desc "Install Git, Ruby"
task :prereq do
run "sudo yum install -y git ruby ", :pty => true
end