Skip to content

Instantly share code, notes, and snippets.

View thiagomgo's full-sized avatar
💜

Thiago Gomes thiagomgo

💜
  • Brazil
View GitHub Profile
@thiagomgo
thiagomgo / production.rb
Last active January 20, 2020 14:04 — forked from pvin/production.rb
Ruby on Rails production log rotation
# Log Rotate by initialising logger from the app
#Way one
# reference : http://ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html#method-c-new
# This one from Atinder Singh https://medium.com/@atinders/easy-log-rotation-with-rails-5-7b8d3c173461
# config/environments/production.rb
Rails.application.configure do
@thiagomgo
thiagomgo / Update remote repo
Last active January 25, 2019 19:59 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/user/awesome-new-repo.git
$ git branch --set-upstream-to=origin/master master
$ git push origin master
$ git pull origin master --allow-unrelated-histories
@thiagomgo
thiagomgo / gist:16603603867c645df284a3eea72720c7
Last active March 1, 2018 14:55 — forked from weblancaster/gist:6e7f43fc02725ce747e224b0c4290906
Kill all container, remove all images and stop all containers
#stop all containers:
docker kill $(docker ps -q)
#remove all containers
docker rm $(docker ps -a -q)
#remove all old containers
docker rm $(docker ps --filter "status=exited" -q)
#remove all docker images
@thiagomgo
thiagomgo / openssh-7.3.sh
Last active January 2, 2018 14:30 — forked from stefansundin/openssh-7.3.sh
Install OpenSSH 7.3 in Ubuntu 16.04
ssh -V
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
mkdir ssh-packages
cd ssh-packages
wget https://launchpadlibrarian.net/277739251/openssh-client_7.3p1-1_amd64.deb
wget https://launchpadlibrarian.net/298453050/libgssapi-krb5-2_1.14.3+dfsg-2ubuntu1_amd64.deb
wget https://launchpadlibrarian.net/298453058/libkrb5-3_1.14.3+dfsg-2ubuntu1_amd64.deb
wget https://launchpadlibrarian.net/298453060/libkrb5support0_1.14.3+dfsg-2ubuntu1_amd64.deb
sudo dpkg -i *.deb
@thiagomgo
thiagomgo / jmxremote_arguments.sh
Last active September 26, 2017 15:55 — forked from rponte/jmxremote_arguments.sh
Arguments to enable JMX on JVM - Example of setenv.sh file
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8086
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
@thiagomgo
thiagomgo / snapshots.py
Created June 12, 2017 22:08 — forked from Eyjafjallajokull/README.md
AWS EBS - Find unused snapshots - this script generates csv raport about snapshot usage
import re
import boto3
import csv
from botocore.exceptions import ClientError
ec2 = boto3.client('ec2')
def get_snapshots():
return ec2.describe_snapshots(OwnerIds=['self'])['Snapshots']
@thiagomgo
thiagomgo / zbx-exim-stats.sh
Last active March 11, 2017 21:08 — forked from crashdump/zbx-exim-stats.sh
A simple Zabbix statistics pusher. It check and report these values: - Number of running processes exim4 (trigger if 0) - Mails Queue Size (trigger if >500 and >1000) - Mails Received - Mails Error - Mails Received Size in Bytes - Mails Delivered - Mails Delivered Size in BytesImport the template. Assign to you hosts. Cron the .sh.. You're good …
#!/bin/bash
# Set Variables
EXIMLOG=/var/log/exim_mainlog
MYLOG=/tmp/exim_status.log
OFFSETFILE=/tmp/eximstatusoffset.dat
EXIMSTATS=/usr/sbin/eximstats
LOGTAIL=/usr/sbin/logtail
ZABBIX_SENDER=/usr/bin/zabbix_sender
ZABBIX_CONF=/etc/zabbix/zabbix_agentd.conf
@thiagomgo
thiagomgo / EC2-Tag-Assets-Lambda.py
Last active January 18, 2017 21:01 — forked from mlapida/EC2-Tag-Assets-Lambda.py
A lambda function that will copy EC2 tags to all related Volumes and Network Interfaces. A full writeup can be found on my site http://mlapida.com/thoughts/tagging-and-snapshotting-with-lambda
from __future__ import print_function
import json
import boto3
import logging
#setup simple logging for INFO
logger = logging.getLogger()
logger.setLevel(logging.ERROR)
@thiagomgo
thiagomgo / EC2-Start-Tagged-Lambda.py
Last active December 16, 2016 16:50 — forked from mlapida/EC2-Stopped-Tagged-Lambda.py
Using a lambda function, start/stop all instances that are tagged appropriately.
import boto3
import logging
#setup simple logging for INFO
logger = logging.getLogger()
logger.setLevel(logging.INFO)
#define the connection
ec2 = boto3.resource('ec2')
@thiagomgo
thiagomgo / Install-Docker-on-Linux-Mint.sh
Last active September 29, 2016 14:42 — forked from sirkkalap/Install-Docker-on-Linux-Mint.sh
Install Docker on Linux Mint
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x
##########################################
# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
sudo apt-get update
sudo apt-get install -y apt-transport-https
fi