Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
mlabouardy / scale-policies.tf
Created November 3, 2018 17:02
Scale out/in jenkins workers on demand
// Scale out
resource "aws_cloudwatch_metric_alarm" "high-cpu-jenkins-slaves-alarm" {
alarm_name = "high-cpu-jenkins-slaves-alarm"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
period = "120"
statistic = "Average"
threshold = "80"
@fabiomontefuscolo
fabiomontefuscolo / wp-migration.markdown
Last active April 23, 2024 09:28
BedRock WordPress + Nginx w Cache + php-fpm

Instalação dos pacotes do Ubuntu

apt-get install pv nginx-extras                                   \
    php-fpm php-gd php-mbstring php-cli php-mysql php-zip php-xml \
    mariadb-server mariadb-client

Instalação do WP-CLI

@aj07mm
aj07mm / jenkins-docker
Last active March 27, 2019 23:01
jenkins-docker
- docker-compose.yml
jenkins:
build: .
restart: always
ports:
- "8080:8080"
- "5000:5000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@LanderlYoung
LanderlYoung / linux_smap_analyzer.py
Created December 20, 2017 04:08
Linux /proc/<pid>/smaps analyzer python script
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
'''
analyze /proc/<pid>/smaps
doc
http://liutaihua.github.io/2013/04/25/process-smaps-analysis.html
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 27, 2024 22:20
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@sysboss
sysboss / trust.sh
Created May 15, 2017 14:05
Ultimately trust a public key non-interactively mode
#!/bin/bash
# Provide key uid from `gpg --list-keys`
# Based on: https://blog.tersmitten.nl/how-to-ultimately-trust-a-public-key-non-interactively.html
KEY_NAME=""
echo "$( \
gpg --list-keys --fingerprint \
| grep "${KEY_NAME}" -B 1 | head -1 \
| tr -d '[:space:]' | awk 'BEGIN { FS = "=" } ; { print $2 }' \
@sysboss
sysboss / AWS_SpotTerminationNotifier.sh
Created May 8, 2017 16:37
Handling AWS Spot Instance Termination Notices
#!/bin/bash
# AWS Instance Termination Notice Handler
# Based on: https://blog.fugue.co/2015-01-06-spot-termination-notices.html
while true; do
# get meta-data HTTP headers
HEADER=$(curl -Is http://169.254.169.254/latest/meta-data/spot/termination-time)
# HTTP 404 - not marked for termination
if [ -z $(echo $HEADER | head -1 | grep 404 | cut -d \ -f 2) ]; then
@sysboss
sysboss / Docker_Images_Cleanup_ByTag.md
Created April 27, 2017 12:47
Clean old Docker Images
#!/bin/bash
#
# Keeps latest X tags of every Docker Image
KEEP_IMAGES_BACK=2
echo Retrieving local images available
# get all images
IMAGES=$(docker images | sort | awk '{print $1}' | uniq | grep -v "")
digraph architecture {
rankdir=LR;
// Storage - #303F9F (dark blue)
node[fillcolor="#303F9F" style="filled" fontcolor="white"];
database[label="DB"]; cache[label="Redis"];
// Client-side Apps - #FFEB3B (yellow)
node[fillcolor="#FFEB3B" style="filled" fontcolor="black"];
front_end[label="Front-end App"]; extension[label="Browser Extension"];