Skip to content

Instantly share code, notes, and snippets.

View samukasmk's full-sized avatar

Samuel Sampaio samukasmk

View GitHub Profile
@samukasmk
samukasmk / backup-mysql-magento-stores.sh
Last active August 29, 2015 13:57
backup-mysql-magento-stores.sh - Make easy backups of mysql databases for magento stores
#!/bin/bash
#
# Goal: Make backup of mysql databases for magento stores
# Created by: Samuel Maciel Sampaio [20120901] [20140321]
# Contact: samukasmk@gmail.com <smktecnologia.com.br>
# Needed Applications:
# - mysql
# - mysqldump
# - s3put
@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 / 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 / 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 / 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'
@samukasmk
samukasmk / chef_load_data_bag_encrypted.rb
Created May 8, 2015 16:25
Example of support for Data bag encrypted on Chef
# Example of support for Data bag encrypted on Chef
# By: Samuel Maciel Sampaio <samukasmk@gmail.com>
# get data_bag obj
search("my_data_bag_name", "id:my_data_bag_item_name").each do |my_data_bag_obj|
# find for keys encrypted
key_found = my_data_bag_obj.keys.select{ |k| k != "id" }[0]
# if exists some key and its encrypted, reassing the data_bag obj
@samukasmk
samukasmk / exemplo_de_find_linux_com_datas.sh
Created May 15, 2015 15:05
Exemplo de find no linux com datas
###### Exemplos de uso de data com find:
# http://www.unix.com/shell-programming-and-scripting/39909-delete-file-older-than-n-days.html
"Yes, the 'find' has three options for number of days:
1) +n --> More than 'n' days ago.
2) -n --> Less than 'n' days ago.
3) n ---> Exactly 'n' days ago.
Thus, if you specify '+1', it means more than 1 day ago."
@samukasmk
samukasmk / broken_fortunes_cowsay.sh
Last active August 29, 2015 14:21
Example of fortunes, cowsay and lolcal (broken version)
#!/bin/bash
# see: http://blog.tomtung.com/2009/11/cowsay-fortune
# http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed
# https://github.com/busyloop/lolcat
# https://github.com/dorentus/mruby-lolcat-bin
#
# requires `fortune`, `cowsay`,
# and ruby gem `lolcat` or its mruby version equivalent
export LANG="en_US.UTF-8"