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 | |
# Git pager script for using diff-highlight | |
# Path to the diff-highlight script | |
DIFF_HIGHLIGHT="/usr/share/doc/git/contrib/diff-highlight/diff-highlight" | |
# Check if diff-highlight is available and executable | |
if [ -f "$DIFF_HIGHLIGHT" ]; then | |
# Use diff-highlight in the pipeline | |
perl "$DIFF_HIGHLIGHT" | less -r |
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 python3 | |
import boto3 | |
import urllib.parse | |
from concurrent.futures import ThreadPoolExecutor, as_completed | |
import os | |
import select | |
import sys | |
import termios | |
import tty | |
import argparse |
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 | |
set -e | |
# Check if sufficient arguments are provided | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 <github-repo> <package-name>" | |
exit 1 | |
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
#!/usr/bin/env python3 | |
import subprocess | |
import sys | |
import speech_recognition as sr | |
def get_audio_text(language=None): | |
language = language or "en-US" | |
recognizer = sr.Recognizer() | |
with sr.Microphone() as source: | |
print("Say something:") |
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 | |
PROFILE="$1" | |
if [ -z "$PROFILE" ]; then | |
PROFILE=$(aws-list-sso-profiles|fzf --preview "sed -n \"/\[profile \"{}\"/,/^\[/ { /^\[/!p; }\" ~/.aws/config | sed \"\$d\"") | |
if [ -z "$PROFILE" ]; then | |
echo No profile selected. Exiting. >&2 | |
return 1 | |
fi | |
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
#!/usr/bin/env bash | |
_sqs_send_completions() | |
{ | |
local cur=${COMP_WORDS[COMP_CWORD]} | |
# Don't consider colon (from url) as word break | |
_get_comp_words_by_ref -n : cur | |
COMPREPLY=( $( compgen -W "$(aws sqs list-queues --query 'QueueUrls' --output text)" -- $cur ) ) | |
__ltrim_colon_completions "$cur" | |
} |
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 | |
write_main_undo() { | |
echo git checkout $main_branch >> "$UNDO_FILE" | |
echo git reset --hard "${main_remote%%/*}" >> "$UNDO_FILE" | |
echo "Undo instructions written to $UNDO_FILE" | |
} | |
if [ -z "$1" ] | |
then |
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 bash | |
# Clone and fork a team's first 100 GitHub repos. Then, add remotes for all potential forks. | |
# | |
# Requires: | |
# - git: https://git-scm.com/downloads | |
# - github-cli: https://github.com/cli/cli | |
# - jq: https://stedolan.github.io/jq/download/ | |
# | |
# The first time you run this script or use gh for the first time in your system |
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 | |
set -e | |
if [ $# -lt 1 ]; then | |
echo "Executes a ansible role on localhost" > /dev/stderr | |
echo "Usage $(basename $0) ROLENAME [additional ansible-playbook options]" > /dev/stderr | |
echo "Example: $(basename $0) baztian.keepass -K -b" > /dev/stderr | |
exit 1 | |
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
#!/bin/sh | |
# Source: https://stackoverflow.com/a/28776166/1960601 | |
sourced=0 | |
if [ -n "$ZSH_VERSION" ]; then | |
case $ZSH_EVAL_CONTEXT in *:file) sourced=1;; esac | |
elif [ -n "$KSH_VERSION" ]; then | |
[ "$(cd -- "$(dirname -- "$0")" && pwd -P)/$(basename -- "$0")" != "$(cd -- "$(dirname -- "${.sh.file}")" && pwd -P)/$(basename -- "${.sh.file}")" ] && sourced=1 | |
elif [ -n "$BASH_VERSION" ]; then | |
(return 0 2>/dev/null) && sourced=1 |
NewerOlder