Skip to content

Instantly share code, notes, and snippets.

@brunoadacosta
brunoadacosta / aws_glacier_delete_vault.md
Created March 11, 2021 13:24 — forked from veuncent/aws_glacier_delete_vault.md
Delete all archives in an AWS Vault

AWS Glacier: Delete vault

Follow these steps to remove all archives from an AWS vault. After this is finished, you will be able to delete the vault itself through the browser console.

Step 1 / Retrieve inventory

This will create a job that collects required information about the vault.

$ aws glacier initiate-job --job-parameters '{"Type": "inventory-retrieval"}' --account-id YOUR_ACCOUNT_ID --region YOUR_REGION --vault-name YOUR_VAULT_NAME 
#!/bin/bash
data_dir="/usr/data"
sudo mkdir $data_dir
sudo chown mysql:mysql $data_dir
echo "deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7" | sudo tee /etc/apt/sources.list.d/mysql57.list
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/mysql57.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
touch /tmp/.apt_update_ran
Vim - Adicione as linhas abaixo no .vimrc
" Remove trailing spaces
autocmd FileType ruby,eruby,javascript,jst,go autocmd BufWritePre <buffer> :%s/\s\+$//e
SublimeText - Adicionar em File Settings -- User config
{
"tab_size": 2,
"translate_tabs_to_spaces": true,
@brunoadacosta
brunoadacosta / gist:0bc09227dcec623ee9cd
Created October 8, 2015 18:56
mysql_ruby_performance.rb
# In MySQL you cannot have nested transactions, instead you have 'savepoints'.
#
# Without `:requires_new` AR realizes that you are in transaction, but does not
# create 'savepoint' automatically.
def nested_trx(requires_new: false, rollback: false)
ActiveRecord::Base.transaction do
# Load some data to generate sql
User.find_by_id(1)
# now start nested transaction.
brew list -1 | while read line; do brew unlink $line; brew link $line; done
class Calculadora
def soma(a, b)
a + b
end
def divide(a, b)
a / b
end
def multiplica(a, b)
class User
def name
@name
end
def name=(name)
@name = name
end
def age
@brunoadacosta
brunoadacosta / ccat.sh
Last active August 29, 2015 14:11 — forked from nuxlli/ccat.sh
#!/bin/bash
# Font: http://scott.sherrillmix.com/blog/programmer/syntax-highlighting-in-terminal/
if [ ! -t 0 ];then
file=/dev/stdin
elif [ -f $1 ];then
file=$1
else
echo "Usage: $0 code.c"
@brunoadacosta
brunoadacosta / gist:b8eae7f512a9a0491c9c
Created August 12, 2014 18:17
Install apps on osx
#!/bin/bash
mkdir ~/macapps_temp
cd ~/macapps_temp
# Installing Chrome
curl -L -O "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"
hdiutil mount -nobrowse googlechrome.dmg
cp -R "/Volumes/Google Chrome/Google Chrome.app" /Applications
hdiutil unmount "/Volumes/Google Chrome"
module SupplierIntegration
class FastShop < SupplierIntegration::Interface
def self.synchronize_products(supplier_id)
supplier = Supplier.find(supplier_id)
last_date = supplier.update_products.last ? supplier.update_products.last.date : get_today_date
current_date = get_today_date
update_products_catalog