Skip to content

Instantly share code, notes, and snippets.

Conor Sheehan ConorSheehan1

Block or report user

Report or block ConorSheehan1

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ConorSheehan1 /
Last active Mar 21, 2019
grep within glob files
# bash, find import in every .py file recursively under the current dir
grep -rin --include="*.py" import
# find files bye name and follow symlinks
find -L ./ -name "*.sublime-snippet"
ConorSheehan1 /
Last active Mar 20, 2019
bash script to show git commits for a standup.
# show commits from all branches for current git user.
function my-commits-since() {
git log --all --author=$(git config --since=$@
# show commits from yesterday.
# if none were found, assume it's Monday and show commits from Friday.
function standup() {
if [ -z "$(my-commits-since yesterday)" ]; then
my-commits-since last.friday.midnight $@;

set -x shows all commands in bash as they are run. to stop showing commands, reload the shell e.g. exec $SHELL

set -x && echo "hi"
exec $SHELL

# # output (stdout)
# + echo hi
# hi


# start container, attach stdin, use psuedo tty, use host network
docker run -it --network=host ubuntu:16.04  

# Delete all containers
docker rm $(docker ps -aq)  
# Delete all images  
docker rmi $(docker images -q)  
ConorSheehan1 / .rubocop.yml
Last active Mar 11, 2019
My personal preference for ruby style
View .rubocop.yml
# add indent after access modifier e.g. private
EnforcedStyle: rails
# Use double quotes by default, common in large projects including rails
Enabled: true
EnforcedStyle: double_quotes
ConorSheehan1 /
Last active Mar 29, 2019
regular expressions for updating ruby syntax (tested using sublime-text-3 replace function)
ConorSheehan1 / pre-commit
Last active Apr 25, 2018
before commit, check if puppet files have valid syntax
View pre-commit
# this hook aborts commits which contain invalid puppet syntax
# get all files in commit, use awk to get file name only, use grep to get puppet files only
files=$(git diff --cached --name-status | awk '$1 != "D" { print $2 }' | grep "\.pp")
# if you are committing .pp files
if [[ "$files" ]]; then
ConorSheehan1 / commit-msg
Last active Apr 25, 2018
check commit message contains link to trello card
View commit-msg
#!/usr/bin/env bash
# this hook aborts commits which do not include a link to trello
if ! [[ "$START_LINE" =~ $PATTERN ]]; then
echo "Commit messages should include a link to the related trello card."
echo "To override this check add the --no-verify flag "
exit 1
You can’t perform that action at this time.