Skip to content

Instantly share code, notes, and snippets.

View twr14152's full-sized avatar

Todd Riemenschneider twr14152

  • Columbus, Ohio
View GitHub Profile
@twr14152
twr14152 / sample_playbook
Last active May 1, 2021 12:41
sample_playbook_example
- name: configure cisco routers
hosts: routers
connection: ansible.netcommon.network_cli
gather_facts: no
@twr14152
twr14152 / gross_pay_calc.py
Last active January 15, 2021 18:40
gross_pay_calc.py
#wage
name1_wage = <>
name2_wage = <>
name3_wage = <>
name4_wage = <>
#overtime wage
name1_ot = (name1_wage/2) + name1_wage
name2_ot = (name2_wage/2) + name2_wage
name3_ot = (name3_wage/2) + name3_wage
@twr14152
twr14152 / write_2_file.py
Created November 8, 2020 15:42
Writing to file
#Comparing write method to print method to writing to file.
def main():
fname = input("Enter filename: ")
dfname = input("Destination Filename: ")
infile = open(fname, "r")
with open(dfname, "a") as f:
data = infile.read()
infile.close()
@twr14152
twr14152 / print_2_file.py
Last active November 8, 2020 15:43
Write to file using print
#Trying to understand the benefit of this method of writing to a file...
def main():
fname = input("Enter filename: ")
dfname = input("Destination Filename: ")
infile = open(fname, "r")
outfile = open(dfname, "a")
data = infile.read()
print(data)
infile.close()
@twr14152
twr14152 / kw_count.py
Last active November 5, 2020 19:20
Python Keyword count
import keyword
def kw_count():
a = 0
for kw in keyword.kwlist:
a+=1
print(f"{a} ", kw)
kw_count()
@twr14152
twr14152 / ios_config_script_07292020.py
Created July 29, 2020 23:04
requested_ios_config_script_07292020
#!/usr/bin/python3
#(c) 2020 Todd Riemenschneider
#
#Enable Multiprocessing
from multiprocessing import Pool
#getpass will not display password
from getpass import getpass
#ConnectionHandler is the function used by netmiko to connect to devices
from netmiko import ConnectHandler
#Time tracker
@twr14152
twr14152 / pushupCounter.go
Created April 5, 2020 14:46
Pushup Counter workout routine
/*
Specify a number of pushups you want to do in a set.
Every 30 secs do another set - 1 rep. Repeat until you reach 0.
This program will calculate how many pushups you do in total
*/
package main
import (
"fmt"
@twr14152
twr14152 / findingDupIPs.py
Created February 15, 2020 21:12
Finding duplicate IPs in a souce list
#sample Source List
ip_address = ["10.0.0.1", "10.0.0.1", "10.0.0.2", "12.0.3.1", "10.9.0.1", "12.0.1.1", "10.0.0.2"]
ip_counts = {ip: ip_address.count(ip) for ip in set(ip_address)}
for ip, count in ip_counts.items():
if count > 1:
print(f"Dup IP:{ip} number of dup hosts {count}")
else:
continue
@twr14152
twr14152 / deepcopy notes
Created February 15, 2020 19:58
Using deepcopy with dictionary
In [64]: dict1 = copy.deepcopy(sample_dict)
In [65]: dict1
Out[65]: {'first': 1, 'second': 2, 'third': 3, 'a': 1, 'b': 2}
In [66]: sample_dict
Out[66]: {'first': 1, 'second': 2, 'third': 3, 'a': 1, 'b': 2}
In [68]: sample_dict.pop("first")
Out[68]: 1
@twr14152
twr14152 / lissajous.go
Created October 19, 2019 14:44
TGPL_examples
package main
import (
"image"
"image/color"
"image/gif"
"io"
"math"
"math/rand"
"os"