This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# This is a little test of the game theory problem posed in this scene: | |
# https://www.youtube.com/watch?v=CYyUuIXzGgI | |
import random | |
class Door: | |
GOAT = 1 | |
CAR = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .zhsrc | |
function signed { | |
expiry=$(ssh-keygen -L -f ~/.ssh/id_rsa-cert.pub | grep Valid | awk '{ print $5 }') | |
expiry_epoch=$(date -j -f "%Y-%m-%dT%H:%M:%S" "${expiry}" "+%s") | |
current_epoch=$(date "+%s") | |
if [ $current_epoch -gt $expiry_epoch ]; then | |
echo $fg[red] "SSH -" | |
return -1 | |
else | |
(( seconds_left = $expiry_epoch - $current_epoch )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env zsh | |
function saws() | |
{ | |
valid_profiles=($(~/.local/bin/parse_aws_config)) | |
if [ -z "$1" ]; then | |
# Maybe just echo what profile is _still_ active | |
echo "Current profile is: $AWS_PROFILE" | |
return 0 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import configparser | |
import os | |
aws_config_filepath = os.path.expanduser('~/.aws/config') | |
config = configparser.ConfigParser() | |
config.read(aws_config_filepath) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
### Parse AWS config | |
# Cluster roles by environment and alphabetize | |
# Print easily copy/pasta export statements for env selection | |
# Allow selection of internal or customer environments | |
### Example AWS config that works with this: | |
# [profile sso] |