Skip to content

Instantly share code, notes, and snippets.

View liamkeegan's full-sized avatar

Liam Keegan liamkeegan

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 -