Skip to content

Instantly share code, notes, and snippets.

View addomafi's full-sized avatar
🤓
Working

Adauto Martins addomafi

🤓
Working
View GitHub Profile
@addomafi
addomafi / s3_bucket_lifecycles.py
Last active August 26, 2020 14:17
Describe all S3 buckets and the lifecycles policies
import sys
import boto3, json, copy
from datetime import datetime, timedelta
import dateutil.parser
from time import sleep
session = boto3.Session(profile_name='bkp-default', region_name='us-east-1')
s3 = session.client('s3')
@addomafi
addomafi / ec2_metrics.py
Last active June 3, 2020 17:30
Script to collect data from EC2 instances
import sys
import boto3, json
from datetime import datetime, timedelta
import dateutil.parser
from time import sleep
# pbpaste | jq -r '.[] | [.BucketName, .StorageType, .SizeBytes, .ObjectCount, .Timestamp] | @csv'| sed s/\"//g
# based on http://www.quora.com/Amazon-S3/What-is-the-fastest-way-to-measure-the-total-size-of-an-S3-bucket
import sys
import boto3, json
from datetime import datetime, timedelta
import dateutil.parser
from time import sleep
# pbpaste | jq -r '.[] | [.BucketName, .StorageType, .SizeBytes, .ObjectCount, .Timestamp] | @tsv'
# based on http://www.quora.com/Amazon-S3/What-is-the-fastest-way-to-measure-the-total-size-of-an-S3-bucket
@addomafi
addomafi / ebs_metrics.py
Last active June 3, 2020 17:16
Script to get metrics from EBS
import sys
import boto3, json
from datetime import datetime, timedelta
import dateutil.parser
from time import sleep
# pbpaste | | jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' | sed s/\"//g
# based on http://www.quora.com/Amazon-S3/What-is-the-fastest-way-to-measure-the-total-size-of-an-S3-bucket
@addomafi
addomafi / airflow_trigger_dag.py
Last active June 3, 2020 12:29
Script to trigger an dag
#!/usr/bin/env python
from airflow.api.common.experimental.trigger_dag import trigger_dag
from airflow.utils import timezone
import json, sys, datetime, six
if __name__ == '__main__':
trigger_dag_id = sys.argv[1]

Create domain

virt-install -n manjaro-test -r 2640 --arch=x86_64 --os-type=linux --os-variant=archlinux --disk path=/home/addomafi/VirtualMachines/manjaro-kde.img,size=20,format=raw,bus=ide -w bridge=virbr0,model=virtio --graphics vnc,password=10s04k82 --noautoconsole --virt-type kvm --import

QEMU X86

sudo qemu-system-x86_64 -enable-kvm -drive file=~/VirtualMachines/manjaro-kde.img,index=0,if=ide,media=disk -m 2640 -vnc :0 -smp 4,sockets=1,cores=4,threads=1,maxcpus=4

@addomafi
addomafi / brew-java-and-jenv.md
Created April 10, 2019 15:20 — forked from tomysmile/brew-java-and-jenv.md
How To Install Java 8 on Mac

Install HomeBrew first

brew update
brew tap caskroom/cask
brew install brew-cask

If you get the error "already installed", follow the instructions to unlink it, then install again:

Show hidden files

defaults write com.apple.finder AppleShowAllFiles TRUE;killall Finder

Hide hidden files

defaults write com.apple.finder AppleShowAllFiles FALSE;killall Finder

How To: Two Way SSL

This guide explain how to create all the required certificates to enable SSL client authentication and revogation of certificates

Attention: I suppose that you already know how to generate a Self-Signed certificate for Root CA!

First of all you will need to generate a some config files to start, these files will be required:

ca.conf - config that enable a certificate revogation flow
[ ca ]
@addomafi
addomafi / soa_db_maintenance.sql
Last active June 27, 2018 13:32
SOA DB Maintenance
-- Drop Message Reports Data
truncate table OSB1213_SOAINFRA.WLI_QS_REPORT_DATA;
alter table OSB1213_SOAINFRA.WLI_QS_REPORT_DATA DISABLE constraint FK_WLI_QS_REPORT_DATA;
truncate table OSB1213_SOAINFRA.WLI_QS_REPORT_ATTRIBUTE;
alter table OSB1213_SOAINFRA.WLI_QS_REPORT_DATA ENABLE constraint FK_WLI_QS_REPORT_DATA;
-- Create Message Report Index
create index OSB1213_SOAINFRA.IDX$$_36870001 on
OSB1213_SOAINFRA.WLI_QS_REPORT_ATTRIBUTE("DB_TIMESTAMP","MSG_GUID");