# sudo add-apt-repository ppa:wireguard/wireguard
# sudo apt-get update
# sudo apt-get install wireguard
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
#!/usr/bin/python3 | |
import hcl2 | |
import sys, os | |
import re | |
import json | |
import ast | |
from typing import Any, Dict, List, Optional, TypeVar, Union |
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
# using such a setup requires `apt-get install lua-nginx-redis` under Ubuntu Trusty | |
# more info @ http://wiki.nginx.org/HttpLuaModule#access_by_lua | |
http { | |
lua_package_path "/etc/nginx/include.d/?.lua;;"; | |
lua_socket_pool_size 100; | |
lua_socket_connect_timeout 10ms; | |
lua_socket_read_timeout 10ms; | |
server { |
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
concurrent = 3 | |
check_interval = 0 | |
[session_server] | |
session_timeout = 1800 | |
[[runners]] | |
name = "awsbastian" | |
limit = 10 | |
url = "https://gitlab.zzzz/" |
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
kubectl get po --all-namespaces -o custom-columns=name:.metadata.name,status:.status.phase,image:'.spec.containers[0].image' | |
kubectl get po -o json --all-namespaces | jq '.items | group_by(.spec.nodeName) | map({"nodeName": .[0].spec.nodeName, "count": length}) | sort_by(.count)' |
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
^(?:[a-zA-Z0-9]{1,4})[\/\-:](?:[a-zA-Z0-9]{1,4})[\/\-:](?:[a-zA-Z0-9]{1,4})(?:[T\s:]?)(?:\d{1,2}[:\-]\d{1,2}[:\-]\d{1,4})?(?:(?:[.,])\d+)? | |
# https://regex101.com/r/fPDuZy/3 |
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
# NOTE | |
# | |
# | |
# Use sed on the instance up to replace the INSTANCE_ID and DNS_RESOLVER with the following commands | |
# | |
#################################################################################################### | |
# Fetch the private IP for resolving DNS dynamically in nginx | |
# We also need to escape the `.` from it for usage in later sed | |
# | |
# DNS_RESOLVER=`grep nameserver /etc/resolv.conf | cut -d " " -f2 | sed 's/\./\\./g'` |
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
#!/usr/local/bin/python | |
""" | |
Requires Boto3 and AWSCLI configured | |
- accepts argument of profile name that needs to be rotated | |
- updates config upon aws access key rotation | |
""" | |
import boto3 | |
import argparse |
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
## Meant to be scheudled on a cron/timer of 90 days (CIS Benchmark) | |
## The target keys need permissions to rotate themselves | |
import boto3 | |
from botocore.exceptions import ClientError | |
import os | |
from datetime import datetime | |
import shutil | |
from ConfigParser import SafeConfigParser |
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 | |
_previous_day=$(date -d "1 day ago" '+%Y-%m-%d') | |
_common_logs_dir=("/var/log/" "/usr/share/nginx/logs" "/usr/share/tomcat/logs") | |
for log_dir in ${_common_logs_dir[@]}; do | |
if [[ -d ${log_dir} ]]; then | |
find ${log_dir} -type f -regex ".*\.gz$" -delete | |
find ${log_dir} -type f -iname "*${_previous_day}*" -delete | |
fi |
NewerOlder