Skip to content

Instantly share code, notes, and snippets.

View npazo's full-sized avatar

Nick Pazoles npazo

  • Sports Reference LLC
  • Chicago-adjacent
View GitHub Profile
@npazo
npazo / sshinstance.sh
Created June 2, 2022 15:29
SSH into an EC2 Instance by Instance ID
# Likely needs some tweaks to the `ssh $ip` line to account for key, user, etc.
sshinstance() {
ip=`aws ec2 describe-instances \
--output text \
--instance-id $1 \
--query 'Reservations[*].Instances[*].{Instance:PrivateIpAddress}' \
| tr -d '\r' \
| tr -d '\n'`
ssh $ip
@npazo
npazo / bash_pr.sh
Created April 28, 2017 16:48
bash Function to Open Pull Request
pr() {
branch=`git rev-parse --abbrev-ref HEAD`
github_url=`git remote get-url origin | sed 's/....$//'`
open $github_url/compare/$branch?expand=1
}
@npazo
npazo / merged-branches.sh
Last active June 13, 2017 20:07 — forked from cramforce/merged-branches.sh
Find local git branches with a closed GitHub PR
#!/bin/bash
# Outputs commands to delete local branches that have an
# associated merged (really closed) PR.
# BIG CAVEAT: This will report branches that have a closed,
# but not merged PR for deletion.
# Your Github username and the name of the organization you are a part of
# If you are using forks, or aren't part of an org. then your GITHUB_ORG
@npazo
npazo / checkNotifications.sh
Created January 19, 2017 21:58
Get Count of Unread Notifications on macOS Sierra and set AnyBar
dir_loc=`getconf DARWIN_USER_DIR`/com.apple.notificationcenter/db
count=`sqlite3 $dir_loc/db 'select count(*) from presented_notifications'`
echo $count
if [ $count -ne 0 ]; then
/bin/echo -n "green" | nc -4u -w0 localhost 1739
else
/bin/echo -n "white" | nc -4u -w0 localhost 1739
fi