Skip to content

Instantly share code, notes, and snippets.

View hypergig's full-sized avatar

Jordan Cohen hypergig

  • Digital Asset
  • New York, NY
View GitHub Profile
@hypergig
hypergig / 256-colors.sh
Last active September 27, 2020 19:10
Display all the terminal colors that can be seen over a white or black background
# taken from https://misc.flogisoft.com/bash/tip_colors_and_formatting#colors2
# with a blacklist of the hardest colors to see agaist a black or white background
blacklist=(0 1 7 9 11 {15..18} {154..161} {190..197} {226..235} {250..255})
#blacklist=()
colors=$(printf '%d\n' {0..255} ${blacklist[@]} | sort -n | uniq -u)
slot=0
for fgbg in 38 48 ; do # Foreground / Background
for color in $colors ; do # Colors
@hypergig
hypergig / dockerinv.py
Created February 9, 2018 15:50
ansible dynamic inventory script generates inventory based off of running docker containers
#!/usr/bin/env python
'''
This file is an ansible dynamic inventory script used to help resolve docker
containers for ansible.
It only considers running docker containers that have the label
'ansible_managed_container=true'. Other labels will become host groups. eg.
(docker-compose)
@hypergig
hypergig / envar2inv.py
Created November 8, 2017 16:16
ansible dynamic inventory from environment vars
#!/usr/bin/env python
'''
This file is an ansible dynamic inventory script used to help discover
inventory from environment variables
'''
import json
from os import environ
@hypergig
hypergig / color_echo.sh
Created November 6, 2017 16:42
color echo for bash
#!/usr/bin/env bash
# add colorized echos as functions
declare -A colors
colors=(
# black
[bla]='0;30'
# red
[r]='0;31'