Skip to content

Instantly share code, notes, and snippets.


Pete Lawrence PeteLawrence

View GitHub Profile
View gist:da19eaa0077cf5f184ce8a022cc0c6f7
# List all service problems that haven't been acknowledged
curl -k -H 'X-HTTP-Method-Override: GET' -u username:password -X POST -d '{ "filter": "service.state !=0 && service.acknowledgement != 0" }'
PeteLawrence / .htaccess
Created Nov 23, 2017
Redirect a LetsEncrypt secured domain
View .htaccess
# Redirects an entire domain to a new domain
# Includes an exception that allows LetsEncrypt to check for its validation file
RewriteEngine On
# Exception for the LetsEncrypt validation file
RewriteRule ^(.well-known) - [L]
PeteLawrence /
Created May 4, 2016
Cleans up a vagrant box, ready for packaging
# Based on
# Clear the apt-get cache
sudo apt-get clean
# Zero out the drive
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
PeteLawrence /
Last active Aug 29, 2015
A quick and dirty script for checking that the relevant DNS records have been created for an Outlook 365 domain
function checkRecords {
checkOutput "CNAME" "autodiscover.$1" ""
checkOutput "TXT" "$1" ""
checkOutput "SPF" "$1" ""
checkOutput "SRV" "_sipfederationtls._tcp.$1" "100 1 5061"
# Checks the status of a file full of urls
# Usage: ./ urls.txt
echo "" > urlstatus.txt
while read url
PeteLawrence /
Created Jul 4, 2014
Delete's all docker images and containers
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)

Keybase proof

I hereby claim:

  • I am petelawrence on github.
  • I am petelawrence ( on keybase.
  • I have a public key whose fingerprint is E5AA 7519 8DF5 AB37 419A 8150 9204 1D1C CB68 F176

To claim this, I am signing this object:

PeteLawrence / better-apt-mirrors
Last active Mar 6, 2018
The standard /etc/apt/sources.list file points to, which in my experience is pretty slow. This command will replace the contents of sources.list, and will tell apt-get to select a better mirror
View better-apt-mirrors
cat >/etc/apt/sources.list << EOL
deb mirror:// trusty main restricted universe multiverse
deb mirror:// trusty-updates main restricted universe multiverse
deb mirror:// trusty-backports main restricted universe multiverse
deb mirror:// trusty-security main restricted universe multiverse