Skip to content

Instantly share code, notes, and snippets.

View PeteLawrence's full-sized avatar

Pete Lawrence PeteLawrence

View GitHub Profile
# 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 November 23, 2017 09:32
Redirect a LetsEncrypt secured domain
#
# 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 14:15
Cleans up a vagrant box, ready for packaging
#!/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 August 29, 2015 14:08
A quick and dirty script for checking that the relevant DNS records have been created for an Outlook 365 domain
#!/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."
@PeteLawrence
PeteLawrence / urlchecker.sh
Created September 26, 2014 13:26
Simple URL checker
#!/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 July 4, 2014 10:57
Delete's all docker images and containers
#!/bin/bash
# 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 (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 June 10, 2024 15:36
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
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