Skip to content

Instantly share code, notes, and snippets.

@tomfanning
tomfanning / clear-credential-manager.cmd
Last active April 26, 2024 12:07
Batch file to clear all credentials from Windows Credential Manager
@echo off
cmdkey.exe /list > "%TEMP%\List.txt"
findstr.exe Target "%TEMP%\List.txt" > "%TEMP%\tokensonly.txt"
FOR /F "tokens=1,2 delims= " %%G IN (%TEMP%\tokensonly.txt) DO cmdkey.exe /delete:%%H
del "%TEMP%\List.txt" /s /f /q
del "%TEMP%\tokensonly.txt" /s /f /q
echo All done
pause
@tomfanning
tomfanning / userdata.sh
Last active April 24, 2024 21:00
AWS EC2 userdata script to set root pw, allow pw logon, auto updates, and set selinux permissive.
#!/bin/bash -e
rootpw="mypassword"
cat /etc/ssh/sshd_config | sed "s/PasswordAuthentication no/PasswordAuthentication yes/" | sed "s/#PermitRootLogin yes/PermitRootLogin yes/" > /etc/ssh/sshd_config
echo "
MaxAuthTries 10" >> /etc/ssh/sshd_config
systemctl restart sshd
echo root:$rootpw | chpasswd
@tomfanning
tomfanning / callpass.cs
Last active March 25, 2024 20:13
APRS passcode generator in C#
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine(DoHash("mycall"));
}
static int DoHash(string call)
{
string upper = call.ToUpper();
@tomfanning
tomfanning / install-freepbx.sh
Last active February 19, 2024 11:50
FreePBX installation script for CentOS 7 / AWS - two short non-interactive parts
#!/bin/bash -e
# set up a swapfile
dd if=/dev/zero of=/1GB.swap bs=1024 count=1048576
mkswap /1GB.swap
chmod 0600 /1GB.swap
swapon /1GB.swap
echo "
/1GB.swap none swap sw 0 0" >> /etc/fstab
echo "
@tomfanning
tomfanning / install-dnc-hosting-bundle.ps1
Created November 18, 2018 13:14
Install .net core hosting bundle 2.1.5 on IIS
$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 / $GPRMC GPS NMEA sentence breakdown.txt
Last active March 4, 2023 03:00
$GPRMC GPS NMEA sentence breakdown
$GPRMC,170047.00,A,4121.23302,N,00201.31654,W,2.703, ,200417, , ,A*64
$GPRMC,hhmmss.ss,A,llll.ll, a,yyyyy.yy, a,x.x, x.x,ddmmyy,x.x,a,m*hh
| | | | | | | | | | | | \- 13 Checksum
| | | | | | | | | | | \--- 12 Mode indicator, (A=Autonomous, D=Differential, E=Estimated, N=Data not valid)
| | | | | | | | | | \----- 11 E or W of magnetic variation
| | | | | | | | | \--------- 10 Magnetic variation degrees (Easterly var. subtracts from true course)
| | | | | | | | \---------------- 9 UTC date of fix
| | | | | | | \-------------------- 8 Track made good in degrees True
| | | | | | \-------------------------- 7 Speed over ground in knots
| | | | | \---------------------------- 6
@tomfanning
tomfanning / iscsi-target.txt
Created November 15, 2017 15:12
Create an iSCSI target on ZFS on CentOS 7
zfs create -o volblocksize=32k -V 10G tslpool/iscsi1
zfs set sync=disabled tslpool/iscsi1
targetcli
block/ create name=block_backend dev=/dev/zvol/tslpool/iscsi1
cd /iscsi
create iqn.2017-11.com.mydomain.ad.zfstest:iscsidisk1
cd /iscsi/iqn.2017-11.com.mydomain.ad.zfstest:iscsidisk1/tpg1/acls
# create acl with the initiator (client) name here, not the one you just created
create iqn.1991-05.com.microsoft:dc1.ad.mydomain.com
cd iqn.1991-05.com.microsoft:dc1.ad.mydomain.com
@tomfanning
tomfanning / extract-pfx.sh
Created April 8, 2015 12:11
Shell script to extract certificate and key files suitable for nginx from a PFX file.
#!/bin/bash
set -e
if [ "$#" -ne 1 ]; then
echo "Usage: $0 filename.pfx" >&2
exit 1;
fi
if [ ! -e "$1" ]; then
echo "File not found: $1" >&2
Dell Poweredge 1855 1955 PSU AHF-2DC 2100W (12v 175A) Pinout.
Works on 220-240v only.
Is compatible with US home type split-phase 220VAC but be cautious as to the correct wiring of the plug.
All of the important pins are included.
Connect PS On (A5) and PS Kill (B3) to ground to power up.
A5 = PS On
B3 = PS Kill
@tomfanning
tomfanning / vm-superhub3.txt
Created January 5, 2018 22:25
Virgin Media Super Hub 3 router status research
Status page
curl 'http://192.168.100.1/snmpGet?oids=1.3.6.1.4.1.4115.1.3.4.1.5.9.0;1.3.6.1.4.1.4115.1.3.3.1.1.1.3.1.0;1.3.6.1.4.1.4491.2.1.14.1.5.4.0;1.3.6.1.4.1.4115.1.20.1.1.1.7.1.3.1;1.3.6.1.2.1.10.127.1.1.5.0;1.3.6.1.2.1.126.1.1.1.1.1.2;1.3.6.1.2.1.69.1.4.5.0;&_n=21943&_=1515184469506'
Item Status Comments
Acquired Downstream Channel(Hz) 547000000 Locked
Ranged Upstream Channel(Hz) 39400000 Locked
Provisioning State Online