This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
START=`date +%s` | |
while [ $(( $(date +%s) - 30 )) -lt $START ]; do | |
{ time nc -zw30 <host ip> <port>;} |& grep real | awk '{print $2}' | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
#Updates sudo file on ubuntu with NOPASSWD for all users. | |
- hosts: all | |
sudo: yes | |
tasks: | |
- name: Allow 'sudo' group to have passwordless sudo | |
lineinfile: | |
dest: /etc/sudoers | |
state: present | |
regexp: '^%sudo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
tasks: | |
- name: Installs homebrew if not already present | |
command: brew -v | |
register: brew_check | |
- name: install homebrew with curl | |
command: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
when: brew_check.stdout.find('command not found') > -1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To rotate file every 100kb, truncate the file and delete the older logs. | |
#This keeps only latest 100kb. | |
/var/logs/randomdump.log | |
{ | |
size 100k | |
copytruncate | |
rotate 0 | |
} | |
# Copytruncate avoids file delete and create new file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script installs node in ' $HOME/local/node ' directory wihtout sudo | |
# Store script's filename in $SELF_NAME | |
SELF_NAME=$(basename $0) | |
# Prints warning/error $MESSAGE in red foreground color (for [E]rror messages) | |
red_echo() { | |
echo -e "\e[1;31m[E] $SELF_NAME: $MESSAGE\e[0m" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: fluentd | |
namespace: kube-system | |
--- | |
apiVersion: rbac.authorization.k8s.io/v1beta1 | |
kind: ClusterRole | |
metadata: | |
name: fluentd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
access_key = "${var.aws_access_key}" | |
secret_key = "${var.aws_secret_key}" | |
region = "${var.aws_region}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Read more on https://acsrujan.net/launch-bastion-aws | |
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = "~> 3.0" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_security_group" "mydatabase_sg" { | |
name = "mydatabase_sg" | |
description = "Allows services to talk to mydatabase mysql" | |
vpc_id = "vpc-xxxx" | |
ingress { | |
from_port = 3306 | |
to_port = 3306 | |
protocol = "TCP" | |
self = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Scan for terminated nodes on AWS and remove from Chef | |
cleanupNodes() { | |
# get nodes that are terminated via aws-cli | |
terminated_nodes=$(aws ec2 describe-instances --region=us-east-1 --filters Name=instance-state-name,Values=terminated | grep "InstanceId" | awk -F ":" '{print $2}' | awk -F '"' '{print $2}') | |
for node in $terminated_nodes; | |
do |