This file contains 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 python | |
import json | |
import yaml | |
def yaml_to_json(data): | |
yaml_data = yaml.safe_load(data) | |
json_data = json.dumps(yaml_data) | |
return json_data |
This file contains 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
[alias] | |
co = checkout | |
ci = commit -S | |
st = status -s | |
br = branch | |
sui = submodule update --init | |
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short | |
lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(b old yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' | |
branch-name = rev-parse --abbrev-ref HEAD | |
upstream-name = !git remote | egrep -o '(upstream|origin)' | tail -1 |
This file contains 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
# one-liner | |
if [ -z "$(git tag -l --sort=v:refname | tail -1)" ]; then git log --oneline --all; else git log --oneline $(git tag -l --sort=v:refname | tail -1)..$(git rev-parse --abbrev-ref HEAD); fi | awk '$2 ~ /:/' | sort -sk 2,2 | awk 'BEGIN {print "## Changelog"} NR == 1 {print "- " $0; type = gensub(/(\w+).*:/, "\\1", 1, $2)} NR > 1 && $2 !~ type {print ""} NR > 1 {print "- " $0; type = gensub(/(\w+).*:/, "\\1", 1, $2)}' | |
# nicely formatted | |
if [ -z "$(git tag -l --sort=v:refname | tail -1)" ] | |
then | |
git log --oneline --all | |
else | |
git log --oneline $(git tag -l --sort=v:refname | tail -1)..$(git rev-parse --abbrev-ref HEAD) | |
fi | awk '$2 ~ /:/' \ |
This file contains 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
[[ "$(echo "$(docker version -f '{{.Server.APIVersion}}')\n1.25" | sort -V | head -1)" == "1.25" ]] && (docker system df && docker system prune -a --volumes) || (docker rmi $(docker images --filter "dangling=true" -q --no-trunc) && docker volume rm $(docker volume ls -qf dangling=true) && docker rm $(docker ps -qa --no-trunc --filter "status=exited")) |
This file contains 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
#!/bin/bash | |
ssh_user=joey.espinosa | |
aws_region=us-west-1 | |
export target_group=$1 | |
# grab AWS info | |
target_arn=$(aws elbv2 describe-target-groups --region ${aws_region} --query "TargetGroups[?TargetGroupName==\`${target_group}\`].TargetGroupArn" --output text) | |
instance_ids=$(aws elbv2 describe-target-health --target-group-arn $target_arn --region ${aws_region} --query "TargetHealthDescriptions[*].Target.Id" --output text) | |
ip_addresses=( $(aws ec2 describe-instances --region ${aws_region} --instance-ids $instance_ids --query "Reservations[*].Instances[*].PrivateIpAddress" --output text ) ) |
This file contains 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
#!/bin/bash | |
echo -n "Time to alert: " && read TIME | |
echo -n "Alert message: " && read MESSAGE | |
#echo "zenity --info --text '${MESSAGE}'" | at $TIME | |
at $TIME <<EOF | |
export DISPLAY=:0.0 | |
zenity --info --text "${MESSAGE}" | |
EOF |
This file contains 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
{ | |
"window.titleBarStyle": "native", | |
"editor.fontFamily": "Dank Mono", | |
"editor.fontLigatures": true, | |
"workbench.startupEditor": "none", | |
"workbench.colorTheme": "Bluloco Dark Italic", | |
"editor.minimap.enabled": false, | |
"go.inferGopath": true, | |
"[yaml]": { | |
"editor.detectIndentation": false, |
This file contains 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
#!/bin/sh [0/68765] | |
# | |
# A hook script to check for conventional commit message format. | |
# only run if a config exists | |
if [ ! -f ./.conform.yaml ] | |
then | |
echo "No .conform.yaml file found. Ignoring conform." | |
exit 0 | |
fi |
This file contains 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
def chop(sliceable, columns): | |
"""Return multiple selected slices of an iterable, in desired order. | |
Args: | |
sliceable (list): the original list to chop up | |
columns (list): a list of integers (indices) or tuples (slices) | |
Returns: | |
(list) the final chopped up list | |
This file contains 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
import sys | |
import unittest | |
from StringIO import StringIO | |
EMPTY = 0 | |
BLACK = 1 | |
WHITE = 2 | |
class Board: | |
def __init__(self): |
NewerOlder