Skip to content

Instantly share code, notes, and snippets.

@adamhancock
adamhancock / ..Instructions
Created March 21, 2019 07:36 — forked from benmccallum/..Instructions
Hosting Nuxt on Azure App Service (iisnode) with custom Git based deployment (kudu)
0. Setup Azure git deployments.
1. Add .deployment in root.
2. Create directory "deployment" and put build-nuxt.cmd in there.
3. Add server.js in root. (Note: this will cause Azure to auto-generate you an IISNode web.config, woot!)
4. Change start task to `node server.js` or remove it and let Azure do the same automatically.
<#
Adam Hancock - Added VM's in job.
.SYNOPSIS
Gather Veeam Backup Job Details
.DESCRIPTION
This script will create a csv file that contains details about each Veeam backup job.
This is helpful when you want to ensure consistency when, for example multiple people are creating multiple jobs.
$data = ConvertFrom-StringData((racadm getniccfg | Select-String "IP Address" ) -join "`n")
return $data."IP Address"
# This is the cmdlet you'll need to edit with your own domain name or email address
if(Get-Module MSOnline){
write-host "Module already installed."
}else{
Install-Module -Force MSOnline
}
$ScriptBlock = {Get-AntiPhishPolicy | Set-AntiPhishPolicy -ExcludedDomains "feedback.smileback.io"}
## Adam Hancock
rm -f output.csv
echo "Domain, IP, MX IP, Nameservers" >> output.csv
while read d; do
p=`echo $d | sed -e 's/www.//g'`
website=`dig @8.8.8.8 +short $p | head -n1`
mx=`dig @8.8.8.8 +short mx $p | cut -d " " -f 2 | head -n1`
nameservers=`dig ns $p +short`
nameserver1=`echo $nameservers | head -n1`
mx1=`dig +short $p mx | sort -n | awk '{print $2; exit}' | dig +short -f - | head -n1`
# Adam Hancock
if(Get-Module MSOnline){
write-host "Module already installed."
}else{
Install-Module -Force MSOnline
}
if(!$Cred){
$Cred = Get-Credential
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$From = "EmailAddress@gmail.com"
$To = "SomeOtherAddress@whatever.com"
$Cc = "AThirdUser@somewhere.com"
$Subject = "Here's the Email Subject"
$Body = "This is what I want to say"
$SMTPServer = "smtp.gmail.com"
$SMTPPort = "587"
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl -Credential (Get-Credential) –DeliveryNotificationOption OnSuccess
@adamhancock
adamhancock / transmission_remove_finished.sh
Created January 19, 2020 08:12 — forked from pawelszydlo/transmission_remove_finished.sh
Script to clear finished torrents from transmission-daemon
#!/bin/bash
# port, username, password
SERVER="localhost:9091 --auth user:pass"
# use transmission-remote to get torrent list from transmission-remote list
TORRENTLIST=`transmission-remote $SERVER --list | sed -e '1d' -e '$d' | awk '{print $1}' | sed -e 's/[^0-9]*//g'`
# for each torrent in the list
for TORRENTID in $TORRENTLIST
@adamhancock
adamhancock / delete-evicted-pods-all-namespaces.sh
Created January 19, 2020 22:42 — forked from 15below-adamhancock/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod --namespace $1
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
@adamhancock
adamhancock / install-docker-kube.sh
Last active August 13, 2020 15:40 — forked from chadmcrowell/install-docker-kube.sh
Installing the Kubernetes Cluster - From CKA Course - Linux Academy
# Get the Docker gpg key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Add the Docker repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# Get the Kubernetes gpg key
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -