Yearly Archive: 2020

Split() & Join()

Example of how to use split : ip_Addr = “10.10.10.1” ip_Addr.split(“.”) <— will create a list [“10”, “10”, “10”, “1”] octect = ip_Addr.spit(“.”) octect[0] 10 Example of how to use join : “.”.join(octect) print(octect) 10.10.10.1

List Slices

While opening a file as an example. while open(“ext.ext”, “r”) as f: ….output = f.readlines() ….len(output) ….print(output[0:5]) This would create a list and 1 element per lines The Len would be the total of element in the list The output…
Read more

Lists

Creating a list in Python my_list = [ ] type(my_list) my_list = [‘haha’, ‘100’, 100, 2.0] To access element from a list you can choose each of them starting by element 0 my_list[0] haha my_list[3] 2.0 To change an element…
Read more

GIT

Commands : mkdir directory git init       will create the master branch git status git branch git add file1,file2,etc…. git rm file1,file2,etc…. git rebase “branch” git merge “branch” git commit -m “comments” tree . git diff git log git reset…
Read more

Files , read write open !

Basic commands to understand the open command f = open(“text.ext”)   <— default mode is read “r” f.read() f.readline() f.readlines() Once read, if you need to go back to the beginning of the file :  f.seek(X) output = f.”read.option”() print(output) =…
Read more

Netshot

Netshot is a powerfull and simple free software for network engineer, it is use to backup/push/compare/etc… configuration of multiple vendors. Github : https://github.com/netfishers-onl/Netshot/wiki/Installing-Netshot-on-Ubuntu-16-or-later-(or-any-Debian-based-distribution) Netshot : http://www.netfishers.onl/netshot Installation : I use Ubuntu Server 18.04, and Java 8 . To install Java 8 since…
Read more