Skip to content

Instantly share code, notes, and snippets.

View skwid138's full-sized avatar
🐅
Tiger Style

Hunter Rancourt skwid138

🐅
Tiger Style
View GitHub Profile
@skwid138
skwid138 / github_workflow_tail.sh
Last active December 2, 2024 23:36
This script monitors the a GitHub Actions Workflow for the current repository. Defualts to the latest workflow, allows for providing an optional voice notification upon completion, with customizable voice and message options.
#!/bin/bash
# Default values for optional arguments
VOICE=""
MESSAGE="workflow completed"
WORKFLOW_NAME=""
function show_help() {
echo "Usage: workflow_tail.sh [options]"
echo ""
@skwid138
skwid138 / git_rev_list.sh
Last active November 25, 2024 19:43
This script compares the number of commits between a base branch and a specified or current branch in a Git repository.
#!/bin/bash
# Default values
base_branch=""
compare_branch=""
# Help documentation
usage() {
echo "Usage: $0 [OPTIONS]"
echo ""
<?php
/**
* The table Printer class has no dependencies and generates an array of strings
* out of an array of objects or arrays and the child properties that should be printed given by an array of strings
*
* Should result in something like the following:
* +------+---------------+----------------+---------------+
* | id | name | col_name_three | col_name_four |
* +------+---------------+----------------+---------------+
@skwid138
skwid138 / gh_repo_search.sh
Last active August 17, 2024 21:52
Get a list of repositories a user made commits to during a given date range. Make sure the script is executable, update GH_USERNAME and GH_TOKEN. Use `--help` for argument info.
#!/bin/bash
# Get a list of repositories the defined user made commits to in the passed in date range
# Example: ./gh_repo_search.sh 2018-07-01 2018-08-01
# GitHub username and personal access token
GH_USERNAME="gh_username"
GH_TOKEN="***************************************"
# Take 2 passed in dates in yyyy-mm-dd format

Git Tips

Moved files or directories and git thinks they're deleted and new vs renamed.
The following will resolve most of this assuming the file contents themselves have not changed too much.
git add . -A

Add only previsouly staged or deleted files andd exclude unstaged (new) files
git add -u

Add only a portion of the changes in a file

Helpful Commands

List containers

(The below are using the recomended commands although docker ps <options> would be identicle for now)

  • All containers: docker container ls -a
  • Running containers: docker container ls (docker ps is the exact same, but is no longer the recomended command)
  • All stopped containers: docker container ls -f "status=exited"
  • IDs of running containers: docker container ls -q
  • IDs of all containers: docker container ls -aq
  • Recently created containers: docker container ls -l
@skwid138
skwid138 / github-add-team-to-repos.js
Last active September 12, 2022 16:42 — forked from davidrleonard/add-team-to-repos.js
Add a new team to all Github repos in an organization
/*
* Adds the specificed team to all the repos in a Github organization.
* This is a tedious process in the UI.
* You'll need a version of node greater than 9 to run this
*
* https://docs.github.com/en/rest/teams/teams#add-or-update-team-repository-permissions
*
* Instructions:
* 1. Copy this file somewhere locally on your computer, e.g. ~/addteamrepos.js
* 2. Fill in the uppercase variables below with the right values
#!/bin/bash
# Open Apps used when doing development
# Could also include "iTerm" if the script is set to run automatically
# As it is now it would likely be run from iTerm
declare -a apps=("JetBrains Toolbox"
"Viscosity"
"MySQLWorkbench"
"ClickUp"
@skwid138
skwid138 / pro_tips.md
Created October 21, 2019 14:26
Here are a few tips to make you awesome at Cacher.

Getting Started

Snippets are the most useful when you want to re-use a command or a specific code pattern. Here are a few we have in our library:

  • How to delete a git tag
  • Nginx configuration for staging server
  • Crash handler AWS Lambda function

Label everything

Disable darkmode for MySQL WorkBench

defaults write com.oracle.workbench.MySQLWorkbench NSRequiresAquaSystemAppearance -bool yes