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

Keybase proof

I hereby claim:

  • I am rafaotetra on github.
  • I am rafaotetra (https://keybase.io/rafaotetra) on keybase.
  • I have a public key whose fingerprint is 2DB5 E028 48FB 1E90 F3AB 5838 3519 EDC3 B1DD 9A24

To claim this, I am signing this object:

@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 / xorg.conf
Created May 5, 2020 17:14
Xorg configuration with SiS 771/671
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
@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 / snapshot_rotation_daily.py
Created February 21, 2018 20:38
Lambda function that make snapshot rotation daily
import boto3
import re
import datetime
ec = boto3.client('ec2')
iam = boto3.client('iam')
"""
This function looks at *all* snapshots that have a "DeleteOn" tag containing
the current day formatted as YYYY-MM-DD. This function should be run at least
@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')