This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable, Iterable, Dict, List | |
from concurrent.futures import ThreadPoolExecutor | |
from tqdm import tqdm | |
def thread_progress( | |
worker: Callable, | |
items: Iterable, | |
threads: int = None, | |
result_handler: Callable = None, | |
worker_kwargs: Dict = None, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hostname "{{ hostname }}" | |
snmp-server contact "{{ snmp_contact }}" location "{{ snmp_location }}" | |
alias "bk" "backup startup-configuration to {{ tftp_server }} switch/{{ hostname }}.conf" | |
ip default-gateway {{ mgmt_gateway }} | |
dhcp-snooping | |
dhcp-snooping authorized-server {{ dhcp_server }} | |
dhcp-snooping vlan all | |
dhcp-snooping trust 49-52 | |
console idle-timeout 900 | |
console idle-timeout serial-usb 900 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
from datetime import date, timedelta | |
def cisco_mfg_date(serial): | |
"""Parses a Cisco serial number into an approximate manufacture date. | |
Modern Cisco serial numbers encode the device's year and week-of-year |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-CiscoManufactureDate { | |
<# | |
.SYNOPSIS | |
Parses a modern Cisco serial number into an approximate date of | |
manufacture. | |
.DESCRIPTION | |
Modern Cisco serial numbers encode both the year and the week of | |
manufacture. Get-CiscoManufactureDate returns a corresponding DateTime | |
object given a Cisco serial number, accurate to within about 7 days |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Show all dynamic MACs, excluding the uplink trunk port | |
# Don't includer any header ouptput, only actual entries | |
# e.g., show mac address-table dynamic | ex Gi0/24 | |
$ShMacAddrOutput = @" | |
1 0023.ae57.3df2 DYNAMIC Gi0/7 | |
1 0023.aeaf.77b2 DYNAMIC Gi0/6 | |
1 14b3.1f01.00e4 DYNAMIC Gi0/2 | |
1 28b2.bd8e.5459 DYNAMIC Gi0/3 | |
1 28f1.0e32.a204 DYNAMIC Gi0/1 | |
1 2c76.8ac4.f7e5 DYNAMIC Gi0/3 |