Skip to content

Instantly share code, notes, and snippets.

View gsmitheidw's full-sized avatar

Graham Smith gsmitheidw

View GitHub Profile
@gsmitheidw
gsmitheidw / chocolateyuninstall.ps1
Created November 22, 2016 15:06
packet tracer 7.0 chocolatey uninstall script
# contents of chocolateyuninstall.ps1
$app = "C:\Program Files\Cisco Packet Tracer 7.0\unins000.exe"
$arguments =" /SILENT"
start-process $app $arguments
@gsmitheidw
gsmitheidw / omsa-alert.ps1
Last active March 24, 2017 18:21
Setting OpenManage Alerts from powershell
<# This sends e-mails via smtp to a chosen address if an alert is triggered on a Dell Server system by OpenManage
# Pre-Requisites: Dell OpenManage installed, a mail server allowing smtp without authentication, omconfig on the system path
# or can be called by full path. Note: Dell omconfig alert action must be populated once per server with the list of commands
# at the end of this script
# Tested on 2008R2 and 2012R2
#>
param(
[string]$body
)
@gsmitheidw
gsmitheidw / gist:eee830f2ba6ae301449d90a1ef5b7f0b
Last active April 26, 2018 13:30
vmware cheatsheet of useful commands
# From shell change appliance default to bash (needed for winscp transfers to vcenter)
chsh -s /bin/bash
# and back again with:
chsh -s /bin/appliancesh root
# May be pre-requisite to set shell.set --enable True in appliance root also depending on current settings
#Install certs (example: for intercepting proxy authentication):
/usr/lib/vmware-vmafd/bin/dir-cli trustedcert publish --chain --cert /path/to/cert.cer
# Note cert must be base64 encoded on export not DER encoded!
# View installed certs with /usr/lib/vmware-vmafd/bin/dir-cli trustedcert publish --chain --cert
@gsmitheidw
gsmitheidw / params.ps1
Created February 22, 2019 18:10
params example powershell
param (
[Parameter(Mandatory=$true)]
[string]$url = $( Read-Host "URL>")
)
youtube-dl.exe -x --audio-format mp3 --audio-quality 192K $url
# Enable SNMP on ESXi 6.*
# Note: this is not secured SNMP3
#
esxcli system snmp set --communities Public
esxcli system snmp set --enable true
esxcli network firewall ruleset set --ruleset-id snmp --allowed-all false
esxcli network firewall ruleset allowedip add --ruleset-id snmp --ip-address 192.168.1.0/24
esxcli network firewall ruleset set --ruleset-id snmp --enabled true
@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)"

@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 / 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 / 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 / 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