Skip to content

Instantly share code, notes, and snippets.

@TannerRayMartin
TannerRayMartin / IP to Binary 2
Created January 9, 2018 10:53
After programming for a year I re-wrote IP to Binary. making the same output with 1/3 of the lines.
class converter:
def __init__(self):
self.ip = input('Enter an IP Address: ')
self.binary = [128,64,32,16,8,4,2,1]
self.empty_list = []
def convert(self, number):
empty_string = ''
number = int(number)
for num in self.binary:
@TannerRayMartin
TannerRayMartin / serial_test1.py
Created December 28, 2017 11:47
Connecting to a Cisco switch via console cable through a serial port with a laptop using python (pySerial)
__author__ = 'Tanner Ray Martin'
#this is for python 3, for python 2: change input to raw_input
import serial
#serial is the main module used and needs to be installed
import time
'''
@TannerRayMartin
TannerRayMartin / subnet.py
Last active September 30, 2016 09:34
prints the network, first host, last host, and broadcast of a valid IP address
#this program is currently without comments- this is the first draft and will be simplified and added to.
#constructed by Tanner Martin- 9-30-16 - 4 hour completion time.
import random
import time
@TannerRayMartin
TannerRayMartin / IP to Binary
Last active January 9, 2018 10:51
IP to Binary Python 2.7
red = '\033[1;31;49m'
green = '\033[1;32;49m'
#Any '\033' is a color code that changes the color of the text that follows.
#the definition convert: converts a number (0-255) to a binary octet. any number above 255 will return as 255 in binary