Skip to content

Week 1 recap

Monday

Introductions

  • Understand where each person is coming from
  • How we learn
    • Anthony: Example, do it in real world, harder to read
    • Carlos: Reading from Text book, Read a few team, Break & fix
    • Colin: High level, then specific examples, uses writing in the margins a lot
    • Eddie: Hands on & doing it
    • Garrett: Book text, and then audio for replay, then examples
    • Mitch: Read & Watching & then redo
    • Swandand - Read Text & Synthesize, try it and debug

Who is Network to Code

  • Overview of our Services
    • PS, MS, and Enablement
  • Overview of our History
    • Started as training company, into PS, getting into MS

Syllabus Review

  • Went over "grading"
  • The flow of the week
  • The flow of the day
  • Capstone project time allocated

Environment Setup

  • Access via VPN to AWX
  • How to run job
  • SSH Access

Linux History and Shell profile

  • There are multiple shells (shell, bash, zsh, etc)
  • They have profiles for configuring them
  • The ordering in profiles is specific Linux Basic commands
  • man - manual, to review each command
  • ls - to view docs & directories
  • cd - change directory
  • cat, more, less - to view text files
  • pipes and redirects - for outputting to commands and files
  • Commonality within commands, e.g. -h for human readable

Linux Editors

  • Nano - simple, wysiwyg (what you see is what you get)
  • vim - advanced, but must know many things to get started
  • VS Code
    • Multi-Select
    • indent/de-indent
    • Comment section

Tuesday

Linux Admin

  • Add a user
  • Update a group
  • Change permissions (chmod)

Linux Packaging

  • The pros and cons of pip and poetry
  • Pip
  • Poetry
  • Helpful Link: https://blog.networktocode.com/blog/tags/poetry
  • Helpful Link: https://training.networktocode.com/courses/798483/lectures/31532638

Linux Net Tools

  • tcpdump - used to get pcap from server
  • nmap - used to discover devices and their OS's
  • Netcat - used to startup and end services
  • ping sweep

Git

  • Git Primary Commands
    • Operational Commands
      • git log
      • git status
      • git diff
      • git branch (view branches)
    • Creation Commands
      • git add
      • git commit
      • git push
      • git checkout (-b)
    • Pull Commands
      • git pull
      • git fetch
    • Reset
      • git reset
  • Using git to merge locally (rarely used)
  • Understanding concepts of commits
  • Reviewing what a PR is

Python OOP

  • Python is object oriented
  • Much of the "magic" happens in the dunder or magic methods
    • __eq__ checks for equality
    • __add__ does addition, etc..
  • The builtin functions are generally calling one of those methods
  • Type - function that shows the type of the object
  • dir - function that shows the available attributes and methods
  • help - function to read doc string and present how the class/function works

Wednesday

Interpreter

  • There is Python and iPython
  • Great for testing out objects

Strings

  • How they are assigned
  • Review the methods
    • upper, lower, etc.
    • startswith, endswith, etc
  • Join is a string method (not a list method), e.g. ', '.join(vlans)
  • Strings are iterable
  • Stings have magic methods, such as multiply and add, so they can concatenate as an example
  • Format and f-string
  • Whitespace with lstrip, rstrip, and strip

Integers & Floats

  • Math operations
  • Different between int and float

Booleans

  • Truthy vs True False statements
  • Truth Tables exists, be aware and know that some are logically equivalent
  • bool function
  • Precedence rules

Lists

  • Lists are ordered
  • append - to add to a lists
  • extend - to add one list to another (e.g. don't append accidentally)
  • sort - method that returns None, and changes object order
  • sorted - function, that returns a sorted list, but leave initial object unchanged
  • insert/pop - to add & remove
  • in - membership check, 200 in [300, 200, 440, 150, 450]

Dictionaries

  • Better for storing contextual information and accessing it
  • multiple ways to create a dictionary, vlans = dict(), vlans = {}
  • Accessing key with bracket notation
  • update - method to update dictionary
  • keys, values, items - method returns iterable (but not list) data
  • get - method, and how to short circuit obj.get('key', {}).get('otherkey')
  • dictionary reference vs shallow copy vs deep copy

Thursday

Python modules

  • Python idiomatic way with standard library is to import root level only, not methods below
  • All three (e.g. standard library, pypi and custom modules) are imported the same way
  • Avoid import *
  • You can namespace with as <namespace>
  • import * comes from __all__

Nested Objects

  • The format to get to keys is bracket notation
  • The format to get to indexes is bracket notation, with an integer
  • Each variable is accessible as it's own entity
  • Use the .get method when you don't know the data will always be there

File Operations

  • How to open file with "open"
  • How to open file using the context manager
  • How to write a file
  • What a context manager is, the use cases, and understanding it calls the __enter__ and __exit__ methods

Writing Scripts

  • The usage of __name__ == "__main__"
  • shebang, (#!)
  • import capabilities of modules
  • Modules imports are not greedy
  • Using __init__ creates the illusion of greedy, and is generally used

Conditionals

  • If, elif, else
  • Else in a function with all returns is not needed
  • Strategies for "shorting out" early to remove many if conditionals

Loops

  • For loop is most common, while loops can be used with counter
  • Enumerate
  • Generators
  • .items(), .keys(), and how they unpack
  • The difference in dict_items/key_items, and their list equivalent

Functions

  • Using built-in functions
  • How to define them
  • returning values
  • returning multiple values
  • args/kwargs and the unpacking that happens with them
  • Be aware of passing immutable objects (list/dictionaries) as args, follow this pattern
def test_func(working_list=None):
    if working_list is None:
        working_list = []

Friday

Contractor Challenge - 1

  • Ensure the video conferencing platform is ready to go
    • Installed, up to date, Permissions, etc.
  • Keep to the topic
  • Speak slowly enough for people to keep up
  • Be aware of what you are sharing
    • Slack!, other apps, notifications, bookmarks, tabs, etc.
  • Concentrate on what you are doing, don't fall into imposter syndrome

Arg passing

  • sys.argv, is a list
    • 0 index is the file
    • each item after that is there
  • argparse.ArgumentParser
    • Can add arguments
    • Provides "help"
    • Provides choices
    • description

Capstone Project

  • Review what an FTS is
  • Review what Configuration Compliance is