Skip to content

Instantly share code, notes, and snippets.

tomfanning / install-dnc-hosting-bundle.ps1
Created November 18, 2018 13:14
Install .net core hosting bundle 2.1.5 on IIS
wget -outfile .\dnc-hosting.exe
start-process -wait .\dnc-hosting.exe -args "/install /quiet /norestart" -nonewwindow
tomfanning / gist:43d8f3bd8de43b4b4d14a9539aa4426d
Created October 26, 2018 09:55
AWS Elastic Beanstalk / .NET Core web app quick demo
VS -> new solution -> .NET Core 2.1 web app (MVC)
untick HTTPS
restore packages
Run locally
Right click
Choose folder-> publish
Publish immediately
Open publish folder
tomfanning /
Created March 27, 2018 16:49
Installing a console app as a service in systemctl
echo "[Unit]
Description=My Service Name
RestartSec=10 # Restart service after 10 seconds if it crashes
# set up a swapfile
dd if=/dev/zero of=/swap.file bs=1024 count=1048576
mkswap /swap.file
chmod 0600 /swap.file
swapon /swap.file
echo "
/swap.file none swap sw 0 0" >> /etc/fstab
echo "
vm.swappiness=10" >> /etc/sysctl.conf
# called by which is called by cron every minute
curloutput=$(curl -A "influx-mon" -ss -L --connect-timeout 5 -w "\n%{http_code}" $1)
body=$(echo "$curloutput" | head -n -1)
httpcode=$(echo "$curloutput" | tail -n 1)
if [ $exitcode -ne 0 ]; then
#!/bin/bash -e
# called by cron every minute
function postToInflux(){
curl -ss -o /dev/null --connect-timeout 5 -X POST '' --data-binary "web_up,site=$1 value=$2 $(date +%s%N)"
declare -A sites
declare -A check
tomfanning / userdata.ps1
Created March 13, 2018 14:19
AWS EC2 userdata script to set Windows admin password
function log {
echo $args[0] | out-file -append c:\bootstrap-status.log
log "Setting Windows password"
$admin = [adsi]("WinNT://./administrator, user")
tomfanning / devreset.ps1
Created February 2, 2018 15:26
Hyper-V stop-restore-start one-liner
$vmname="server2016eval"; $snapname='server2016eval - (02/02/2018 - 15:12:33)'; stop-vm $vmname; if ((get-vm $vmname).State -eq 'Running') {stop-vm -turnoff $vmname}; restore-vmsnapshot -name $snapname -confirm:$false -vmname $vmname; start-vm $vmname
tomfanning / update-vs2017-layout.cmd
Created January 10, 2018 15:17
Replace VS2017 layout in-place
@echo off
rem A vs2017 folder must exist within this UNC
pushd %targetunc%
md %UserProfile%\Desktop\vs2017
copy vs2017\vs_professional.exe %UserProfile%\Desktop\vs2017
start /wait %UserProfile%\Desktop\vs2017\vs_professional.exe --layout %UserProfile%\Desktop\vs2017 --quiet
del /q /s vs2017
rd /q /s vs2017
robocopy /move /e %UserProfile%\Desktop\vs2017 vs2017 *
tomfanning / vm-superhub3.txt
Created January 5, 2018 22:25
Virgin Media Super Hub 3 router status research
Status page
curl ';;;;;;;&_n=21943&_=1515184469506'
Item Status Comments
Acquired Downstream Channel(Hz) 547000000 Locked
Ranged Upstream Channel(Hz) 39400000 Locked
Provisioning State Online