Skip to content

Instantly share code, notes, and snippets.

View ryanpadilha's full-sized avatar
:octocat:

Ryan Padilha ryanpadilha

:octocat:
View GitHub Profile
TARGET=$WORKSPACE/target
PROJECT_NAME=project-name
if [ ! -d "$TARGET" ]; then
mkdir -p "$TARGET"
fi
tar --exclude="$WORKSPACE/.git" --exclude="$WORKSPACE/.idea" --exclude="$WORKSPACE/venv-sandbox" --exclude="$WORKSPACE/target" -pczvf $TARGET/$PROJECT_NAME.tar.gz $WORKSPACE
@ryanpadilha
ryanpadilha / Dockerfile
Last active May 16, 2018 15:55
Docker Scripts
##
# docker-container for Python 3.5
##
# generate-image : docker build -t flask-origins --build-arg VERSION=1.0.0 .
# tag-image : docker tag flask-origins <user>/flask-origins:latest
# push-image : docker push <user>/flask-origins
##
# run-container : docker run -d -p 8000:8000 --name flask_origins flask-origins
# container-limit : docker run --memory=750m --memory-swap=750m --oom-kill-disable -d -p 8000:8000 --name flask_origins flask-origins
##
@ryanpadilha
ryanpadilha / postgresql.timezone.conf
Last active March 26, 2018 16:40
Postgresql timezone for America - São Paulo
1. Find the timezone on /usr/share/postgresql/9.6/timezonesets
2. Configure the timezone for Sao_Paulo by timezone = 'America/Sao_Paulo' # 'UTC'
3. Restart the server
@ryanpadilha
ryanpadilha / gist:58d3fd904ef19be055f6c5c5889de7f1
Created February 27, 2018 14:53 — forked from maximebf/gist:3986659
Jinja2 macro to render WTForms fields with Twitter Bootstrap
{% macro form_field(field) -%}
{% set with_label = kwargs.pop('with_label', False) %}
{% set placeholder = '' %}
{% if not with_label %}
{% set placeholder = field.label.text %}
{% endif %}
<div class="control-group {% if field.errors %}error{% endif %}">
{% if with_label %}
<label for="{{ field.id }}" class="control-label">
{{ field.label.text }}{% if field.flags.required %} *{% endif %}:
@ryanpadilha
ryanpadilha / App.java
Created February 12, 2018 19:07 — forked from thomasdarimont/App.java
Secure REST API Example with Spring Security, Spring Session, Spring Boot
package demo;
import java.io.Serializable;
import java.security.Principal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@ryanpadilha
ryanpadilha / Documentation.md
Created February 7, 2018 12:48 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@ryanpadilha
ryanpadilha / jenkins-backup-automated.sh
Last active February 5, 2018 12:12
Jenkins 2.73.2 instructions for execute backup from .zip files of Thinbackup plugin
#!/bin/bash
#
# Jenkins 2.73.2 instructions for execute backup from .zip files of Thinbackup plugin
# using git repository - https://github.com/ryanpadilha/jenkins-storage-backup
cd /opt/backup/jenkins
# global configuration for first use
git config --global user.email "[email protected]"
git config --global user.name "Ryan Padilha"
@ryanpadilha
ryanpadilha / docker-truncate.sh
Created January 26, 2018 13:21
Remove all containers and images
#!/bin/bash
# Delete all containers
docker rm -f $(docker ps -a -q)
# Delete all images
docker rmi -f $(docker images -q)
@ryanpadilha
ryanpadilha / certbot-operation.sh
Created January 9, 2018 20:36
Certbot is part of EFF’s effort to encrypt the entire Internet
#!/bin/bash
#
# Installation of Certbot for Ubuntu 16.04 (xenial)
# https://certbot.eff.org/#ubuntuxenial-nginx
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install -y software-properties-common
apt-get install -y python-certbot-nginx
@ryanpadilha
ryanpadilha / structure-environment-instance.sh
Last active April 20, 2018 21:49
Create a structure environment into an EC2 instance
#!/bin/bash
#
# Create the structure of folders for EC2 environment
#
echo "Initializing script for EC2 environment instance"
G_COMPANY="company"
create_directory() {