Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Michael Schoen NWMichl

🏠
Working from home
View GitHub Profile
@NWMichl
NWMichl / check_website.py
Created Mar 13, 2022
Simple Website Checker: Compares the number of <keyword> mentions to a static value and notifies of changes by email
View check_website.py
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 Oct 31, 2021
Example how to create flow charts with diagrams.net and csv import
View diagrams.csv
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 Jun 29, 2021
Chatbot demo to return the Cisco ACI Health Score to a Slack workspace using FastAPI
View main.py
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 Jun 10, 2021
REST-Call to provision new device with Cisco ISE for TACACS access via Ansible
View ise.yml
# 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 Feb 15, 2021
Query the Cisco ACI APIC API using Python & requests
View apic_query.py
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 Jan 10, 2021
Grafana panel idea to visualize Telegraf inputs.ping metrics, a nice alternative to Smokeping.
View grafana_ping_panel.json
{
"aliasColors": {},
"dashLength": 10,
"datasource": "InfluxDB",
"fieldConfig": {
"defaults": {
"custom": {},
"links": []
},
"overrides": []
@NWMichl
NWMichl / syslog_nxos.yml
Last active Dec 14, 2020
A declarative Ansible playbook to manage Cisco NX-OS syslog server configuration
View syslog_nxos.yml
# 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