Skip to content

Instantly share code, notes, and snippets.

View gsmitheidw's full-sized avatar

Graham Smith gsmitheidw

View GitHub Profile
@gsmitheidw
gsmitheidw / StorageDevices.md
Last active February 8, 2023 18:00
Storage Devices Explained

Storage Devices

Drive Type Form Factor Connections Key Type Socket Type
SATA HDDs 3.5-inch, 2.5-inch SATA3 ports N/A N/A
SATA SSDs 2.5-inch SATA3 ports N/A N/A
mSATA SSDs Mini-SATA mSATA ports B key B socket
M.2 SATA SSDs M.2 M.2 SATA ports B key B socket
M.2 NVMe SSDs M.2 M.2 NVMe ports M key M socket
M.2 SATA/NVMe SSDs M.2 M.2 SATA/NVMe ports B+M key B+M socket
@gsmitheidw
gsmitheidw / create-self-signed-cert.ps1
Last active August 4, 2021 11:23
Create Self Signed Cert in Powershell and add to trusted root cert store
<#
. Create Self Signed Cert and export for portability and import to trusted root certificate store
.
#>
$pwd = ConvertTo-SecureString -String (Read-Host -Prompt 'Enter Password' ) -Force -AsPlainText
$domain = Read-Host -Prompt 'Enter Domain (eg: contoso.com)'
$certpath = 'cert:\LocalMachine\My'
$CertDetails = @{
@gsmitheidw
gsmitheidw / msix and appattach.ps1
Last active June 9, 2021 16:15
Testing MSIX container build (& vhd prep for potential app attach)
<# This is a list of commands not a script, to be run line-by-line:
# -------------------------------------------------------------------
#>
# Create self signed cert:
New-SelfSignedCertificate -Type Custom -Subject "CN=TUD" -KeyUsage DigitalSignature -KeyAlgorithm RSA -KeyLength 2048 -CertStoreLocation "cert:\LocalMachine\My" -FriendlyName "wvd"
$password = ConvertTo-SecureString -String "tGWu9tzQy#l0hr" -Force -AsPlainText
# note the fingerprint value for the key created in this:
gci cert:\LocalMachine\My
# create a working directory somewhere
@gsmitheidw
gsmitheidw / setup-ansible-debian.sh
Last active June 3, 2021 15:50
setup-ansible-debian.sh
# Sets up Ansible and demonstrates some basic functionality
# Run as root, if using sudo amend script accordingly, edit hosts file before running
install-ansible () {
echo deb "http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys
apt update;apt install ansible
# basic test
ansible localhost -m ping --ask-pass
read -p "[ctrl] & [c] if this failed"
@gsmitheidw
gsmitheidw / prox.sh
Last active April 29, 2021 17:22
proxmox notes
#Remove a node from cluster:
systemctl stop pve-cluster corosync
pmxcfs -l
rm /etc/corosync/*
rm /etc/pve/corosync.conf
killall pmxcfs
systemctl start pve-cluster
# install guest agent for linux
@gsmitheidw
gsmitheidw / ADcommands.cmd
Created April 14, 2021 19:11
Active Directory Commands
Requires "Windows Server Backup from Roles" & Features
wbadmin start backup -backuptarget:\\ipaddress\share -systemstate -vsscopy
Boot DSRM on command line:
bcdedit /set safeboot dsrepair
shutdown /r /f /t 5
Exit DSRM:
bcdedit /deletevalue safeboot
@gsmitheidw
gsmitheidw / Combos.json
Last active October 7, 2020 16:11
json beeftext support combos
{
"combos": [
{
"creationDateTime": "2019-02-05T12:15:49.613",
"enabled": true,
"keyword": "//reg",
"modificationDateTime": "2020-10-07T10:37:08.869",
"name": "registration-or-fees",
"snippet": "Hi,\n\nAccording to our view of the campus database you are not currently registered as a student and I cannot access your full details in my view of the database in order to create your account.\nI would recommend you contact the Registrars/Part Time/Finance office and clarify if there is a delay, or if there is something outstanding that they require from you.\n\nAccording to our records there is an outstanding issue with your account such that the Finance/Registrars/Part Time Office has requested it to be put on hold. You will need to contact the Registrars/Part Time office to resolve this and they will then be in a position to remove the hold. Your login credentials will then become active again automatically. \n\nPart time student
@gsmitheidw
gsmitheidw / esxi-syslog-setup.txt
Last active June 12, 2020 14:59
Set ESXi remote syslog server
esxcli system syslog config set --loghost "tcp://<ipaddress-syslog-server>:514"
esxcli system syslog reload
esxcli network firewall ruleset set --ruleset-id=syslog --enabled=true
esxcli network firewall refresh
nc -z <ipaddress-syslog-server> 514
esxcli system syslog config get
@gsmitheidw
gsmitheidw / Reflashing-Cisco-Switch-Serial.md
Last active December 10, 2019 16:20
Unbricking a Cisco Switch

Reflashing Cisco Switch

(2960 or equivalent without USB etc) over serial

Kinda used to having modern equipment with USB etc, unbricking this was harder than expected and tftpd64 and equivalents weren't proving reliable for me. Hope this helps others.

Assumptions/Requirements:

@gsmitheidw
gsmitheidw / Readme.md
Created November 8, 2019 16:43
Getting started with Termux and termux-dialog

Put the output from a dialog box into a bash variable:

termux-dialog outputs data in json format so we need to parse that. One way is to use jq which needs to be installed: apt install jq -y

Then because we're going to pipe the output into jq we'll need to enclose everything in double quotes before assiging to a variable. This is is a good example:

myvariable="$(termux-dialog -t "Please enter some text" | jq '.text' -r)"