Skip to content

Instantly share code, notes, and snippets.

View yolabingo's full-sized avatar

Todd Jacobsen yolabingo

  • New Mexico, USA
View GitHub Profile
python -c 'import secrets,string; print("".join(secrets.choice(string.ascii_letters+string.digits) for i in range(34)))'
@yolabingo
yolabingo / dotcms-get-demo-site-starter-urls.sh
Last active February 2, 2024 23:16
Gets the CUSTOM_STARTER_URL for a specific version of dotCMS
#!/usr/bin/env bash
# https://gist.github.com/yolabingo/f11e81b2cbdb00fff9b1ae0ef8076263
# checks out dotcms/core GH repo, then prints the CUSTOM_STARTER_URL for demo site content
# for each tagged version release
# output formatted for docker-compose.yml
if ! which git > /dev/null
then
echo "'git' must be installed to run this script"
@yolabingo
yolabingo / acm_search_certs.py
Last active February 11, 2022 00:57
list and simple search of AWS Certificate Manager SSL certs using python and boto3
#!/usr/bin/env python3
"""
usage: acm_search_certs.py [-h] [--region REGION] [--san-names SAN_NAMES] [--identifiers IDENTIFIERS]
[--tags TAGS] [--issuers ISSUERS] [--cert-in-use {0,1}] [--json] [--and-filters]
Fetches ACM SSL certificates.
options:
-h, --help show this help message and exit
@yolabingo
yolabingo / docker-compose-logging.yml
Last active January 7, 2022 04:05
docker-compose log file max size
   logging:
     driver: "json-file"
     options:
         max-file: "20"
         max-size: "100m"
@yolabingo
yolabingo / pg_delete_tables
Created June 10, 2021 16:11
delete all tables from a posgres database
DO $$ DECLARE
r RECORD;
BEGIN
-- if the schema you operate on is not "current", you will want to
-- replace current_schema() in query with 'schematodeletetablesfrom'
-- *and* update the generate 'DROP...' accordingly.
FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE';
END LOOP;
END $$;

curl -k --user admin:PASS https://prod-es1:9200

/_cluster/health?pretty
/_cat/nodes?pretty
/_cluster/health?level=indices&pretty
/_cluster/health?level=shards&pretty

delete unassigned shards

General OpenSSL Commands

Generate a new private key and Certificate Signing Request

openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key

Generate a self-signed certificate (see How to Create and Install an Apache Self Signed Certificate for more info)

openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt

@yolabingo
yolabingo / install-docker-compose.sh
Last active March 11, 2021 00:12
install docker-compose on amazon linux arm64
sudo yum install -y python3-devel gcc docker
sudo useradd -m -G docker -s /bin/bash docker
sudo su - docker
python3 -m venv python3-env
source python3-env/bin/activate
# or export PATH=$HOME/python3-env/bin:$PATH and add to .bash_profile
# upgrade pip first else you may get rust errors while building docker-compose
pip install --upgrade pip
pip install docker-compose
@yolabingo
yolabingo / sdm-completion.bash
Last active November 4, 2022 20:49
strongDM bash completion of hostnames for "sdm ssh [hostname]"
#/usr/bin/env bash
# fetch server hostnames from `sdm status` to use as completions for `sdm ssh [hostname]`
# save the sdm status to a local file from a cron job to speed this up a lot:
# sdm status --filter 'TYPE:ssh*' | tail -n +2 | awk '{print $1}' | sort -u > /var/tmp/sdm-status
# h/t https://iridakos.com/programming/2018/03/01/bash-programmable-completion-tutorial
update_frequency=4h
compwords_file=/var/tmp/sdm-status
@yolabingo
yolabingo / main.py
Created February 20, 2021 17:11 — forked from stewartadam/main.py
Simple Python proxy server based on Flask and Requests with support for GET and POST requests.
"""
A simple proxy server, based on original by gear11:
https://gist.github.com/gear11/8006132
Modified from original to support both GET and POST, status code passthrough, header and form data passthrough.
Usage: http://hostname:port/p/(URL to be proxied, minus protocol)
For example: http://localhost:5000/p/www.google.com
"""
import re