Skip to content

Instantly share code, notes, and snippets.

John MacDonald jmacego

Block or report user

Report or block jmacego

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am jmacego on github.
  • I am jmacego (https://keybase.io/jmacego) on keybase.
  • I have a public key ASAlzNsoMHLfzKe1yOCpPuBcl2bjtgP1cDVnei7I69HJUwo

To claim this, I am signing this object:

@jmacego
jmacego / huawei-dhcp-decode.py
Last active Jun 19, 2018
Huawei e397u-53 Connectivity
View huawei-dhcp-decode.py
#!/usr/bin/env python
from __future__ import print_function
from sys import argv
import socket
import struct
"""
Decode the DHCP string given by AT^DHCP? on Huawei USB Modem and
print out appropriate commands to add it statically.
Tested under Python 2.7, 3.5, and 3.6
No warranty of any kind.
@jmacego
jmacego / AS Prefix Search
Last active Mar 11, 2019
Query Level3s IRR for prefixes advertised by an AS MACRO, in blocks short enough to not break Kibana's URL
View AS Prefix Search
@jmacego
jmacego / name-interfaces.py
Last active Mar 1, 2019
Script to name / interact with interfaces when ports 1-24 are plugged into the top and ports 25-48 are plugged into the bottom of a switch
View name-interfaces.py
#!/bin/python
from __future__ import print_function # Python 2 compatibility fix
# Script to name ports for natural patching (1 to 1, 2 to 3..25 to 2).
i = 1 # Initialize to the starting number for your port .
# Set starting number, ending number, and increment setting an increment
# of 2 is most common.
for x in range(1, 48, 2):
i += 1 # this really could to at the end and not have the -1 in the
@jmacego
jmacego / do-vlsm.py
Last active Mar 19, 2019
Efficiently create a number of subnets out of a larger prefix
View do-vlsm.py
#!/bin/env/python
from __future__ import print_function
import ipaddress
def do_vlsm(sorted_vlans):
supernet = input("Supernet: ") or "192.168.224.0/20"
current_subnet = ipaddress.ip_network(supernet)
available_subnets = [current_subnet]
print("\nSubnet Lengths:")
for vlan in sorted_vlans:
@jmacego
jmacego / meraki-wider-comments-bookmarklet
Created Mar 14, 2019
Bookmarklet to widen the comment field on Meraki Switch ACLs and Firewall policies
View meraki-wider-comments-bookmarklet
javascript:(function(){var inputs = document.getElementsByTagName("input");for(var i = 0; i < inputs.length; i++) {if(inputs[i].name.match(/comment/) || inputs[i].className.match(/comment/) ) {inputs[i].size = 100;}}})();
@jmacego
jmacego / jekyllserve.sh
Last active Mar 14, 2019
Bash function to pull jekyll site and serve
View jekyllserve.sh
#!/bin/bash
# Profile function to add a convenient jekyllserve command and also a
# function to cd to the directory, do a git pull, open in sublime,
# serve the site and then open it in a web browser.
#
# Works on OSX with sublime CLI installed. YMMV for other platforms.
# You also probably want to rename things. Consider this a template.
#
# Also... I just have this in my ~/.profile so I type jmaclabs and it
# just works. Here's how that looks different:
You can’t perform that action at this time.