Skip to content

Instantly share code, notes, and snippets.

@rubendob
rubendob / node_exporter init.d
Created September 6, 2018 09:42
Prometheus node exporter in Debian Wheezy
#!/bin/sh
### BEGIN INIT INFO
# Provides: node_exporter
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: $all
# Should-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@rubendob
rubendob / tag.yml
Last active September 2, 2020 16:09
CloudCustodian Tagging Simple Policy - How write simple policy, execute and report by command line
---
policies:
- name: ec2-tag-policy
resource: aws.ec2
filters:
- or:
- "tag:Project": absent
- "tag:Team": absent
@rubendob
rubendob / aws_config_resources.txt
Created September 2, 2020 15:45
Found via https://summitroute.com/; Found by copying the HTML of https://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html to a file and running: grep "AWS::" tmp.txt | grep -v "," | grep -v "\." | sed 's/.*AWS:/AWS:/' | sed 's/<.*//' | sort
AWS::ACM::Certificate
AWS::ApiGateway::RestApi
AWS::ApiGateway::Stage
AWS::ApiGatewayV2::Api
AWS::ApiGatewayV2::Stage
AWS::AutoScaling::AutoScalingGroup
AWS::AutoScaling::LaunchConfiguration
AWS::AutoScaling::ScalingPolicy
AWS::AutoScaling::ScheduledAction
AWS::CloudFormation::Stack
@rubendob
rubendob / cloudformation_resources.txt
Last active September 2, 2020 15:42
Found via:https://summitroute.com; git clone --depth=1 https://github.com/awsdocs/aws-cloudformation-user-guide.git; cd aws-cloudformation-user-guide; grep -h "# AWS::" doc_source/aws-* | sed 's/# //' | sed 's/<.*//' | sort | uniq
##AWS::ApiGateway::Method Dependency
AWS::ACMPCA::Certificate
AWS::ACMPCA::Certificate Validity
AWS::ACMPCA::CertificateAuthority
AWS::ACMPCA::CertificateAuthority CrlConfiguration
AWS::ACMPCA::CertificateAuthority RevocationConfiguration
AWS::ACMPCA::CertificateAuthority Subject
AWS::ACMPCA::CertificateAuthorityActivation
AWS::AccessAnalyzer::Analyzer
AWS::AccessAnalyzer::Analyzer ArchiveRule
# remove previous installed package
sudo apt-get remove --purge ansible
# install pip
wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py --user
# install ansible
pip install ansible==2.5.0 --user
# update PATH
@rubendob
rubendob / fluentd_tcp_localhost_to_debug
Last active April 12, 2018 10:01
Local Fluentd to debug purposes - Ubuntu Xenial 16.04 TLS / fluent-plugin-kv-parser
sudo curl -L https://toolbelt.treasuredata.com/sh/install-ubuntu-xenial-td-agent2.sh | sh config
sudo /usr/sbin/td-agent-gem install fluent-plugin-kv-parser
(edit config file, do backup first)
sudo cp /etc/td-agent/td-agent.conf /etc/td-agent/td-agent.conf.backup
echo "
<source>
@type tcp
tag kv_log # required
@rubendob
rubendob / nginx.onf
Created September 30, 2012 18:22
Nginx
user nginx;
worker_processes 2;
worker_rlimit_nofile 32768;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 4096;
multi_accept on;
@rubendob
rubendob / gist:15fcfd8cd0ed1c47fbfc
Created February 23, 2016 08:53
mongo db backup script
#!/bin/sh
# MongoDB backup script
# This script is licensed under GNU GPL version 2.0 or above
# It makes a folder under BACKUP folder and compress it into .tar.gz.file
# Using another script we will remove older backups later
# ---------------------------------------------------------------------
### System Setup ###
BACKUP=""
@rubendob
rubendob / httpd.conf - Plesk 10.X
Last active December 24, 2015 09:09
Httpd.conf Plesk 10.X
ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 60
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
@rubendob
rubendob / httpd.conf
Last active December 10, 2015 20:59
Httpd.conf sin los módulos innecesarios
ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 60
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 60
<IfModule prefork.c>
StartServers 16
MinSpareServers 10