Skip to content

Instantly share code, notes, and snippets.

Avatar

Vitor Nascimento nascimento

View GitHub Profile
@nascimento
nascimento / cloudSettings
Last active Jul 28, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-07-28T15:37:31.239Z","extensionVersion":"v3.4.3"}
View sep.sh
#!/bin/bash
# relaunch with sudo if we aren't root
if [[ $EUID -ne 0 ]]; then
echo "$0: relaunching as sudo $0 $1 $USER"
sudo "$0" $1 $USER
exit $?
fi
real_user=$USER
@nascimento
nascimento / entry_point.sh
Created Oct 29, 2018
Get SSM parameters to ECS
View entry_point.sh
#!/bin/sh
PARAMETERS=`aws ssm get-parameters-by-path --path ${1} --with-decryption`
for row in $(echo ${PARAMETERS} | jq -c '.Parameters' | jq -c '.[]'); do
KEY=$(basename $(echo ${row} | jq -c '.Name'))
VALUE=$(echo ${row} | jq -c '.Value')
KEY=`echo ${KEY} | tr -d '"'`
VALUE=`echo ${VALUE} | tr -d '"'`
View Remover arquivos de commits antigos
git filter-branch --index-filter 'git rm --cached --ignore-unmatch blah.jar' -f --tag-name-filter cat -- --all
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch folder/' -f --tag-name-filter cat -- --all
@nascimento
nascimento / worker_stress.rb
Created Feb 12, 2018
Mult Thread to Stress service with Ruby
View worker_stress.rb
require 'mechanize'
require 'open-uri'
require 'rubygems'
require 'work_queue'
wq = WorkQueue.new 1000
(1..5000).each do |number|
#beginning = Time.now
wq.enqueue_b do
@nascimento
nascimento / smtp.rb
Created Feb 12, 2018
smtp_ruby_sample.rb
View smtp.rb
#!/usr/bin/env ruby
require 'net/smtp'
unless (2..3).include? ARGV.length
puts 'Usage: mail.rb SUBJECT TO [FROM]'
exit 1
end
subject, to, from_ = ARGV
View .zpreztorc
#
# Sets Prezto options.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
#
# General
#
@nascimento
nascimento / humanize.rb
Created Nov 7, 2016
Detailed distance from seconds
View humanize.rb
def humanize secs
[[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, name|
if secs > 0
secs, n = secs.divmod(count)
"#{n.to_i} #{name}"
end
}.compact.reverse.join(' ')
end
p humanize 1234
View bash_profile
### Start Piperita Theme ###
# Theme by Jacob Tomlinson
# https://github.com/killfall/terminal-piperita
# Aliases to make ls easier to use in different modes, taken from Red Hat EL 6
alias ls='ls -GFh'
alias ll="ls -l"
alias lo="ls -o"
alias lh="ls -lh"
alias la="ls -la"
@nascimento
nascimento / convert_link_to_file.sh
Created Apr 12, 2016
Script to conver symlink to file content.
View convert_link_to_file.sh