Skip to content

Instantly share code, notes, and snippets.

View bpq32.cfg
; this config file is validated to work with the linbpq binary with md5sum 9e065d6fa2092ed720e3ca1c73678415 on the Raspberry Pi 4
SIMPLE ; This set a whole load of paramters to reasonable defaults
LOCATOR=IO91lk ; Set to your Grid Square to send reports to the BPQ32 Node Map system
NODECALL=M0LTE-7
NODEALIAS=CALCOT
AUTOSAVE=1
MAPCOMMENT=Experimental on 144.950 (MAPCOMMENT)
OBSINIT=6
@tomfanning
tomfanning / install-dnc-hosting-bundle.ps1
Created November 18, 2018 13:14
Install .net core hosting bundle 2.1.5 on IIS
View install-dnc-hosting-bundle.ps1
$ProgressPreference='SilentlyContinue'
wget https://download.visualstudio.microsoft.com/download/pr/86df96bb-384c-4d7a-82ce-2e4c2c871189/045870c1ab4004219cb312039c5a64d5/dotnet-hosting-2.1.5-win.exe -outfile .\dnc-hosting.exe
start-process -wait .\dnc-hosting.exe -args "/install /quiet /norestart" -nonewwindow
iisreset
@tomfanning
tomfanning / gist:43d8f3bd8de43b4b4d14a9539aa4426d
Created October 26, 2018 09:55
AWS Elastic Beanstalk / .NET Core web app quick demo
View gist:43d8f3bd8de43b4b4d14a9539aa4426d
VS -> new solution -> .NET Core 2.1 web app (MVC)
untick HTTPS
restore packages
Run locally
Close
Right click
Publish
Choose folder-> publish
Publish immediately
Open publish folder
@tomfanning
tomfanning / install-service.sh
Created March 27, 2018 16:49
Installing a console app as a service in systemctl
View install-service.sh
echo "[Unit]
Description=My Service Name
[Service]
WorkingDirectory=$workingdir
ExecStart=$workingdir/binary-name
Restart=always
RestartSec=10 # Restart service after 10 seconds if it crashes
SyslogIdentifier=myservicename
User=root
Environment=\"ASPNETCORE_ENVIRONMENT=Production\"
View gist:28756860345027ee894f769f9f8f8e1c
# 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
View test-web.sh
#!/bin/bash
# called by influx-mon.sh which is called by cron every minute
curloutput=$(curl -A "influx-mon" -ss -L --connect-timeout 5 -w "\n%{http_code}" $1)
exitcode=$?
body=$(echo "$curloutput" | head -n -1)
httpcode=$(echo "$curloutput" | tail -n 1)
if [ $exitcode -ne 0 ]; then
View influx-mon.sh
#!/bin/bash -e
# called by cron every minute
function postToInflux(){
curl -ss -o /dev/null --connect-timeout 5 -X POST 'https://influxdb.trlsoftware.com/write?db=database&u=user&p=pass' --data-binary "web_up,site=$1 value=$2 $(date +%s%N)"
}
declare -A sites
declare -A check
@tomfanning
tomfanning / userdata.ps1
Created March 13, 2018 14:19
AWS EC2 userdata script to set Windows admin password
View userdata.ps1
<powershell>
$windows_admin_password="mypassword"
function log {
echo $args[0] | out-file -append c:\bootstrap-status.log
}
log "Setting Windows password"
$admin = [adsi]("WinNT://./administrator, user")
@tomfanning
tomfanning / devreset.ps1
Created February 2, 2018 15:26
Hyper-V stop-restore-start one-liner
View devreset.ps1
$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
tomfanning / update-vs2017-layout.cmd
Created January 10, 2018 15:17
Replace VS2017 layout in-place
View update-vs2017-layout.cmd
@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 *
popd