Skip to content

Instantly share code, notes, and snippets.

View nascimento's full-sized avatar

Vitor Nascimento nascimento

View GitHub Profile
@nascimento
nascimento / route53.rb
Last active August 29, 2015 14:25
AWS-SDK Route53 creating entries on hosted_zone_id
require 'aws-sdk'
route53 = Aws::Route53::Client.new(
region: 'sa-east-1',
access_key_id: 'xxxxx',
secret_access_key: 'xxxxx'
)
changes = []
changes << {
:action => 'CREATE',
@nascimento
nascimento / route53_list.rb
Created July 20, 2015 19:11
AWS SDK Route 53 list zone entries.
require 'aws-sdk'
route53 = Aws::Route53::Client.new(
region: 'sa-east-1',
access_key_id: 'xxxxxx',
secret_access_key: 'xxxxxx'
)
response = route53.list_resource_record_sets(
:hosted_zone_id => "xxxxxx",
)
@nascimento
nascimento / compare_crt_key.txt
Last active August 29, 2015 14:25
Compare CRT and KEY
get md5 from crt
openssl x509 -noout -modulus -in /etc/yourcertificate.crt | openssl md5
get md5 from key
openssl rsa -noout -modulus -in /etc/private.key | openssl md5
@nascimento
nascimento / install_pip_suse11.sh
Created July 22, 2015 15:37
Install pip on suse 11 and python 2.6
curl -O https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
tar xvfz pip-1.2.1.tar.gz
cd pip-1.2.1
zypper install python-setuptools
python setup.py install
ln -sfn /usr/local/bin/pip /usr/bin/pip
pip install --upgrade awscli
cd ..
find . -mtime -1 -type f -exec sh -c 'openssl rsa -in $1 -out ${1%startssl.key}apache.key' _ {} \;
@nascimento
nascimento / find_and_rename_multiple_files
Last active October 21, 2015 15:33
Find to add .conf from apache update from 2.2 to 2.4
find . -name '*_ssl*' -exec sh -c 'cat "$1" "${1%_ssl.conf}.conf" > "${1%_ssl.conf}.diff.conf" && mv "${1%_ssl.conf}.diff.conf" "${1%_ssl.conf}.conf" && rm "$1"' _ {} \;
@nascimento
nascimento / while_monitoring_ps
Last active October 21, 2015 19:22
While para monitorar comando
while :; do clear; ps aux | grep jboss | grep -v '\-app' | grep -v grep ; sleep 0.8s; done
@nascimento
nascimento / tuneis_ssh.sh
Created October 22, 2015 19:27 — forked from samukasmk/tuneis_ssh.sh
Exemplos de Tuneis SSH
### TUNEL DE ACESSO A UMA PORTA REMOTA, COMO SE FOSSE LOCAL
ssh -f <USUARIO>@<IP DA MAQUINA SSH> -L <PORTA LOCAL>:localhost:<PORTA REMOTA> -N
# Ex: TUDO QUE FOR PARA MINHA PORTA LOCAL 18080, SERA DIRECIONADO A PORTA REMOTA DO SERVIDOR 8080
ssh -f samukasmk@meu_servidor.com.br -L 18080:localhost:8080 -N
### TUNEL COM NEXT HUP
ssh samukasmk@<IP SERVER PULO> -t -t -L <IP LOCAL>:<PORTA LOCAL>:localhost:<PORTA LOCAL> ssh -D <PORTA DESTINO> <USER>@<IP SERVER DESTINO>
# Ex: porta 8080 com next hup
gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/ --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/
@nascimento
nascimento / git-diff.sh
Created February 29, 2016 17:21
Git diff alias for git in macosx using Meld and Opendiff
#!/bin/bash
echo "Opening Modified file: ($5) -> ($2)"
os_name=`uname -s`
case $os_name in
Darwin) opendiff "$2" "$5" > /dev/null 2>&1
;;
*) meld "$2" "$5" > /dev/null 2>&1
esac