Skip to content

Instantly share code, notes, and snippets.

View falcon78921's full-sized avatar

Jimmy McClune falcon78921

View GitHub Profile
@falcon78921
falcon78921 / reflectors.sh
Created December 28, 2021 19:59
Generate an inventory of randomness (Ansible)
#!/bin/bash
for i in {1..52};
do echo "[dev$i]" >> test
for j in {1..232};
do random=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13 ; echo ''); echo "$random-$j ansible_host=127.0.0.1" >> test;
done
done
@falcon78921
falcon78921 / analyzer.sh
Last active December 17, 2021 18:26
strace awx-dispatcher processes (Ansible Tower)
#!/bin/bash
dispatcherProcesses=$( ps aux | grep run_dispatcher | awk '{ print $2 }' )
for p in "${dispatcherProcesses[@]}"; do
strace -Tf -e verbose=all -v -p "$p" -s 4096 -o <OUTPUT_FILENAME> &
done
@falcon78921
falcon78921 / downloader.py
Last active December 8, 2021 18:14
Implementing multiprocessing and threading within Python 3
#!/usr/bin/env python3
import fetcher
import time
from multiprocessing import Pool
# Parallel processing (process-based)
workers = Pool()
# Test length of time
@falcon78921
falcon78921 / install_docker.sh
Created April 17, 2019 21:49
Docker Installation Wrapper Script (Ubuntu)
#!/bin/bash
# Install Docker Community Edition on Ubuntu
# Author: falcon78921
# Run dpkg --list (check to see if Docker is installed)
# Save output as an array
dockerPackages=( $(sudo dpkg --list | grep "docker" | awk '{print $2}' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g') )
@falcon78921
falcon78921 / ceph_maintenance.sh
Last active September 21, 2021 13:14
Putting Ceph in "maintenance mode"
#!/bin/bash
# Ceph Cluster Maintenance
# Author: James McClune <[email protected]>
# Run this on Ceph monitor node (doesn't matter which one)
maintenanceConfig=$1
if [ $maintenanceConfig = "start" ]; then
@falcon78921
falcon78921 / kubernetes.yaml
Created July 14, 2018 01:54
Kubernetes YAML Pod Config (Ubuntu, Nginx, MySQL)
apiVersion: v1
kind: Pod
metadata:
name: MyKubernetes
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
@falcon78921
falcon78921 / ceph_bench.sh
Created June 27, 2018 19:49
Benchmark Ceph using rados bench
#!/bin/bash
# Benchmarking Ceph
# falcon78921
# RBD Variables
rbdPool=$1
rbdWriteInterval=$2
rbdReadInterval=$3
@falcon78921
falcon78921 / topN.sh
Created April 26, 2018 15:54
A Simple topN Program in Bash
#!/bin/bash
# topN - A Simple topN Program in Bash
# falcon78921
# First, let's generate a somewhat large file that has random numbers on every line
# In order to really benchmark, the user can increase the for loop in order to generate more numbers.
# Right now, the for loop will run 50,000 times, which will generate 50,000 random numbers.
for i in {1..50000}; do od -vAn -N4 -tu4 < /dev/urandom; done > random.txt
@falcon78921
falcon78921 / time.vb
Last active April 26, 2018 15:55
Calculate the total amount of hours and minutes, seconds, days, and years based on inputted minute amounts by user
'Program Name: Time
'Programmer: falcon78921
'Date: 3/14/12
'Program Purpose: To calculate the total amount of hours and minutes, seconds, days, and years based on inputted minute amounts by user.
Public Class frmMain
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Variable and Constant Declaration