requirements:
PyYAML==3.13
deepdiff==3.3.0
jsonpickle==1.0
| #!/usr/bin/env python3 | |
| import argparse | |
| import difflib | |
| import sys | |
| from collections import defaultdict | |
| from typing import Dict, List | |
| import yaml |
| #!/bin/bash | |
| #fix ssh-agent when attaching to a tmux session | |
| fixssh() { | |
| eval $(tmux show-env \ | |
| |sed -n 's/^\(SSH_[^=]*\)=\(.*\)/export \1="\2"/p') | |
| } |
| function worktree_add() { | |
| ## Run this function in the top level directory of a git repo | |
| ## to create a worktree directory from a new or existing branch | |
| if [ -d ./.git ]; then | |
| git rev-parse --verify "$1" | |
| if [ $? -eq 0 ]; then | |
| echo "Creating a worktree ../$1 from existing branch $1" | |
| git worktree add "../$1" "$1" | |
| else | |
| echo "Creating a worktree ../$1 from a new branch $1" |
| #!/bin/bash | |
| #Vault password is 1 | |
| echo "Converting vault to yaml format:" | |
| ansible-vault decrypt --output - vault | python ./convert_vault.py > new-vault.yml | |
| echo "Decrypting a variable from the converted vault" | |
| ansible localhost -i localhost, -e @new-vault.yml -m debug -a 'var=secret' --ask-vault-pas |
| - hosts: localhost | |
| connection: local | |
| gather_facts: false | |
| vars: | |
| region: us-east-1 | |
| version: 1.0 | |
| repository: ansible-deploy-test | |
| server_type: todo | |
| subnet_id: subnet-f7e20b80 |
| #!/usr/bin/env python | |
| import argh, os, sys | |
| from docker import Client | |
| from os.path import dirname, basename | |
| def get_containers(cli): | |
| container_ids = [ c['Id'] for c in cli.containers() ] | |
| containers = [ cli.inspect_container(cid) for cid in container_ids ] |
| #!/usr/bin/env python | |
| # Reads fdupes(-r -1) output and create relative symbolic links for each duplicate | |
| # usage: fdupes -r1 . | ./lndupes.py | |
| import os | |
| from os.path import dirname, relpath, basename, join | |
| import sys | |
| lines = sys.stdin.readlines() |
| #!/bin/bash | |
| # just a quick-and-dirty solution to update the peers configuration of haproxy upon ASG changes | |
| # instance-id becomes the peer name ( need to use -L<instance_id> on the haproxy command line) | |
| # port 7777 is used for p2p communication | |
| # call this script on crontab and redirect the output to > /etc/haproxy/peers.cfg then include that file into your haproxy config | |
| instance_id=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
| region=$(curl http://169.254.169.254/latest/meta-data/placement/availability-zone/) | |
| region=${region:0:${#region}-1} |