Skip to content

Instantly share code, notes, and snippets.

View joncutrer's full-sized avatar

JC joncutrer

View GitHub Profile
@joncutrer
joncutrer / gist:330de3648ed7e5db1d295a80600b246a
Created February 8, 2024 20:47
Windows Batch Script to reboot UniFi APs via SSH (using plink.exe)
REM ssh-reboot.bat
REM This script requires a copy of plink.exe from Putty placed in the same folder as the script or somewhere in the path.
set aplist=192.168.1.12,192.168.1.13,192.168.1.14
set user=<yoursshusername>
set pw=<yoursshpassword>
set cmd=reboot
set targetip=%1
echo %targetip%

Keybase proof

I hereby claim:

  • I am joncutrer on github.
  • I am joncutrer (https://keybase.io/joncutrer) on keybase.
  • I have a public key ASAyq0fWDygxijbWKGFbwRQi13dsDrO4aBQnFcLLLEVJGgo

To claim this, I am signing this object:

#!/bin/bash
# Install WordPress CLI
# Must be run as root for permission to write to /usr/local/bin
#
dl_url=https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
tmp_dir=$(mktemp -d -t wpcli-XXXXXXXXXX)
curl -o $tmp_dir/wp-cli.phar $dl_url
chmod +x $tmp_dir/wp-cli.phar
mv $tmp_dir/wp-cli.phar /usr/local/bin/wp
rm -rf $tmp_dir
import itertools
x = [1, 2, 3, 4, 5, 6]
# output all permutations of x
print(list(itertools.permutations(x, 2)))
@joncutrer
joncutrer / scapy-dhcp-listener.py
Last active July 4, 2023 19:55
This script listens for DHCP packets using scapy to learn when LAN hosts request IP addresses from DHCP Servers. Learn more about this script at https://jcutrer.com/python/scapy-dhcp-listener
#!/usr/bin/env python3
"""scapy-dhcp-listener.py
Listen for DHCP packets using scapy to learn when LAN
hosts request IP addresses from DHCP Servers.
Copyright (C) 2018 Jonathan Cutrer
License Dual MIT, 0BSD
@joncutrer
joncutrer / scapy-arp-listener.py
Last active July 21, 2020 00:08
This script listens for ARP request packets using scapy to learn the IP and Mac Address of LAN hosts. Learn more about this script at https://jcutrer.com/python/scapy-arp-listener
#!/usr/bin/env python3
"""scapy-arp-listener.py
Listen for arp packets using scapy to learn the IP and Mac Address of LAN hosts
Copyright (C) 2018 Jonathan Cutrer
License Dual MIT, 0BSD
"""
<?php
/**
* This is NOT WORKING CODE but is provided for reference. This is the portion of
* code that was used on mwcsvimport.pronique.com to take a csv dataset and template
* file and generate a mediawiki xml import file.
*
* mwcsvimport.pronique.com was shutdown on 12/15/2018 but this code
* is provided for inspection by anyone looking to recreate it's
* functionality.
*
@joncutrer
joncutrer / windows-service-check.py
Last active September 27, 2023 09:08
Python: Check if Windows Service is running|installed without pywin32
import psutil
#
# Python Script to Check if...
# Windows Service is found|installed,stopped|running without pywin32
# Found at https://stackoverflow.com/questions/33843024
# Update to work on python 3.x
#
def getService(name):
@joncutrer
joncutrer / guetzli-estimate.sh
Last active January 4, 2018 03:30
Estimate guetzli processing time and memory requirements for a given image file
#!/bin/sh
# Inspect a jpg|png image and provide an estimate of processing time and memory requirements
# to compress the image with guetzli
#
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-field/core-field.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-input/core-input.html">
<link rel="import" href="../core-icons/core-icons.html">