Skip to content

Instantly share code, notes, and snippets.

Avatar

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 https://127.0.0.1:5665/v1/objects/services -d '{ "filter": "service.state !=0 && service.acknowledgement != 0" }'
@PeteLawrence
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
PeteLawrence / vagrant-cleanup.sh
Created May 4, 2016
Cleans up a vagrant box, ready for packaging
View vagrant-cleanup.sh
#!/bin/bash
# Based on https://scotch.io/tutorials/how-to-create-a-vagrant-base-box-from-an-existing-one
# 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
PeteLawrence / outlook-record-checker.sh
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
View outlook-record-checker.sh
#!/bin/bash
DOMAIN=$1
function checkRecords {
checkOutput "CNAME" "autodiscover.$1" "autodiscover.outlook.com"
checkOutput "TXT" "$1" "include:spf.protection.outlook.com"
checkOutput "SPF" "$1" "include:spf.protection.outlook.com"
checkOutput "SRV" "_sipfederationtls._tcp.$1" "100 1 5061 sipfed.online.lync.com."
View urlchecker.sh
#!/bin/bash
#
# Checks the status of a file full of urls
# Usage: ./urlchecker.sh urls.txt
#
echo "" > urlstatus.txt
while read url
do
@PeteLawrence
PeteLawrence / dockerdelete.sh
Created Jul 4, 2014
Delete's all docker images and containers
View dockerdelete.sh
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
View keybase.md

Keybase proof

I hereby claim:

  • I am petelawrence on github.
  • I am petelawrence (https://keybase.io/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
PeteLawrence / better-apt-mirrors
Last active Mar 6, 2018
The standard /etc/apt/sources.list file points to us.archive.ubuntu.com, 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://mirrors.ubuntu.com/mirrors.txt trusty main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-updates main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-backports main restricted universe multiverse
deb mirror://mirrors.ubuntu.com/mirrors.txt trusty-security main restricted universe multiverse
EOL