Skip to content

Instantly share code, notes, and snippets.

View archjeb's full-sized avatar

Jeremy Georges archjeb

View GitHub Profile
@archjeb
archjeb / combinevob.py
Created June 21, 2016 16:11
Combine groups of VOB files (concatenate) in a specific path
#!/bin/python
#
# combinevob.py
#
# Purpose of script is to combine groups of VOB files from a DVD so a single concatenated file can be
# processed with tools such as Handbrake, etc.
#
# INPUTPATH variable is set to where the VOB files reside
# OUTPUTPATH is where the final concatenated files will be created
@archjeb
archjeb / getweather.py
Created June 21, 2016 16:22
Sample wunderground json request to pull current temperature
#!/usr/bin/env python
#
#Example wunderground json request to pull current temperature
#
import json
import urllib2
#Sign up to get an API Key
WKEY='YOUR KEY HERE'
@archjeb
archjeb / convertmac.py
Created July 6, 2016 18:39
Convert switch router MAC format to 2 octet style
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Convert MAC format from switch to typical 2 octet separated by :
# i.e. Convert 0010.dbff.4001 -> 00:10:db:ff:40:01
MAC='0010.dbff.4001'
MACCONVERTED=':'.join(MAC.replace('.','')[i:i+2] for i in range(0,12,2))
@archjeb
archjeb / parser.py
Created January 6, 2017 18:23
simple example of a parser for a config file to generate a key/value dictionary.
#!/usr/bin/env python
'''
Simple script to open a text file (think like a config file) and generate a key/value dictionary.
dictionary answer will have key/value pairs of the config file.
#Template example. Key Value Pair design
TYPE=ROUTER
HOSTNAME=DC1-ROUTER1
MANAGEIP=10.255.255.1/24
'''
@archjeb
archjeb / fixallesxi.py
Created May 9, 2017 21:20
Use pexpect to automatically run vmkfstool on vmdk files that need repair
#!/usr/bin/env python
#Idea here is to use vmkfstool to fix all the disk images when we have a crash
import getpass
import pexpect
import time
import re
DIRECTORY='/vmfs/volumes/datastore1/Images'
@archjeb
archjeb / create_veos_intfs.py
Last active October 10, 2018 14:49
Generate ESXi vSwitch and Port group mappings for vEOS-lab
#!/usr/bin/env python
#
#create_veos_intfs.py
"""
Python program for creating a variable number of interfaces on ESX / vCenter host
for vEOS-lab. The main reason for this is that building out a large lab topology can be time consuming
just to create the vswitch and port group mappings. This script saves significant time in not only creating these elements
but also configuring them with the correct settings so vEOS-lab works correctly.
This script requires pyvmomi.
"""
@archjeb
archjeb / addsomeconfig.py
Last active March 20, 2019 18:30
Script to add some EOS configuration from a text file to every Arista switch listed in a host list file
#!/usr/bin/env python
#
# addsomeconfig.py
#
# Script to add some configuration from a file to every switch listed in a hostlist file.
# J.Georges @ arista
#
# The idea of this script is if I have a long list of switches that I want
# to apply configuration to, I can use eAPI to add these configuration changes
# to each switch. On the command line, you need to specify a username,
@archjeb
archjeb / getSNMP.py
Created April 18, 2019 22:28
Scrap net-snmp.org for MIB files and then download these MIB files
#!/usr/bin/env python
#
# Simple script to grab all the MIB files from net-snmp
#
import re
import os
from BeautifulSoup import BeautifulSoup
import urllib2
@archjeb
archjeb / driveway-alarm.py
Created May 16, 2019 22:14
Simple script to send slack message when a relay output on GPIO pin on Raspberry pi is detected - interrupt driven
#!/usr/bin/env python
'''
Script / Daemon to watch my driveway and notify when there is a trigger from the Mighty Mule
Driveway Alarm
See my Blog post for details: https://archjeb.blogspot.com/2019/05/
'''
#Version 1.0 - 5/16/2019
@archjeb
archjeb / getcvpdevices.py
Created October 28, 2019 18:57
Simple script to demonstrate how to execute CloudVision (CVP) API
#!/usr/bin/env python
#Basic Script to authenticate to Arista Cloudvision (CVP) and list all device
#data.
import json
import requests
import urllib3