Skip to content

Instantly share code, notes, and snippets.

View bjorg's full-sized avatar

Steve Bjorg bjorg

  • San Diego, CA
View GitHub Profile
@bjorg
bjorg / git-remote.sh
Created April 9, 2013 21:59
Script for showing all Git branches and what remote branch they are mapped to (if any).
#!/bin/sh
git for-each-ref --format='%(refname:short)' refs/heads/* | while read b
do if r=$(git config --get branch.$b.remote)
then
m=$(git config --get branch.$b.merge)
echo "$b -> $r/${m##*/}"
else
echo "$b -> MISSING REMOTE"
fi
done
@bjorg
bjorg / git-delete-merged.sh
Created April 9, 2013 22:02
Script to delete all local branches that have been merged into the local master branch. Useful to run after update local master and removing old branches that have already been merged. **IMPORTANT:** make sure to switch to 'master' before you run this command.
#!/bin/sh
git branch --merged master | grep -v "\*" | xargs -n 1 git branch -d
@bjorg
bjorg / git-delete-remote-merged.sh
Created April 9, 2013 22:03
Script to delete all *remote* branches that have been merged into the local master branch. Useful after updating the local master branch and removing the remote branches that have been merged into master.
#!/bin/sh
git remote prune origin
git branch -r --merged origin/master | awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' | xargs git push origin --delete
git remote prune origin
@bjorg
bjorg / JDoc
Last active August 29, 2015 14:08
Concept for a JDoc implementation that is fluent and well-typed.
// ----------
// Definition
// ----------
class JDoc {
//--- Types ---
class ArrayBuilder<TOuter> {
//--- Methods ---
@bjorg
bjorg / git-delete-orig.sh
Created December 16, 2014 22:22
Remove .orig files from a git repo.
#!/bin/sh
find . -name '*.orig' -type f | xargs /bin/rm -f
@bjorg
bjorg / gist:be3f29855e985e1aeadc
Last active August 29, 2015 14:22
MacBook Settings
# Delay deep sleep for 24hrs, which drains batteries more,
# but prevents system restarts when the computer is sleeping
# for more than 4 hours (the default value).
# NOTE: if the computer sleeps for 24+ hours, it will still cause a system restart.
sudo pmset -a standbydelay 86400
# Improve performance of VMware Fusion
# from http://kb.parallels.com/122767
sudo nvram boot-args="debug=0x10"
@bjorg
bjorg / gist:ee69162487285ec4b089f629ec96b5fd
Created May 9, 2017 17:03
Install Amazon.Lambda.Templates
dotnet new -i Amazon.Lambda.Templates::*
@bjorg
bjorg / download-cloudwatchlogs
Last active January 9, 2024 01:19
Download all CloudWatch logs
log_group_name="/aws/log-group-name"
log_stream_names=$(aws logs describe-log-streams \
--log-group-name "$log_group_name" \
--order-by LastEventTime \
--descending \
--max-items 50 \
--output text \
--query 'logStreams[*].logStreamName')
Array.prototype.forEach.call(document.getElementsByClassName('load-diff-button'), (el) => el.click())
@bjorg
bjorg / omnisharp.json
Created July 19, 2019 18:05
OmniSharp Settings for K&R formatting
{
"FormattingOptions": {
"NewLinesForBracesInTypes": false,
"NewLinesForBracesInAccessors": false,
"NewLinesForBracesInAnonymousMethods": false,
"NewLinesForBracesInAnonymousTypes": false,
"NewLinesForBracesInLambdaExpressionBody": false,
"NewLinesForBracesInObjectCollectionArrayInitializers": false,
"NewLinesForBracesInProperties": false,
"NewLinesForBracesInControlBlocks": false,