Skip to content

Instantly share code, notes, and snippets.

View addomafi's full-sized avatar
🤓
Working

Adauto Martins addomafi

🤓
Working
View GitHub Profile

Keybase proof

I hereby claim:

  • I am addomafi on github.
  • I am adautomartins (https://keybase.io/adautomartins) on keybase.
  • I have a public key ASDBKXIFMd9xWhKxsBomATp6J9FBCGITOSxLBEAvcTukmwo

To claim this, I am signing this object:

#!/bin/bash
users=$1
sudoers=$2
for user in $users; do
set -- `echo $user | tr ':' ' '`
user=$1
pem=$(echo "ssh-rsa $2" | base64 -w 0)
echo "Adding user ${user}"

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@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");

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 ]

Show hidden files

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

Hide hidden files

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

@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:

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 / 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]
@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