Skip to content

Instantly share code, notes, and snippets.

@mbeall
Last active September 23, 2016 21:11
Show Gist options
  • Save mbeall/fea59745386d4711c77f to your computer and use it in GitHub Desktop.
Save mbeall/fea59745386d4711c77f to your computer and use it in GitHub Desktop.
Custom functions
#!/bin/bash
#
# Make sure all git repos are using the latest csscomb rules
# Uses Flint's rules as master
#
for repo in $(cat /usr/local/repos.git)
do
cd $repo
echo $(basename $repo)
cp ~mbeall/Sites/mbeall/wp-content/plugins/flint/.csscomb.json .
done
#!/bin/bash
#
# Get the diff information for all repos
#
status=$(echo /tmp/git-diff_$(date +%Y_%m_%d_%H_%M_%S))
for repo in $(cat /usr/local/repos.git)
do
cd $repo
echo $(basename $repo) >> $status
git diff >> $status
echo >> $status
done
less $status
#!/usr/local/bin/bash
#
# Batch pull request for specific repository
#
# 1. Merge starverte:master into mbeall:master
# 2. Merge mbeall:master into starverte:dev
# 3. Merge starverte:dev into starverte:master
#
repo=$1
cd ~/Sites/mbeall.local/wp-content/themes/flint
hub pull-request -b mbeall/$repo:master -h starverte/$repo:master -m "Merge from master [ci skip]"
sleep 1
hub pull-request -b starverte/$repo:dev -h mbeall/$repo:master -m "Pull request [ci skip]"
sleep 1
hub pull-request -b starverte/$repo:master -h starverte/$repo:dev -m "$repo x.x.x"
#!/usr/local/bin/bash
#
# Batch pull request for all repositories
#
# 1. Merge starverte:master into mbeall:master
# 2. Merge mbeall:master into starverte:dev
# 3. Merge starverte:dev into starverte:master
#
for repo in $(cat ~/.local/git-repositories | grep mbeall)
do
cd $repo
echo $(basename $repo)
hub pull-request -b mbeall/$(basename $repo):master -h starverte/$(basename $repo):master -m "Merge from master [ci skip]"
echo
sleep 1
done
for repo in $(cat ~/.local/git-repositories | grep mbeall)
do
cd $repo
echo $(basename $repo)
hub pull-request -b starverte/$(basename $repo):dev -h mbeall/$(basename $repo):master -m "Pull request [ci skip]"
echo
sleep 1
done
for repo in $(cat ~/.local/git-repositories | grep starverte)
do
cd $repo
echo $(basename $repo)
hub pull-request -b starverte/$(basename $repo):master -h starverte/$(basename $repo):dev -m "$(basename $repo) x.x.x"
echo
sleep 1
done
#!/usr/local/bin/bash
#
# Get status of all repos
#
status=$(echo /tmp/git-status-$(date +%Y-%m-%d-%H-%M-%S))
for repo in $(cat ~/.local/git-repositories)
do
cd $repo
echo $(basename $repo) >> $status
git status >> $status
echo >> $status
done
less $status
#!/usr/local/bin/bash
#
# Make sure all git repos are in sync with GitHub
#
status=$(echo /tmp/git-sync-$(date +%Y-%m-%d-%H-%M-%S))
for repo in $(cat ~/.local/git-repositories)
do
cd $repo
echo $(basename $repo) >> $status
git pull >> $status
git push >> $status
echo >> $status
done
less $status
npmg-update
#!/usr/local/bin/bash
#
# Make sure all npm dependencies are up to date
#
status=$(echo /tmp/npm-outdated-$(date +%Y-%m-%d-%H-%M-%S))
for repo in $(cat ~/.local/npm-repositories | grep mbeall)
do
cd $repo
echo $(basename $repo) >> $status
npm outdated >> $status
echo >> $status
done
less $status
#!/bin/bash
#
# Reset Dock to factory defaults
#
defaults delete com.apple.dock
killall Dock
#!/bin/bash
#
# Reset Dock to factory defaults
#
defaults write com.apple.dock ResetLaunchPad -bool true
killall Dock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment