Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Reiter breiter

View GitHub Profile
@breiter
breiter / Invoke-BackupJob.ps1
Last active Dec 30, 2015
Script to back up a Windows EBS volume on EC2 to S3 by snapshot.
View Invoke-BackupJob.ps1
#backup a disk by snapshot to S3.
param
(
[string] $path, #directry to clean of old files
[int] $diskNumber,
[string] $ec2VolumeId, #volumn arn in ec2
[string] $description,
[int] $days = 2
);
@breiter
breiter / configure-pat.sh
Created Aug 25, 2014
Linux NAT instance script for EC2 invoked from rc.local.
View configure-pat.sh
#!/bin/bash
# Configure the instance to run as a Port Address Translator (PAT) to provide
# Internet connectivity to private instances.
function log { logger -t "vpc" -- $1; }
function die {
[ -n "$1" ] && log "$1"
log "Configuration of PAT failed!"
exit 1
@breiter
breiter / profile.ps1
Last active Oct 20, 2019
profile.ps1
View profile.ps1
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal( [Security.Principal.WindowsIdentity]::GetCurrent() )
$administrator = $currentPrincipal.IsInRole( [Security.Principal.WindowsBuiltInRole]::Administrator )
$progfilesx86 = $env:programfiles
$is64bitenv = $false;
#System.IntPtr is 64 bits on x64 and 32 bits on x86
$is64bitenv = [IntPtr]::size * 8 -eq 64;
$progfilesx86 = $env:programfiles
if( $is64bitenv )
@breiter
breiter / openvpn2.conf
Last active May 24, 2020
OpenVPN client launchd for OS X and MacPorts
View openvpn2.conf
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/opt/local/var/log/openvpn2/*.log 644 3 1000 * J
/opt/local/var/log/openvpn2/*/*.log 644 3 1000 * J
@breiter
breiter / org.macports.wireshark-chmodbpf.plist
Created Sep 5, 2014
launchd plist to allow wireshark to work without sudo for admin users on OS X
View org.macports.wireshark-chmodbpf.plist
<?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>Label</key>
<string>org.macports.wireshark-chmodbpf</string>
<key>Program</key>
<string>/bin/sh</string>
<key>ProgramArguments</key>
<array>
@breiter
breiter / clamav.conf
Last active Jun 6, 2020
launchd plists for ClamAV daemon control on OS X
View clamav.conf
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
/opt/local/var/log/clamav/*.log 644 3 1000 * J
@breiter
breiter / org.macports.vpnc.plist
Last active Oct 6, 2015
vpnc launchd and start/stop control scripts
View org.macports.vpnc.plist
<?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>org.macports.vpnc</string>
<key>ProgramArguments</key>
<array>
@breiter
breiter / .bash_profile
Last active Dec 10, 2019
OS X Bash profile
View .bash_profile
# MacPorts Installer addition on 2012-07-11_at_19:18:58: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# pip modules install path
export PATH=$PATH:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/
# node modules install path
export PATH=$PATH:~/node_modules/.bin
@breiter
breiter / dash-as-sh.sh
Last active Aug 29, 2015
Replace bash with dash for /bin/sh in OS X
View dash-as-sh.sh
#!/bin/sh
mv /bin/sh /bin/sh.0
#files rearranged slightly in Yosemite.
#mv /usr/share/man/man1/sh.1.gz /usr/share/man/man1/sh.1.gz.0
rm /usr/share/man/man1/sh.1
ln -s /opt/local/bin/dash /bin/sh
ln -s /opt/local/man/man1/dash.1.gz /usr/share/man/man1/sh.1.gz
@breiter
breiter / vpnc-start
Created Dec 3, 2014
vpnc-start script
View vpnc-start
#!/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`