Skip to content

Instantly share code, notes, and snippets.

View wesleyit's full-sized avatar

Wesley Rodrigues wesleyit

View GitHub Profile
@wesleyit
wesleyit / calc_ec2_time_left.rb
Last active August 29, 2015 14:02
With this ruby script, you will be able to calculate how many minutes left to complete 1 more hour of utilization.
#!/usr/bin/ruby
# ##########################################################
# Encoding: UTF-8
# calc_ec2_time_left.rb
# With this ruby script, you will be able to calculate
# how many minutes left to complete 1 more hour of
# utilization.
# Wesley Rodrigues da Silva <wesley.it at gmail.com>
# LICENCE CREATIVE COMMONS BY - 2014
# http://creativecommons.org/licenses/by/2.0/legalcode
@wesleyit
wesleyit / set_jdk_env.sh
Created September 25, 2014 13:27
This script will export many useful environment variables related to Java SDK.
#!/bin/bash
# ##########################################################
# set_jdk_env.sh
# This script will export many useful environment variables
# related to Java SDK.
# Wesley Rodrigues da Silva <wesley.it at gmail.com>
# LICENCE CREATIVE COMMONS BY - 2014
# http://creativecommons.org/licenses/by/2.0/legalcode
# ##########################################################
@wesleyit
wesleyit / set_android-studio_env.sh
Last active May 24, 2017 18:43
This script will export many useful environment variables related to Android Studio and Android SDK.
#!/bin/bash
# ##########################################################
# set_android-studio_env.sh
# This script will export many useful environment variables
# related to Android Studio and Android SDK.
# Wesley Rodrigues da Silva <wesley.it at gmail.com>
# LICENCE CREATIVE COMMONS BY - 2014
# http://creativecommons.org/licenses/by/2.0/legalcode
# ##########################################################
@wesleyit
wesleyit / shell_colors.sh
Created September 26, 2014 19:58
This script will export functions used to print colorful messages in shell scripts or terminal commands.
#!/bin/bash
# ##########################################################
# shell_colors.sh
# This script will export functions used to print colorful
# messages in shell scripts or terminal commands.
# Wesley Rodrigues da Silva <wesley.it at gmail.com>
# LICENCE CREATIVE COMMONS BY - 2014
# http://creativecommons.org/licenses/by/2.0/legalcode
# ##########################################################
@wesleyit
wesleyit / crontab_header.sh
Created September 26, 2014 20:03
A default crontab header that will make the life easier for those who don't remember cron fields or keywords.
## CRONTAB HINTS AND TIPS
##
##
## Entry Description Equivalent To
## @yearly (or @annually) Run once a year at midnight in the morning of January 1 0 0 1 1 *
## @monthly Run once a month at midnight in the morning of the first of the month 0 0 1 * *
## @weekly Run once a week at midnight in the morning of Sunday 0 0 * * 0
## @daily Run once a day at midnight 0 0 * * *
## @hourly Run once an hour at the beginning of the hour 0 * * * *
## @reboot Run at startup @reboot
@wesleyit
wesleyit / stateful_iptables_port_knocking.sh
Created September 26, 2014 20:21
Shell script to setup a port knocking set of rules on SSH port.
#!/bin/bash
# ##########################################################
# stateful_iptables_port_knocking.sh
# Shell script to setup a port knocking
# set of rules on SSH port.
# Wesley Rodrigues da Silva <wesley.it at gmail.com>
# LICENCE CREATIVE COMMONS BY - 2014
# http://creativecommons.org/licenses/by/2.0/legalcode
# ########################################################
@wesleyit
wesleyit / logcatch_them_all.sh
Created September 26, 2014 20:58
Run this script to capture the logs of all Android devices connected via ADB.
#!/bin/bash
# ##########################################################
# logcatch_them_all.sh
# Run this script to capture the logs of all Android
# devices connected via ADB.
# Wesley Rodrigues da Silva <wesley.it at gmail.com>
# LICENCE CREATIVE COMMONS BY - 2014
# http://creativecommons.org/licenses/by/2.0/legalcode
# ########################################################
@wesleyit
wesleyit / bashprompt.sh
Created November 2, 2014 16:20
Improved bash prompts (I wanna be a oh-my-zsh)
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# From: http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt 02-nov-2014
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@wesleyit
wesleyit / parse_shell_infile.sh
Created January 27, 2015 15:10
This script will expand variables inside a file and generate a new file with the same name, but without the ".sh" extension.
#!/bin/bash
# ##########################################################
# parse_shell_infile.sh
# This script will expand variables inside a file
# and generate a new file with the same name, but
# without the ".sh" extension.
# Wesley Rodrigues da Silva <wesley.it at gmail.com>
# LICENCE CREATIVE COMMONS BY - 2014
# http://creativecommons.org/licenses/by/2.0/legalcode
# ##########################################################
@wesleyit
wesleyit / start_docker_apache.sh
Created June 8, 2015 21:03
This script will ensure a container is deleted before start a new instance. It will map a folder of the host SO to a folder inside the container. In this sample I am using apache, but you can replace by any other application you need.
#!/bin/bash
## Define the container name to be used on all places along this script.
# If it is not na oficial image, set the builder too. Do not forget to add
# a slash at the end, like in "BUILDER=wesleyit/myimage"
BUILDER=''
CONTAINER='apache'
VERSION='latest'
## Set the ports used by the service