Skip to content

Instantly share code, notes, and snippets.

View breiter's full-sized avatar
🖖

Brian Reiter breiter

🖖
View GitHub Profile
@breiter
breiter / vpnc-stop
Created December 3, 2014 10:56
vpnc-stop script
#!/bin/sh
if [ "$(id -u)" -ne 0 ]; then
SELF=`echo $0 | sed -ne 's|^.*/||p'`
echo "$SELF must be run as root." 1>&2
echo "try: sudo $SELF" 1>&2
exit 1
fi
PLIST=/Library/LaunchDaemons/com.wolfereiter.vpnc.plist
CONF=`grep \.conf $PLIST | sed 's/<[^>]*>//g' | tr -d " \t"`
GATEWAY=`grep gateway $CONF`
@breiter
breiter / vpnc.conf
Created December 3, 2014 10:58
/etc/newsyslog.d/vpnc.conf log cleanup configuration
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/var/log/vpnc/*.log 644 3 1000 * J
@breiter
breiter / com.wolfereiter.vpnc.plist
Created December 3, 2014 10:59
/Library/LaunchDaemons/com.wolfereiter.vpnc.plist launchd configuration
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>Label</key>
<string>com.wolfereiter.vpnc</string>
<key>ProgramArguments</key>
<array>
@breiter
breiter / rm-java-browser-plugin.sh
Created March 19, 2015 19:33
Remove Java browser plugin after installing JDK on OS X
#!/bin/sh
if [ "$(id -u)" -ne 0 ]; then
SELF=`echo $0 | sed -ne 's|^.*/||p'`
echo "$SELF must be run as root." 1>&2
echo "try: sudo $SELF" 1>&2
exit 1
fi
rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
@breiter
breiter / fix-google-drive-menubar-darkmode.sh
Created March 19, 2015 19:45
Reverse Google Drive app menu bar icons for OS X Yosemite Dark Mode
#!/bin/sh
if [ "$(id -u)" -ne 0 ]; then
SELF=`echo $0 | sed -ne 's|^.*/||p'`
echo "$SELF must be run as root." 1>&2
echo "try: sudo $SELF" 1>&2
exit 1
fi
# change to app resource directory
cd /Applications/Google\ Drive.app/Contents/Resources/
@breiter
breiter / otp
Last active November 29, 2018 20:29
Script to drive oathtool to create TOTP one-time passwords for amazon, github, google, evernote, msft, etc.
#!/bin/sh
scriptname=`basename $0`
if [ -z $1 ]; then
echo "Generate OATH TOTP Password"
echo ""
echo "Usage:"
echo " $scriptname google"
echo ""
echo "Configuration: $HOME/.otpkeys"
@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 / mon-put-metrics-mem.ps1
Last active July 9, 2019 09:50
Script to monitor EC2 windows memory stats in CloudWatch
<#
Copyright 2012-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@breiter
breiter / Markdown.mdimporter.patch
Last active October 30, 2023 10:24
Enable Spotlight indexing of Markdown in ~~El Capitan~~ Monterey without disabling SIP
--- /System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist 2022-02-26 09:05:07.000000000 +0200
+++ /Library/Spotlight/Markdown.mdimporter/Contents/Info.plist 2022-03-22 21:01:30.000000000 +0200
@@ -13,27 +13,20 @@
<string>MDImporter</string>
<key>LSItemContentTypes</key>
<array>
- <string>public.rtf</string>
- <string>public.html</string>
- <string>public.xml</string>
- <string>public.plain-text</string>
@breiter
breiter / brew-cask-upgrade
Last active March 15, 2016 14:09
Script to update installed Homebrew casks that are not tracked by brew udpate
#!/bin/sh
# brew upgrade often fails to update brew casks
# this script upgrades any brew casks where the cached version is older than the current version or cache has been deleted
# some casks, like Skype, have no versioning at all. This script always forces unversioned "latest" casks to re-install
# from the latest download.
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'