Skip to content

Instantly share code, notes, and snippets.

View joshzcold's full-sized avatar

Joshua Cold joshzcold

  • SecurityMetrics
  • Orem, Utah
View GitHub Profile
@joshzcold
joshzcold / test.py
Created November 3, 2022 20:37
testinfra parse ansible inventory before running tests using ansible api.
#!/usr/bin/env python3
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import shutil
import subprocess
import ansible.constants as C
@joshzcold
joshzcold / ur.sh
Last active March 31, 2022 17:27
Way faster ansible-galaxy handling with some parallelization and parsing
#
# ./ur [ansible-galaxy dependency name] -> install the 1 dependency
# ./ur playbooks/play.yml -> parse and install dependencies found in playbook
# ./ur -> find all dependencies in ansible-requirements.yml and install them in parallel
#
#!/usr/bin/env bash
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
function ansible-update() {
@joshzcold
joshzcold / screen_record_with_rect.sh
Last active December 20, 2021 20:15
use ffcast to record either a gif or mp4 from rectangle selection using slop. set the stop/start execute of this script to a hotkey.
#!/usr/bin/env bash
# use ffcast to record either a gif or mp4 from rectangle selection using slop
# required: ffmpeg,ffcast,imagemagick,slop
# set the stop/start execute of this script to a hotkey.
function usage() {
echo "Usage : $(basename "$0") [options] [--]
Options:
-k|kill kill last running record
-r|record start recording
@joshzcold
joshzcold / recordSeleniumVideo.sh
Last active July 1, 2021 21:33
Run Selenium Testing and record browser along with testing log. This is geared towards TestNG and Gradle, but there is no reason you can't rip out the video section and use the testing tool of your choice.
#!/usr/bin/env bash
# set -x
# PS4='+${LINENO}: '
set -euo pipefail
IFS=$'\n\t'
method=""
class=""
package=""
directory=""
@joshzcold
joshzcold / generate.js
Created May 25, 2021 17:23
Javascript generate random appealing colors
/*
* Generate appealing random colors using HSV
* https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/
*/
// needed to keep colors random from each other
const golden_ratio_conjugate = 0.618033988749895
// using hsb create perdictable rgb values
function hsv_to_rgb(h, s, v){
h_i = parseInt(h*6)
let f = h*6 - h_i