Skip to content

Instantly share code, notes, and snippets.

View jeffmccune's full-sized avatar

Jeff McCune jeffmccune

View GitHub Profile
@jeffmccune
jeffmccune / setup_server
Created September 20, 2020 17:43
Setup Server
#! /bin/bash
#
# Initial setup of a server. Run this as root.
apt -qq -y install curl git sudo rsync
set -eu
install -o0 -g0 -m0700 -d /root/.ssh
tmpfile="$(mktemp)"
@jeffmccune
jeffmccune / avoid_ remove_old_addr.sh
Last active September 16, 2020 18:38
Work around dhclient -x breaking policy routing when google-guest-agent starts
#!/bin/bash
#
# See https://github.com/GoogleCloudPlatform/guest-agent/issues/76
tmpfile="$(mktemp)"
cat <<"EOF" >"$tmpfile"
logmessage "Skipping ip -4 addr del ${old_ip_address:-}/${old_prefix:-} dev ${interface:-} to work around https://github.com/GoogleCloudPlatform/guest-agent/issues/76"
exit_with_hooks 0
EOF
install -o 0 -g 0 -m 0755 "$tmpfile" /etc/dhcp/dhclient-down-hooks
rm -f "$tmpfile"
@jeffmccune
jeffmccune / stub_ip.sh
Created September 16, 2020 16:32
Stub IP to troubleshoot dhclient
#! /bin/bash
if ! [[ -f /jeff/ip ]]; then
mkdir /jeff
mv /sbin/ip /jeff/ip
fi
cat <<"EOF" > /sbin/ip
#! /bin/bash
#
read -a st < /proc/$$/stat
read -a ppid < /proc/${st[3]}/stat
@jeffmccune
jeffmccune / google_netblocks.sh
Last active July 30, 2021 08:28 — forked from n0531m/list_gcp_iprange.sh
Google Cloud Platform : ip address range
#! /bin/bash
#
# Return the subnets used by Google Services
#
# There are a growing number of netblocks, 2,3,4,5,6,7, etc...
# Dig them all until an empty string is returned.
txt="$(dig TXT _netblocks.google.com +short @8.8.8.8)"
idx=2
while [[ -n "${txt}" ]]; do
echo "$txt" | tr '[:space:]+' "\n" | grep : | cut -d: -f2-
$ bundle install --path .bundle/gems/
Fetching https://github.com/rodjek/rspec-puppet.git
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies.........
Installing rake 11.2.2
Installing CFPropertyList 2.2.8
Installing addressable 2.4.0
Installing ansi 1.5.0
@jeffmccune
jeffmccune / ces-service.wsdl
Last active July 26, 2016 23:12
MS CES WSDL
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
name="SecurityTokenService" targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:i0="http://schemas.microsoft.com/windows/pki/2009/01/enrollment"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
@jeffmccune
jeffmccune / genconfig.md
Last active August 29, 2015 14:16
PUP-4073

Using apply, we get user runmode:

$ puppet apply --vardir /tmp --genconfig
# The configuration file for user.  Note that this file
# is likely to have unused settings in it; any setting that's
# valid anywhere in Puppet can be in any config file, even if it's not used.
# 
# Every section can specify three special parameters: owner, group, and mode.
@jeffmccune
jeffmccune / keybase.md
Created March 2, 2015 19:29
keybase.md

Keybase proof

I hereby claim:

  • I am jeffmccune on github.
  • I am jeffmccune (https://keybase.io/jeffmccune) on keybase.
  • I have a public key whose fingerprint is 3C4D FC77 5D56 A49A 64CD BE7A A8D0 1865 9619 0B44

To claim this, I am signing this object:

@jeffmccune
jeffmccune / zshenv
Created June 4, 2014 23:28
/usr/libexec/path_helper is not
# F!@#!$ing Apple calling /usr/libexec/path_helper from the always executed
# /etc/zshenv which has the result of re-ordering the PATH in a way we can't
# control.
#
# See: https://github.com/sorin-ionescu/prezto/issues/381#issuecomment-12745303
# Approach:
# 1: Store our current path, which is messed up by apple.
# 2: Determine the Apple default path.
# 3: Subtract the default path from the screwed up path.
@jeffmccune
jeffmccune / keybase.md
Created April 8, 2014 17:21
keybase.md

Keybase proof

I hereby claim:

  • I am jeffmccune on github.
  • I am jeffmccune (https://keybase.io/jeffmccune) on keybase.
  • I have a public key whose fingerprint is 3C4D FC77 5D56 A49A 64CD BE7A A8D0 1865 9619 0B44

To claim this, I am signing this object: