Skip to content

Instantly share code, notes, and snippets.

View yolabingo's full-sized avatar

Todd Jacobsen yolabingo

  • New Mexico, USA
View GitHub Profile

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

@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 $$;
@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 / 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 / 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"
python -c 'import secrets,string; print("".join(secrets.choice(string.ascii_letters+string.digits) for i in range(34)))'
update_config:
delay: 3m
parallelism: 1
failure_action: rollback
@yolabingo
yolabingo / how-to-build-debian-kernel.md
Last active March 5, 2022 17:24
Build debian kernel from source

Want a cool new kernel feature but it won't show up in Debian for years?

make deb-pkg makes it easy to install a custom Linux kernel from source.

as root/sudo:

apt install build-essential libncurses5-dev gcc libssl-dev bc bison flex rsync libelf-dev
mkdir /usr/local/src/kernel
chown nonrootuser /usr/local/src/kernel
su - nonrootuser
@yolabingo
yolabingo / osx_limits.md
Created June 24, 2022 20:42
OS X increase max files procs Monterey 12.4

/Library/LaunchDaemons/limit.maxfiles.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
        "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
@yolabingo
yolabingo / urljoin.py
Created September 1, 2022 01:52
python - join url fragments
def urljoin(*args):
""" Joins given arguments into an url, removing extra slashes """
return "/".join(map(lambda x: x.rstrip('/') if x.startswith('//') else x.strip('/'), args))