This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: configure cisco routers | |
hosts: routers | |
connection: ansible.netcommon.network_cli | |
gather_facts: no | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keyword | |
def kw_count(): | |
a = 0 | |
for kw in keyword.kwlist: | |
a+=1 | |
print(f"{a} ", kw) | |
kw_count() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"image" | |
"image/color" | |
"image/gif" | |
"io" | |
"math" | |
"math/rand" | |
"os" |
NewerOlder