Skip to content

Instantly share code, notes, and snippets.

View nascimento's full-sized avatar

Vitor Nascimento nascimento

View GitHub Profile
@nascimento
nascimento / convert_link_to_file.sh
Created April 12, 2016 01:54
Script to conver symlink to file content.
# Command
shasum -a 256 /path/to/file | cut -c-12
# Example:
> shasum -a 256 ~/Desktop/Python-3.4.0.tgz | cut -c-12 (master⚡)
d2c83ea02177
# learned in: https://coderwall.com/p/bbfjrw/calculate-checksum-for-chef-s-remote_file-resource
@nascimento
nascimento / rbenv-howto.md
Created March 23, 2016 21:12 — forked from samukasmk/rbenv-howto.md
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@nascimento
nascimento / git-diff.sh
Created February 29, 2016 17:21
Git diff alias for git in macosx using Meld and Opendiff
#!/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
gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/ --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/
@nascimento
nascimento / tuneis_ssh.sh
Created October 22, 2015 19:27 — forked from samukasmk/tuneis_ssh.sh
Exemplos de Tuneis SSH
### TUNEL DE ACESSO A UMA PORTA REMOTA, COMO SE FOSSE LOCAL
ssh -f <USUARIO>@<IP DA MAQUINA SSH> -L <PORTA LOCAL>:localhost:<PORTA REMOTA> -N
# Ex: TUDO QUE FOR PARA MINHA PORTA LOCAL 18080, SERA DIRECIONADO A PORTA REMOTA DO SERVIDOR 8080
ssh -f samukasmk@meu_servidor.com.br -L 18080:localhost:8080 -N
### TUNEL COM NEXT HUP
ssh samukasmk@<IP SERVER PULO> -t -t -L <IP LOCAL>:<PORTA LOCAL>:localhost:<PORTA LOCAL> ssh -D <PORTA DESTINO> <USER>@<IP SERVER DESTINO>
# Ex: porta 8080 com next hup
@nascimento
nascimento / while_monitoring_ps
Last active October 21, 2015 19:22
While para monitorar comando
while :; do clear; ps aux | grep jboss | grep -v '\-app' | grep -v grep ; sleep 0.8s; done
@nascimento
nascimento / find_and_rename_multiple_files
Last active October 21, 2015 15:33
Find to add .conf from apache update from 2.2 to 2.4
find . -name '*_ssl*' -exec sh -c 'cat "$1" "${1%_ssl.conf}.conf" > "${1%_ssl.conf}.diff.conf" && mv "${1%_ssl.conf}.diff.conf" "${1%_ssl.conf}.conf" && rm "$1"' _ {} \;
find . -mtime -1 -type f -exec sh -c 'openssl rsa -in $1 -out ${1%startssl.key}apache.key' _ {} \;
@nascimento
nascimento / install_pip_suse11.sh
Created July 22, 2015 15:37
Install pip on suse 11 and python 2.6
curl -O https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
tar xvfz pip-1.2.1.tar.gz
cd pip-1.2.1
zypper install python-setuptools
python setup.py install
ln -sfn /usr/local/bin/pip /usr/bin/pip
pip install --upgrade awscli
cd ..