Skip to content

Instantly share code, notes, and snippets.

View NWMichl's full-sized avatar
🏠
Working from home

Michael Schoen NWMichl

🏠
Working from home
View GitHub Profile
@NWMichl
NWMichl / check_website.py
Created March 13, 2022 16:33
Simple Website Checker: Compares the number of <keyword> mentions to a static value and notifies of changes by email
import requests
import smtplib
from email.mime.text import MIMEText
# Website Checker: Compares the number of <keyword> mentions to a static value and notifies of changes by email
url = 'www.example.com'
header = {'User-Agent': 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:98.0) Gecko/20100101 Firefox/98.0'}
keyword = 'example'
@NWMichl
NWMichl / diagrams.csv
Created October 31, 2021 07:05
Example how to create flow charts with diagrams.net and csv import
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 7.
## diagrams.net via CSV example
## Menu: Arrange > Insert > Advanced > CSV
##
# label: %step%
# style: rounded=1;fillColor=%fill%;
# namespace: csvimport-
# connect: {"from":"refs", "to":"id", "invert":true, "style":"curved=0;endArrow=blockThin;endFill=1;"}
# padding: 15
# ignore: id,fill,refs
# layout: auto
@NWMichl
NWMichl / main.py
Last active June 29, 2021 18:58
Chatbot demo to return the Cisco ACI Health Score to a Slack workspace using FastAPI
from fastapi import FastAPI, Form
import requests, json
SLACK_VERIFICATION_TOKEN = "OnLmGpOwclDyXMNuNSRI5HAQ"
APIC_URL = 'sandboxapicdc.cisco.com'
APIC_USERNAME = 'admin'
APIC_PASSWORD = 'ciscopsdt'
def apic_login(apic: str, username: str, password: str) -> dict:
""" APIC login and return session cookie """
@NWMichl
NWMichl / ise.yml
Created June 10, 2021 05:50
REST-Call to provision new device with Cisco ISE for TACACS access via Ansible
# REST-Call to provision new device with Cisco ISE for TACACS access
#
# The 'NetworkDeviceGroupList' in the request body needs to be adapted to your environment, or substituted with variables.
---
- name: ISE
hosts: test_switch
gather_facts: false
connection: network_cli
vars:
@NWMichl
NWMichl / apic_query.py
Created February 15, 2021 09:15
Query the Cisco ACI APIC API using Python & requests
import requests, json
apic_url = 'sandboxapicdc.cisco.com'
apic_username = 'admin'
apic_password = 'ciscopsdt'
def apic_login(apic: str, username: str, password: str) -> dict:
""" APIC login and return session cookie """
apic_cookie = {}
credentials = {'aaaUser': {'attributes': {'name': apic_username, 'pwd': apic_password }}}
@NWMichl
NWMichl / grafana_ping_panel.json
Created January 10, 2021 22:43
Grafana panel idea to visualize Telegraf inputs.ping metrics, a nice alternative to Smokeping.
{
"aliasColors": {},
"dashLength": 10,
"datasource": "InfluxDB",
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
@NWMichl
NWMichl / syslog_nxos.yml
Last active December 14, 2020 08:20
A declarative Ansible playbook to manage Cisco NX-OS syslog server configuration
# Syslog configuration with Cisco NX-OS devices
#
# Usage: ansible-playbook -k -u <cli_user> syslog_nxos.yml
# Specify the syslog servers in the 'vars:' section of the playbook header.
---
- name: Ensure desired state - syslog server
hosts: all
gather_facts: false
connection: network_cli