Skip to content

Instantly share code, notes, and snippets.

View liamkeegan's full-sized avatar

Liam Keegan liamkeegan

View GitHub Profile
@liamkeegan
liamkeegan / aci_bulk_epg_rspathatt_jinja2.txt
Created May 10, 2023 02:50
ACI - Jinja Template for EPG
Jinja2 Live Website: https://j2live.ttl255.com/
---
{
"tenant": "Production",
"ap": "Prod_AP",
"epgs": [
{
"name": "10.75.1.0-24",
"mode": "regular",
@liamkeegan
liamkeegan / ad_create.ps1
Last active April 15, 2023 17:53
Create bulk AD accounts
$userdomain = "http://mydomain.com"
$organizationalunitpath = “ou=Politicians,ou=users,ou=company,dc=mydomain,dc=com”
$politicians = @(
("John","Adams"),
("Chester","Arthur"),
@liamkeegan
liamkeegan / yaml_anchor.yaml
Created November 9, 2021 03:09
YAML Anchor Example
- name: APIC - Fabric and tenant setup
hosts: all
gather_facts: no
vars:
aci_login: &aci_login
hostname: '{{ apic_host }}'
username: '{{ apic_username }}'
password: '{{ apic_password }}'
use_proxy: '{{ apic_use_proxy }}'
@liamkeegan
liamkeegan / list_of_lists.py
Last active October 13, 2021 02:58
List of Lists
# Create a list of lists called configs. Each element of configs is its own list.
configs = [
['rtr1','10.1.1.1','cisco','cisco'],
['rtr2','10.1.1.2','cisco','cisco'],
['rtr3','10.1.1.3','cisco','cisco']
]
# Iterate through the configs list. For each individual list, we then reference it as 'config'. Use an f-string notation to print it in the string.
for config in configs:
print(f'This hostname is {config[0]}, the IP address is {config[1]} and the passwords are {config[2]}/{config[3]}')
@liamkeegan
liamkeegan / nxos_arp_ip_lookup.py
Created September 13, 2021 21:42
NXOS ARP to IP Lookup
'''
Quick and dirty MAC address to IP address lookup tool. Creates CSV compliant data. A total hack done in 15 minutes, saving HOURS of work.
In the mac_table.txt, have a list of mac addresses from 'show mac address-table'. Remove the headers.
192.168.148.31 00:08:17 0050.56b9.dddd Vlan128
192.168.148.146 00:01:45 8c60.4f54.eeee Vlan128
192.168.144.32 00:17:08 0050.56b9.ffff Vlan134
192.168.144.21 00:00:41 0050.56bb.gggg Vlan104
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
// 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',
@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
@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 / 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]