Skip to content

Instantly share code, notes, and snippets.

View tmanternach's full-sized avatar

Trevor Manternach tmanternach

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tmanternach on github.
  • I am trvr (https://keybase.io/trvr) on keybase.
  • I have a public key whose fingerprint is 2455 488A B35E D481 8F3D 4636 A139 3538 368C F30A

To claim this, I am signing this object:

(*
Toggle GlobalProtect VPN with AppleScript
Tested using macOS Ventura 13.4.1 and GlobalProtect version 6.2.0-89
Written by Trevor Manternach, August 2023.
*)
tell application "System Events" to tell process "GlobalProtect"
click menu bar item 1 of menu bar 2
set statusText to name of static text 1 of window 1
if statusText is "Not Connected" then
@tmanternach
tmanternach / quick-connect-clipboard.applescript
Created August 9, 2021 13:16
Use Jump Desktop to Quick Connect to clipboard item
tell application "Dock"
activate
end tell
tell application "System Events"
tell process "Dock"
set frontmost to true
activate
tell list 1
perform action "AXShowMenu" of UI element "Jump Desktop"
delay 0.2
@tmanternach
tmanternach / index.html
Last active October 16, 2021 13:14
Drummer index.html template for HTTPS
<html>
<head>
<title>[%pagetitle%]</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
[%rssLink%]
[%facebookmetadata%]
[%twittermetadata%]
@tmanternach
tmanternach / nginx.conf
Created October 15, 2021 23:06
Old School blog served via https using nginx
# This server {} block is used to re-direct port 80/http traffic to port 443/https. Pretty common 301 re-direct.
server {
if ($host = static.trevormanternach.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name static.trevormanternach.com;
return 404; # managed by Certbot
}
@tmanternach
tmanternach / panos_dhcp.py
Last active November 5, 2023 03:30
This python script is used to quickly retrieve the DHCP leases from a Palo Alto firewall. It outputs them as a JSON object.
"""
This script retrieves DHCP leases information from a Palo Alto Networks firewall using its API.
It sends a request to the specified host with an API key to fetch DHCP lease information for a given network interface. The retrieved data is then parsed and printed in JSON format.
Usage:
- Make sure to set the necessary environment variables for 'HOST', 'KEY', and 'INTERFACE' using a .env file.
- Ensure the required libraries are installed, including 'os', 'requests', 'json', 'xmltodict', 'urllib3', and 'dotenv'.
Example: