Skip to content

Instantly share code, notes, and snippets.

View austind's full-sized avatar

Austin de Coup-Crank austind

  • NVIDIA
  • Central Minnesota
  • 13:23 (UTC -05:00)
  • LinkedIn in/austindcc
View GitHub Profile
@austind
austind / thread_progress.py
Created August 10, 2022 15:47
Parallelize a task using threads and progress bar - Concurrent Futures ThreadPoolExecutor with TQDM
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,
@austind
austind / aruba_2930f.j2
Last active March 4, 2021 03:07
Aruba 2930F template
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
@austind
austind / cisco_mfg_date.py
Last active October 31, 2017 15:48
A PEP8-compliant module that parses a modern Cisco serial number into an approximate date of manufacture
#!/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
@austind
austind / Get-CiscoManufactureDate.ps1
Last active October 31, 2017 15:37
Parse a Cisco serial number into a DateTime object accurate to within seven days of manufacture
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
@austind
austind / Parse-CamTable.ps1
Created October 20, 2017 16:58
Parses CAM table output from a Cisco switch, adding IP address, hostname, and OUI vendor info from a Windows DHCP server (2012 R2+)
# 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