Skip to content

Instantly share code, notes, and snippets.

View bng44270's full-sized avatar

Andy Carlson bng44270

View GitHub Profile
@bng44270
bng44270 / snupdateset.ps1
Created November 24, 2022 00:08
Browse ServiceNow Update Set XML files
###################################
#
# Analyze ServiceNow Update Sets
#
# Usage:
#
# Get Information on Parent Update Set
#
# Get-SNUpdateSet -File /path/to/update_set.xml
#
@bng44270
bng44270 / datadef.py
Last active February 27, 2023 20:20
JSON file-based caching framework
####################################
# > class Person(DataCache):
# ... def __init__(self,file):
# ... # Auto-cache JSON every 10 seconds
# ... super().__init__(file,["first_name","last_name","age"],10)
#
# > person = Person('/home/user/person.json')
# > person.Insert({"first_name":'Andy'})
# > person.Insert({"first_name":'Jim'})
# > person.Update(2,{'last_name':'Carlson'})
@bng44270
bng44270 / uscbgeocoder.py
Created October 20, 2022 18:14
Perform Address-to-LatLng geocoding using US Census Bureau API
#################################################
#
# USCBGeocoder - perform Address-to-LatLng geocoding using
# US Census Bureau API
#
# Usage:
#
# gc = USCBGeocoder()
# gc.SetBenchmark(id=2020)
# gc.GetCoords('401 S 2nd St',zip='62701')
@bng44270
bng44270 / hpink.sh
Last active October 20, 2022 18:17
Display available capacity and model of ink cartridge (tested with OfficeJet 3830)
#!/bin/bash
################################################
#
# hpink.sh
#
# Display available capacity and model of ink cartridge
#
# Tested with HP OfficeJet 3830
#
@bng44270
bng44270 / iptcli.inc.sh
Last active March 2, 2023 14:02
Auto-complete iptables command line interface based on Bash
##############################################
#
# iptcli.rc - Bash resoruce file to facilitate iptables auto-complete interface
#
# Usage:
#
# 1. Create iptcli alias:
#
# alias iptcli="bash --rcfile /path/to/.iptcli.rc"
#
@bng44270
bng44270 / linksys_jnap.py
Last active November 28, 2022 22:35
Call JNAP API endpoints on Linksys Routers
########################################
# linksys_jnap.py
#
# Call JNAP API endpoints on Linksys Routers
#
# Tested with WRT3200ACM
#
# Available Actions:
#
# ## Name ## ## Action URL ##
@bng44270
bng44270 / radio-player.sh
Last active September 13, 2022 14:47
Terminal-based web radio player (requires ffplay)
#!/bin/bash
######################################################
#
# Terminal-based web radio player (requires ffplay)
#
# Usage:
#
# 1) Create M3U playlist file using the following syntax:
#
@bng44270
bng44270 / resample-pdf.sh
Created September 11, 2022 23:07
Resample resolution of images in PDF file (requires Ghostscript)
#!/bin/bash
#############################
#
# Resample image content in PDF
#
# Usage:
#
# resample_pdf.sh -i <input file> -r <resample_resolution> -o <output_file>
#
@bng44270
bng44270 / keycode.html
Created August 26, 2022 13:41
Get JavaScript keycodes including Shift, Control and Alt combos
<html>
<head>
<title>Key Code Tester</title>
</head>
<body>
This is an interactive way to view JavaScript keyup and keydown keyCodes including the shift, alt, and ctrl modifier codes.<br/><br/>
Key Codes:<br/>
<div style="margin-left:50px;height:200px;width:200px;overflow:auto;" id="codeview"></div>
<script type="text/javascript">
document.body.onload = function() {
@bng44270
bng44270 / kbutil.js
Last active August 26, 2022 13:13
Create Keyboard shortcut driven events
/*
KBUtil - Create Keyboard shortcut driven events
Usage:
var kb = new KBUtil();
kb.addKey(function() {
console.log("You pressed a");
},KBUtil.KEY_A);