Scripting & Programming

Tools built to production habits: external config, vaulted secrets, graceful failure, and code someone else could run. github.com/grafman56

Fleet Reporting with Ansible

A playbook that reads a CSV device list a NOC tech can edit without knowing Ansible, builds a live host group from it, polls every device in parallel, and renders one timestamped CSV report through a Jinja2 template. The design choices are the enterprise part: aggregate on the device instead of pulling full dumps, one persistent SSH session per host, and unreachable devices get flagged in the report instead of failing the run.

# Turn a NOC-editable CSV into a live host group, then poll every # device in parallel. Fast boxes never wait on slow ones. - name: Build device group from external CSV hosts: localhost tasks: - community.general.read_csv: path: "{{ device_list }}" register: devices - ansible.builtin.add_host: name: "{{ item.hostname }}" groups: cmts ansible_host: "{{ item.address }}" ansible_network_os: "{{ item.platform | default('cisco.ios') }}" loop: "{{ devices.list }}" - name: Collect summary counts from the whole fleet hosts: cmts strategy: free # concurrent, non-blocking tasks: - cisco.ios.ios_command: commands: [show cable modem summary total] register: out ignore_unreachable: true # flag failures, never kill the run

View on GitHub →

Async SNMP Monitor with Prometheus Metrics

A Python exporter that polls network devices over SNMP with one asyncio coroutine per host and publishes Prometheus gauges. A slow or dead device degrades gracefully instead of stalling the poll loop, and the metrics endpoint plugs straight into an existing Prometheus and Grafana stack.

# Async SNMP poller exporting Prometheus metrics. # One coroutine per device; a slow host never blocks the rest. HOSTS = ["device-a.example.net", "device-b.example.net"] g_cpu = Gauge("device_cpu_percent", "CPU percent", ["host"]) async def poll_host(host): while True: try: cpu = await snmp_get(host, OIDS["cpu"]) g_cpu.labels(host).set(cpu) except Exception as e: log.warning("%s: %s", host, e) # degrade, don't die await asyncio.sleep(15) async def main(): await asyncio.gather(*[poll_host(h) for h in HOSTS]) if __name__ == "__main__": start_http_server(9100) # /metrics for Prometheus asyncio.run(main())

View on GitHub →

Network Automation with Ansible

Ansible tooling for Cisco networks: read-only interface polling, config pushes with vault-secured credentials and Jinja2 templates built for idempotency, and a Flask-based IPAM tool that uses Python as the brain and Ansible as the hands. The interface-compare playbook below is the simplest useful version of the idea: snapshot a counter, wait, snapshot again, and answer a yes-or-no question an engineer actually asks.

# Snapshot, wait, snapshot again, compare. No regex, no fragile parsing. - ios_command: commands: ["show interfaces gi0/1"] register: first - set_fact: initial: "{{ (first.stdout[0].split('packets input')[0].split() | last) | int }}" - pause: { seconds: 30 } - ios_command: commands: ["show interfaces gi0/1"] register: second - debug: msg: "Traffic increased: {{ future | int > initial | int }}"

Read: Automating a Legacy Cisco Switch →

Interface Compare on GitHub →

Legacy Switch Lab on GitHub →

Custom Stock Indicators

Pine Script trading indicators for TradingView: custom divergence detection, trend filters, and signal overlays built from years of chart study. The Pine-to-Python conversion work that grew out of these lives on GitHub.

Pine-to-Python on GitHub →

Python Based Trading Platform

A full S&P 500 screening and backtesting platform: 25 years of daily history in DuckDB with incremental ingestion, a Streamlit dashboard with chart explorer and event studies, an automated strategy finder with out-of-sample honesty checks, fine-resolution fill verification against real intraday bars, loss autopsy for losing trades, and benchmarking against buy-and-hold. The public release is on GitHub with the proprietary signal suite redacted; the data plumbing, indicators, backtester, and dashboard are all open.

Read the write-up →

Read: Building a Screener I Can Trust →

Public release on GitHub →

Junkyard Web Scraper

Scrapes a local junkyard’s inventory into structured CSV data: make, model, year, yard location, arrival date. Incremental saves make it possible to track how long cars stick around and which parts are worth pulling. A v2 that ranks parts by resale value is in design.

Read the write-up →

View on GitHub →

FFMPEG Audio Conversion Wrapper

Python wrappers around ffmpeg for audio conversion and frequency shaping: boost specific ranges to match a sound system’s needs, with codec-aware handling for formats that need ffmpeg’s experimental flags.

View on GitHub →

Fully Customizable PowerShell Installer

Have custom enterprise software and don’t want to deal with or pay for annoying Windows installers? A fully customizable, instantly updateable PowerShell-based installer: it can stand up any prerequisite Windows Server role, SQL, or web service, then install your software with the settings you need on top. All changes ship through a simple config file, which makes install and update day a checklist instead of an adventure.