Skip to content

Instantly share code, notes, and snippets.

View breiter's full-sized avatar
🖖

Brian Reiter breiter

🖖
View GitHub Profile
@breiter
breiter / bashrc_restore-title.sh
Created June 24, 2020 11:37
Restore terminal title when ssh exits
# Add to ~/.bashrc
#
# force reset of the current directory name in terminal title
# to reset it after SSH sessions end.
PROMPT_COMMAND='echo -ne "\033]0;$(basename ${PWD})\007"'
@breiter
breiter / zhsrc_restore-title.zsh
Created June 24, 2020 11:48
Restore terminal title after ssh exits
# Add to ~/.zshrc
function clear_term_title {
# removes the text that ssh puts into the terminal title
printf '\033]0;\007'
}
PROMPT="$(clear_term_title)%% "
@breiter
breiter / uninstall-mono.sh
Created June 26, 2020 13:51
Clean uninstall mono.framework installed by the .pkg installer
#!/bin/sh
sudo rm -rf /Library/Frameworks/Mono.framework
sudo pkgutil --forget com.xamarin.mono-MDK.pkg
sudo rm -rf /etc/paths.d/mono-commands
@breiter
breiter / uninstall-vsmac.sh
Last active August 4, 2020 12:34
Script to uninstall Visual Studio for Mac
#!/bin/sh
# Uninstall Visual Studio for Mac
echo "Uninstalling Visual Studio for Mac..."
sudo rm -rf "/Applications/Visual Studio.app"
rm -rf ~/Library/Caches/VisualStudio
rm -rf ~/Library/Preferences/VisualStudio
rm -rf ~/Library/Preferences/Visual\ Studio
rm -rf ~/Library/Logs/VisualStudio
@breiter
breiter / install-mono.sh
Last active August 4, 2020 13:48
Script to install/update mono for mac from canonical official pkg installer on download.mono-project.com
#!/bin/sh
current_userid=$(id -u)
if [ $current_userid -ne 0 ]; then
echo "$(basename "$0") requires superuser privileges to run" >&2
exit 1
fi
INSTALLED_VERSION=$(mono --version 2> /dev/null | grep -o -E 'version [0-9\.]+'| grep -o -E [0-9\.]+)
STABLE_VERSION=$(curl -s https://www.mono-project.com/download/stable/ | grep -o -E 'Stable \(.+\)' | grep -E -o '[0-9\.]+')
@breiter
breiter / install-aws-cli.sh
Last active October 28, 2020 07:04
install/update and uninstall aws cli from amazon official package
#!/bin/sh
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "/tmp/AWSCLIV2.pkg"
sudo installer -pkg /tmp/AWSCLIV2.pkg -target /
/usr/local/bin/aws --version
rm /tmp/AWSCLIV2.pkg
@breiter
breiter / ecs-deployment-policy.json
Created May 20, 2021 11:11
IAM policy for GitHub Action deployment to ECS
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "GetAuthorizationToken",
"Effect": "Allow",
"Action": [
"ecr:GetAuthorizationToken"
],
"Resource": "*"
@breiter
breiter / net6-reset.sh
Created January 13, 2022 17:34
reset macOS ipv6 stack
#!/bin/sh
#newline field separator
IFS='
'
adapters=$(networksetup -listallnetworkservices | grep -v '*')
echo "setv6off" >&2
for a in $adapters; do
@breiter
breiter / Install-Tarsnap.ps1
Last active January 29, 2022 18:41
Unattended installation of tarsnap on Windows
# directory where cygwin will be installed
$cygwinroot="C:\cygwin64"
# choose URL from https://cygwin.com/mirrors.html
$mirror="http://mirrors.kernel.org/sourceware/cygwin/"
# packages to be installed on top of the base. Comma-separated, no spaces
$packages="gcc-core,make,openssl,openssl-devel,zlib-devel,curl,bc"
# version of tarsnap to install
$tarsnapdist=(Invoke-WebRequest -uri https://www.tarsnap.com/download/ -UseBasicParsing).Content -split "`n" |
@breiter
breiter / dotnet-tool-update-all.sh
Created June 26, 2020 06:41
Update all installed dotnet global tools
#!/bin/sh
# list global tools installed
# select tool <PACKAGE_ID>
# execute `dotnet tool update --global <PACKAGE_ID>`
dotnet tool list --global | awk 'NR > 2 {print $1}' | xargs -L1 dotnet tool update --global