Skip to content

Instantly share code, notes, and snippets.

View ryanpadilha's full-sized avatar
:octocat:

Ryan Padilha ryanpadilha

:octocat:
View GitHub Profile
@ryanpadilha
ryanpadilha / memory-leak.py
Created January 8, 2018 17:18
Discover memory leak in python
import gc
def dump_garbage():
"""
show us what's the garbage about
"""
# force collection
print "\nGARBAGE:"
gc.collect()
@ryanpadilha
ryanpadilha / docker-uninstall.sh
Last active July 8, 2020 09:29
Remove complete docker
# identify what installed package you have
dpkg -l | grep -i docker
# remove for docker.io
sudo apt-get remove docker docker-engine docker.io
sudo apt-get purge -y docker.io
sudo apt-get autoremove -y --purge docker.io
sudo apt-get autoclean
sudo rm -rf /var/lib/docker
db:
image: postgres:9.3
volumes:
- ~/.docker-volumes/blog/db/:/var/lib/postgresql/data/
expose:
- '5432'
app:
build: .
command: bundle exec rails s -b 0.0.0.0 -p 3000
@ryanpadilha
ryanpadilha / docker-operate.sh
Last active December 21, 2017 13:34
Docker - operate container on Linux environment
#!/bin/bash
#
# Installation of Docker Environment
# For Ubuntu 16.04
# https://www.digitalocean.com/community/tutorials/como-instalar-e-usar-o-docker-no-ubuntu-16-04-pt
# adicional packages
sudo apt-get update
sudo apt-get install build-essential python-software-properties git
@ryanpadilha
ryanpadilha / client-cluster-nomad.hcl
Last active November 29, 2017 16:14
HashiCorp Nomad - Client on Cluster
# client-cluster-nomad.hcl for AWS
#
# available to run tasks and interact with server
#
# Download this file:
# curl -sSL https://gist.githubusercontent.com/ryanpadilha/59a0bfddf1895ed49ca12f13342040e5/raw/ -o client-cluster-nomad.hcl
#
# $ nomad agent -config=/var/wplex/devops/nomad-hashicorp/client-cluster-nomad.hcl
# increase log verbosity
@ryanpadilha
ryanpadilha / server-cluster-nomad.hcl
Last active November 28, 2017 16:09
HashiCorp Nomad - Server Cluster
# server-cluster-nomad.hcl for AWS
#
# define to start an agent in server mode and elect as a leader
# will manage state and make scheduling decisions
#
# Download this file:
# curl -sSL https://gist.githubusercontent.com/ryanpadilha/4f8bfd75c0e48c8f773882165e22cbc7/raw/ -o server-cluster-nomad.hcl
#
# $ nomad agent -config=/var/wplex/devops/nomad-hashicorp/server-cluster-nomad.hcl
@ryanpadilha
ryanpadilha / nomad-operation-for-java-app.hcl
Last active November 29, 2017 17:00
HashiCorp Nomad Operation for Java Application
# task for Java Application
#
# Download this file:
# curl -sSL https://gist.githubusercontent.com/ryanpadilha/5854213edbad8a9698c72c8a6dc66e24/raw/ -o nomad-operation-for-java-app.hcl
#
# Operation for job execution:
#
# validate job - $ nomad validate nomad-operation-for-java-app.hcl
# plan job - $ nomad plan nomad-operation-for-java-app.hcl
# execution plan - $ nomad run -check-index 55 nomad-operation-for-java-app.hcl
@ryanpadilha
ryanpadilha / nomad-install.sh
Last active December 13, 2022 09:06
HashiCorp Nomad installation on Linux x64
#!/bin/bash
#
# Installation of Hashicorp Nomad for deploy process
#
# Download this file:
# curl -sSL https://gist.githubusercontent.com/ryanpadilha/351a4a4f17afdc8eb0d963897b98122a/raw/ -o nomad-install.sh
#
echo "Initializing script for devops - Nomad Hashicorp"
@ryanpadilha
ryanpadilha / postgresql-verify-object.sql
Created November 22, 2017 16:04
Useful commands for search objects on postgresql
psql -h 172.31.3.119 -U <username> -p 5492 <database>
\dt public.*
select * from pg_tables where schemaname='public';
SELECT specific_catalog, specific_schema, specific_name, routine_name
FROM information_schema.routines
WHERE routine_type='FUNCTION'
AND specific_schema='public'
AND routine_name LIKE 'gin_%';
#!/bin/bash
#
# Jenkins 2.73.2 instructions for execute backup from .zip files of Thinbackup plugin
cd /opt/backup/jenkins
# global configuration for first use
git config --global user.email "[email protected]"
git config --global user.name "Ryan Padilha"
if [ -n "$(git status --porcelain)" ]; then