Skip to content

Instantly share code, notes, and snippets.

@xalvarez
xalvarez / gh_clear_cache.sh
Last active August 29, 2023 12:37
Clear a GitHub repository's cache
#!/bin/bash -e
# Note: For actions-cache to work one must pass or set a GITHUB_TOKEN variable with a valid PAT.
function print_help {
echo "usage: $0 -r <user/repository_name> [-b <branch>]"
echo " -r Repository. The format must be: <user/repository_name>"
echo " -b Delete cache for specific branch only"
echo "e.g.: $0 -r xalvarez/github-team-dashboard -b main"
}
@xalvarez
xalvarez / kms_decrypt.fish
Created August 11, 2023 12:41
Decrypt text using an AWS KMS key
# Decrypt text using an AWS KMS key
function kms_decrypt
argparse 'm/message=' -- $argv
or return
if set --query _flag_message
echo $_flag_message | aws-encryption-cli --decrypt --wrapping-keys discovery=true --input - --output - --decode -S | jq
else
printf "Please provide a message using the flag -m"
@xalvarez
xalvarez / gh_delete_all_analysis.sh
Last active June 20, 2024 14:50
Remove all GitHub code scanning analysis results for a given repository and organization
#!/bin/bash -e
# Remove all GitHub code scanning analysis results for a given repository and organization.
#
# The script assumes that github-cli (https://github.com/cli/cli) is installed and that authentication has already been
# performed. You might still need to request additional permissions as follows:
#
# gh auth refresh -h github.com -s admin:repo_hook
# gh auth refresh -h github.com -s delete_repo
@xalvarez
xalvarez / time_between_times.sh
Last active November 23, 2020 07:54
Calculate time spent on an activity which starts and ends the same day
#!/bin/bash -e
# This script calculates time spent on an activity which starts and ends the same day.
APPLICATION_NAME=$0
printHelp() {
echo "usage: $APPLICATION_NAME <start_time> <end_time> [<break_in_minutes>]"
echo " start_time e.g. 8:00. Also valid: 08:00, 8"
echo " end_time e.g. 17:00. Also valid: 17"
@xalvarez
xalvarez / settings.json
Last active September 6, 2020 16:45
Visual Studio Code Settings
{
"editor.renderWhitespace": "all",
"editor.rulers": [100,120],
"editor.wordWrapColumn": 100,
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true
},
@xalvarez
xalvarez / get_prs.sh
Last active January 21, 2021 11:46
Retrieve the first 100 open pull requests of a team's first 100 GitHub repositories
#!/usr/bin/env bash
# Retrieve the first 100 open pull requests of a team's first 100 GitHub repositories.
# Requires:
# - git: https://git-scm.com/downloads
# - jq: https://stedolan.github.io/jq/download/
APPLICATION_NAME=$0
ORGANIZATION=$1
TEAM=$2
@xalvarez
xalvarez / get_repos.sh
Last active June 11, 2024 06:35
Clone and fork a team's first 100 GitHub repos. Then, add remotes for all potential forks.
#!/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
@xalvarez
xalvarez / config
Last active March 18, 2023 10:02
Terminator v.2.1.1 config
[global_config]
title_hide_sizetext = True
suppress_multiple_term_dialog = True
[keybindings]
zoom_in = <Primary>KP_Add
zoom_out = <Primary>KP_Subtract
new_tab = <Primary><Shift>t
go_next = ""
go_prev = ""
split_horiz = <Alt>h
@xalvarez
xalvarez / .gitconfig
Last active May 14, 2024 09:22
My global .gitconfig
[user]
name = <name>
email = <email>
signingkey = <key>
[color]
ui = auto
[fetch]
prune = true
[alias]
fa = fetch --all
@xalvarez
xalvarez / config
Last active October 23, 2018 12:22
Sample .ssh/config for GitHub
Host github.com
User git
HostName github.com
IdentityFile ~/.ssh/github