Skip to content

Instantly share code, notes, and snippets.

View liamkeegan's full-sized avatar

Liam Keegan liamkeegan

View GitHub Profile
@liamkeegan
liamkeegan / gist:be9276ea0f43602b6723698256823e9f
Last active December 16, 2019 16:12
Nexus Licensing Table
Term Switch Essentials Advantage Premium
36 N9K-C9348GC-FXP $5,240.88 $7,886.16 $16,079.04
60 N9K-C9348GC-FXP $6,600.00 $9,900.00 $22,011.00
36 N9K-C93180YC-FX $15,771.96 $18,729.00 $38,187.00
60 N9K-C93180YC-FX $19,801.20 $23,761.20 $52,828.20
36 N9K-C9508 $30,823.92 $73,977.84 -
60 N9K-C9508 $41,752.80 $100,206.00 -
@liamkeegan
liamkeegan / list_of_dict.py
Created May 14, 2020 18:58
Python: Iterate through list of dictionaries
# Import the Python JSON library so we can work with JSON objects
import json
# Use a multi-line variable (designated with ''' at the start and end) to load the JSON object into a variable called vlan_blob
# You could also directly reference the file using the 'with' command
data_blob = '''{
"TABLE_vlanbrief":{
"ROW_vlanbrief":[
{
"vlanshowbr-vlanid":"1",
@liamkeegan
liamkeegan / list_and_dict_operations.py
Last active October 14, 2021 01:22
Python basic list/dict operations
# This blurb will find entries in a list of dictionaries that match a pattern
# This requires Python 3.6 or greater since I'm using f-strings to print the variable (WAY easier than .format())
# Import json library to work with the data_blob string (which is a JSON object)
import json
data_blob = '''{
"id": "0001",
"type": "donut",
"name": "Cake",
@liamkeegan
liamkeegan / conditional_render.j2
Last active May 15, 2020 21:31
j2 conditional rendering
{
"template": {
"A": {
"1": "Green",
"2": "Red",
"3": "Orange"
},
"B": {
"1": "Blue",
"2": "Taupe",
@liamkeegan
liamkeegan / item_gen_list_dict.py
Created May 31, 2020 19:43
Use item generator to find k/v pair in list of dictionaries
data =
{
"ValueText": [
{
"value": "Liam's Test Estimate",
"typeCode": "Estimate Name"
},
{
"value": "GJGJGJGJ",
"typeCode": "AccessKey"
@liamkeegan
liamkeegan / jc.txt
Created August 9, 2020 17:25
JumpCloud Windows PS
cd $env:temp | Invoke-Expression; Invoke-RestMethod -Method Get -URI https://raw.githubusercontent.com/TheJumpCloud/support/master/scripts/windows/InstallWindowsAgent.ps1 -OutFile InstallWindowsAgent.ps1 | Invoke-Expression; ./InstallWindowsAgent.ps1 -JumpCloudConnectKey "undefined"
@liamkeegan
liamkeegan / normalize.py
Created September 5, 2020 01:48
Normalize Interface Names
def split_interface(interface):
num_index = interface.index(next(x for x in interface if x.isdigit()))
str_part = interface[:num_index]
num_part = interface[num_index:]
return [str_part,num_part]
def normalize_interface_names(non_norm_int):
tmp = split_interface(non_norm_int)
interface_type = tmp[0]
port = tmp[1]
@liamkeegan
liamkeegan / pycdr.py
Created September 7, 2020 21:57
PyCDR - CUCM CDR Parser
#!/usr/bin/python3
import sys
import csv
import time
"""
PyCDR.py
Author: Steve Campbell, steven.d.campbell68@gmail.com, Github: https://github.com/sdcampbell/PyCDR
@liamkeegan
liamkeegan / trashrr_employees.csv
Created November 23, 2020 03:12
Trashrr Employee Roster
displayname firstname lastname username officephone mobilephone Title OU
A. Long Squirtz A. Long Squirtz asquirtz 4145551001 3810931303 Gender Studies Professor Executive
Abraham Von Cameltoe Abraham Von Cameltoe avoncam 4145551002 6517466052 Theatrical Wardrobe Attendant Employees
Allbutter Poundloaf Allbutter Poundloaf apoundlo 4145551003 7447930846 Orderly Employees
Anthony Panthony Anthony Panthony apanthon 4145551004 2675569213 Concrete Smoother Employees
Anyuk Nyuk Anyuk Nyuk anyuk 4145551005 7292727129 X-Ray Technician Employees
Arabian Nice Arabian Nice anice 4145551006 8041921427 Reel System Operator Employees
Aunt Tim Aunt Tim atim 4145551007 5978562770 Assistant Corporation Counsel Employees
Avocarter Phuks Avocarter Phuks aphuks 4145551008 2779684299 Railroad Car Repair Supervisor Employees
Beefy McWhatnow Beefy McWhatnow bmcwhatn 4145551009 4136900074 Pedicab Driver Employees
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// Choose either "stable" for receiving highly polished,
// or "canary" for less polished but more frequent updates
updateChannel: 'stable',