Skip to content

Instantly share code, notes, and snippets.

View samukasmk's full-sized avatar

Samuel Sampaio samukasmk

View GitHub Profile
@samukasmk
samukasmk / ruby_update-alternatives.sh
Last active August 29, 2015 13:57
Defining Ruby's path version by update-alternatives tool
#!/bin/bash
#
# By: Samuel Maciel Sampaio <samukasmk@gmail.com> [20140328]
# Defining Ruby's version by alternatives tool
# Set the ruby version you want to configure
RUBY_VERSION="1.8"
ALTERNATIVES_TOOL=$(which update-alternatives 2>/dev/null)
@samukasmk
samukasmk / nagios_cronjob_downtime_scheduler.sh
Last active March 10, 2017 10:41
Provide the nagios command interface to schedule services by cronjobs
#!/bin/bash
#
# nagios_cronjob_downtime_scheduler.sh
# by: Samuel Sampaio [20140419] <samukasmk@gmail.com>
# goal: Provide the nagios command interface to schedule services by cronjobs
# Usage: ./nagios_cronjob_downtime_scheduler.sh 'My Service' 'machine_1 machine_2' 7200
service_name="$1" #'My Service'
hosts="$2" #'my_host'
duration_secs="$3" # '200'
@samukasmk
samukasmk / deploy_kivy_app_with_kivy_launcher.sh
Last active August 29, 2015 14:04
Script tool to dynamically deploy a kivy app without to create un apk package, using (Kivy Launcher) app
#!/bin/bash
#
# script: deploy_kivy_app_with_kivy_launcher.sh
#
# by: Samuel Maciel Sampaio [20140717]
#
# contact: samukasmk@gmail.com
#
# goal:
# Develop kivy apps for android and quickly test directly in your
@samukasmk
samukasmk / sublime_deploy_in_iterm.applescript
Created July 17, 2014 17:55
Call your specific command to the current session of the current terminal
-- by: Samuel Maciel Sampaio [2014-17-07]
-- contact: samukasmk@gmail.com
-- goal: call your specific command to the current session of the current terminal
-- Special Thanks to Stefan van den Oord, 2010-12-29
-- and https://code.google.com/p/iterm2/wiki/AppleScript
tell application "iTerm"
activate
@samukasmk
samukasmk / gitconfig.example.ini
Last active March 30, 2020 22:25
Example of my ~/.gitconfig file.
[user]
name = SamukaSMk
email = samukasmk@gmail.com
[core]
excludesfile = /home/samuel/.gitignore_global
editor = /usr/bin/vim
[color]
ui = true
@samukasmk
samukasmk / open-git-diff.sh
Created November 13, 2014 19:05
Example of my script for git diff.
#!/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
@samukasmk
samukasmk / vagrant_aliases.sh
Last active August 29, 2015 14:13
Alias for vagrant commands (like: git alias)
#!/bin/bash
#
# vagrant_aliases.sh
# By: Samuel Maciel Sampaio <samuel@smk.net.br>
#
# Installation instructions:
#
# 1.) put this file in folder /usr/bin with name 'v', eg: '/usr/bin/v'
#
# 2.) to exec vagrant snap or vagrant sandbox please install this plugins:
@samukasmk
samukasmk / java_update-alternatives.sh
Last active December 10, 2015 21:03
Defining Java's version by alternatives tool
#!/bin/bash
#
# By: Samuel Maciel Sampaio <samukasmk@gmail.com> [20150122]
# Defining Java's version by alternatives tool
# Set HERE the REAL PATH to JDK FILES UNCOMPRESSED AND JAVA version you want to configure!
REAL_JDK_PATH="/usr/lib/jvm/java-1.8.0-oraclejdk-1.8.0_66"
JAVA_VERSION="1.8.0_66"
@samukasmk
samukasmk / encrypt_decrypt_salt.sh
Created February 2, 2015 14:16
Encrypt and decrypt a string (With SALT Password - AES-128-cdc)
# ENCRYPTING WITH PRE-DEFINED (SALT PASSWORD)
$ echo 'this is my password' | openssl enc -aes-128-cbc -a -salt -pass pass:HereIsMySalt
U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl
# DECRYPTING WITH PRE-DEFINED (SALT PASSWORD)
$ echo 'U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl' | openssl enc -aes-128-cbc -a -d -salt -pass pass:HereIsMySalt
this is my password
# EXAMPLE OF DECRYPTING WITH WRONG SALT PASSWORD, GENERATING ERROR
$ echo 'U2FsdGVkX19+mJ+opjDjbw8Y6fmCtIznZI8lG1/+xs87youRvvZUzIlSiCMysoOl' | openssl enc -aes-128-cbc -a -d -salt -pass pass:PassingWrongSalt
@samukasmk
samukasmk / pymetter.py
Last active August 29, 2015 14:18
Pymetter: Test webpage with json content and calculate average elapsed time
#!/usr/bin/python
#
# script: pymetter
# by: Samuel Maciel Sampaio [20150403] <samukasmk@gmail.com>
# goal: Test webpage with json content and calculate average elapsed time
# example of use:
# ./pymetter.py --url https://api.github.com/user \
# --http-user 'your_github_username' \
# --http-pass 'your_github_password'