Skip to content

Instantly share code, notes, and snippets.

View rafaotetra's full-sized avatar

Rafael Silva rafaotetra

View GitHub Profile
provider "aws" {
version = "~> 2.0"
region = "eu-west-2"
}
# Providing a reference to our default VPC
resource "aws_default_vpc" "default_vpc" {
}
# Providing a reference to our default subnets
@rafaotetra
rafaotetra / node_exporter.default
Created May 21, 2021 15:12 — forked from eloo/node_exporter.default
Init.d script for prometheus node exporter
# Set the command-line arguments to pass to the server.
ARGS='-web.listen-address=:9100 -collector.diskstats.ignored-devices="^(ram|loop|fd)\\d+$"'
# Prometheus-node-exporter supports the following options:
# -collector.diskstats.ignored-devices="^(ram|loop|fd|(h|s|v|xv)d[a-z])\\d+$": Regexp of devices to ignore for diskstats.
# -collector.filesystem.ignored-mount-points="^/(sys|proc|dev)($|/)": Regexp of mount points to ignore for filesystem collector.
# -collector.ipvs.procfs="/proc": procfs mountpoint.
# -collector.megacli.command="megacli": Command to run megacli.
# -collector.ntp.server="": NTP server to use for ntp collector.
# -collector.textfile.directory="": Directory to read text files with metrics from.
@rafaotetra
rafaotetra / rds.sh
Created March 6, 2018 21:15 — forked from onyxraven/rds.sh
Amazon RDS Performance Tuning Settings
#XLarge DBInstanceClassMemory = 15892177440 = 14.8GB
#/32 = 496630545 = 473MB
#/64 = 248315272 = 236MB
#/128 = 124157636 = 118MB
#/256 = 62078818 = 59MB
#/512 = 31039409 = 29MB
#/12582880 = 1263 #default same divisor as max_connections = 4041.6MB = 4237924762
#/25165760 = 623 # half of max_connections = 1993.6MB
#/50331520 = 315 # quarter of max_connections = 1008MB = 1056964608
#*(3/4) #default innodb pool size = 11922309120
@rafaotetra
rafaotetra / sysctl.conf
Created February 16, 2018 13:04 — forked from kfox/sysctl.conf
Linux kernel tuning settings for large number of concurrent clients
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
@rafaotetra
rafaotetra / setenv.sh
Created February 8, 2018 17:27 — forked from patmandenver/setenv.sh
Tomcat8 setenv.sh
#
# Cutom Environment Variables for Tomcat
#
############################################
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/jre
export PATH=${JAVA_HOME}/bin:${PATH}
############################################
#
# JAVA_OPTS
@rafaotetra
rafaotetra / LC_CTYPE.txt
Created January 8, 2018 11:54 — forked from thanksdanny/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
import os
import sys
import time
import argparse
import boto3
if os.environ.get('AWS_PROFILE') is None:
sys.exit('Environment variable AWS_PROFILE not set')
argparser = argparse.ArgumentParser(description='Snapshot EC2 instance volume with volume ID specified by argument')
import os
import sys
import time
import argparse
import boto3
if os.environ.get('AWS_PROFILE') is None:
sys.exit('Environment variable AWS_PROFILE not set')
argparser = argparse.ArgumentParser(description='Snapshot EC2 instance volume with volume ID specified by argument')
@rafaotetra
rafaotetra / pg_backup_db_script.sh
Created October 25, 2017 15:43 — forked from ppatelcodal/pg_backup_db_script.sh
BASH Script to backup RDS/EC2 PostgreSQL DB and upload to S3 weekly
#!/bin/bash
# Run as sudo. for weekly backup of db. and upload to s3 bucket.
DBHOME="/home/priyank/crontabs/dbbackups/"
BUCKETNAME="yourAWSbucket"
SCRIPTNAME="$(basename $BASH_SOURCE)"
SCRIPTFULLPATH="$(pwd)/$(basename $BASH_SOURCE)"
mkdir -p $DBHOME
chown -R postgres:postgres $DBHOME
cp $SCRIPTFULLPATH $DBHOME
SCHEMA_BACKUP="$DBHOME/$(date +%w).sql"
@rafaotetra
rafaotetra / iamlookup
Created October 11, 2017 09:44 — forked from aelsabbahy/iamlookup
Simple script to lookup IAM resource conditions
#!/bin/bash
set -e
REPO_DIR=~/.iam_lookup/complete-aws-iam-reference
REPO_URL=https://github.com/widdix/complete-aws-iam-reference
if [[ $1 == "update" ]];then
if [[ -e $REPO_DIR ]];then
(cd "$REPO_DIR" && git pull)
else