|
| 1 | +# [fit] KPMG: Code |
| 2 | +## [fit] Python — Session 6 — Lesson |
| 3 | + |
| 4 | +--- |
| 5 | + |
| 6 | +# [fit] OS, CLI, GIT & IDEs |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +# Objectives |
| 11 | + |
| 12 | +- Brief overview of Operating Systems |
| 13 | +- Understand Terminal/CLI |
| 14 | +- Understand Source Control Management & Git |
| 15 | +- Brief overview of Markdown and IDEs |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +# [fit] Operating Systems (OS) |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +# Operating systems (OS) |
| 24 | + |
| 25 | + - Software that communicates with machine hardware. |
| 26 | + |
| 27 | + - Can you name some popular examples? |
| 28 | + |
| 29 | + --- |
| 30 | + |
| 31 | +# Operating systems |
| 32 | + |
| 33 | +- Some include a graphical user interface (GUI) for manipulation (Windows, MAC OS) |
| 34 | + |
| 35 | +- Linux has multiple distributions - some can include a GUI (e.g. Ubuntu) while some don’t. |
| 36 | + |
| 37 | +- When would we want or not want to have a GUI? |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +# Linux |
| 42 | + |
| 43 | +- Popular operating system based on UNIX |
| 44 | + |
| 45 | +- Open-source, multiple distributions |
| 46 | + |
| 47 | +- Commonly used for hosting web servers and scientific computing |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +# [fit] Command-line Interface (CLI) and Bash |
| 52 | + |
| 53 | +--- |
| 54 | + |
| 55 | + |
| 56 | +# CLI - Command Line Interface |
| 57 | + |
| 58 | +- Also referred to as the ‘Console’ or ‘Terminal’. |
| 59 | + |
| 60 | +- Terminal app on your Mac (you will have it by default because Mac OS is UNIX based) or Git Bash on your Windows (needs downloading) |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +# Bash - Bourne Again SHell |
| 65 | + |
| 66 | +- Command Language for most Linux distributions |
| 67 | + |
| 68 | +- sh = Shell |
| 69 | + |
| 70 | +- The Shell is the layer between the Operating System and the User (or other services) |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +# Bash commands |
| 75 | + |
| 76 | +```bash |
| 77 | +pwd # Prints to the console the path of your current working directory |
| 78 | + |
| 79 | +ls # Lists the files in the directory you are in |
| 80 | + |
| 81 | + |
| 82 | +cd <directory_name> # Gets in a given directory |
| 83 | + |
| 84 | +cd .. # Gets out of the directory you are in |
| 85 | + |
| 86 | +``` |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +# More bash commands |
| 91 | + |
| 92 | +```bash |
| 93 | +mkdir <directory_name> # Creates new directory |
| 94 | + |
| 95 | +rmdir my_folder # Deletes an empty Directory (Folder) |
| 96 | + |
| 97 | +rm -r <directory_name> # Deletes the directory and its contents recursively |
| 98 | + |
| 99 | + |
| 100 | +touch <file_name.txt/file_name.py> # Creates new file |
| 101 | + |
| 102 | +rm <file_name.txt/file_name.py> # Deletes file |
| 103 | + |
| 104 | + |
| 105 | +mv original_file1 /home/newfile1 # Moves a file (can be used for renaming) |
| 106 | + |
| 107 | +cp original_filename copy_filename # Makes a copy of a file |
| 108 | + |
| 109 | +``` |
| 110 | + |
| 111 | +--- |
| 112 | + |
| 113 | +# More bash commands |
| 114 | + |
| 115 | +```bash |
| 116 | +echo "Hello!" # Print the text "Hello!" in the terminal window |
| 117 | + |
| 118 | +echo "Bonjour!" > file.txt # Writes the text "Bonjour!" in the file.txt file |
| 119 | + |
| 120 | +cat file.txt # Reads the file.txt file -> prints the text "Bonjour!" to the console |
| 121 | + |
| 122 | +history # Displays your recently run Bash Commands |
| 123 | + |
| 124 | +wget <https://somewhere.com/afile.zip> # Downloads file/files from the link |
| 125 | + |
| 126 | +clear # Clears the terminal screen |
| 127 | + |
| 128 | +man <command> # Displays the manual and description for the chosen command -> ex: man ls/pwd/cd/mkdir |
| 129 | + |
| 130 | +``` |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +# Bash shortcuts |
| 135 | + |
| 136 | +- TAB - autocompletes commands, file names, or directory names for you. |
| 137 | + |
| 138 | +- UP/DOWN Arrows - Scroll backward and forwards through previous commands you’ve typed in the current session. |
| 139 | + |
| 140 | +- F3 - Repeat the previous command. |
| 141 | + |
| 142 | +- CTRL+C - Abort the current line you’re typing or a command that is currently executing. |
| 143 | + |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +# [fit] Source Control Management(SCM) and Git |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | + |
| 152 | +# Source Control Management(SCM) |
| 153 | + |
| 154 | +- Refers to tools used to track modifications to a source code repository. |
| 155 | + |
| 156 | +- Source Control Management = Version Control |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +# Why do we use Source Control? |
| 161 | + |
| 162 | +- Helps teams work collaboratively. |
| 163 | + |
| 164 | +- Developers can edit shared code without unknowingly overwriting each other’s work. |
| 165 | + |
| 166 | +- Serves as a protection mechanism. |
| 167 | + |
| 168 | + |
| 169 | +--- |
| 170 | + |
| 171 | +# Git |
| 172 | + |
| 173 | +- Git (Global Information Tracker) = a version control system. |
| 174 | + |
| 175 | +- Why Git? -> Because of its popularity, community, opensource nature, and decentralised approach. |
| 176 | + |
| 177 | +--- |
| 178 | + |
| 179 | +# Git - What does it do? |
| 180 | + |
| 181 | +- Allows you to *collaborate* on a project without interfering with each other’s work. |
| 182 | + |
| 183 | +- Keeps a historical record of everyone's work so you can go back to previous records. |
| 184 | + |
| 185 | +- You can work on your local copy of the codebase and then merge your changes with the main codebase. |
| 186 | + |
| 187 | +- Uses a series of snapshots, called commits, to track changes to the codebase over time along with the timestamp and user who made the changes. |
| 188 | + |
| 189 | +--- |
| 190 | + |
| 191 | +# Terminology |
| 192 | + |
| 193 | +### Remote Repository |
| 194 | + |
| 195 | +- This is where everyone shares their code centrally (ex: GitHub). |
| 196 | + |
| 197 | + |
| 198 | +### Local Repository |
| 199 | + |
| 200 | + - When you commit your code, a local version is created on your machine. |
| 201 | + |
| 202 | + --- |
| 203 | + |
| 204 | + # Basic Git commmands |
| 205 | + |
| 206 | + ```bash |
| 207 | +git clone <https://github.com/sergiuHudrea/intro-to-python.git> # Copies an existing Git repository from a remote location to your local machine. |
| 208 | + |
| 209 | + |
| 210 | +git init # Initializes an existing directory as a Git repository. |
| 211 | + |
| 212 | + |
| 213 | +git status # Shows the current status of the repository, including which files have been modified, which files have been added to the staging area, and which files are not being tracked by Git. |
| 214 | + ``` |
| 215 | + |
| 216 | + --- |
| 217 | + |
| 218 | + # Basic Git commands |
| 219 | + |
| 220 | + ```bash |
| 221 | + |
| 222 | +git add . # Adds ALL changes to the staging area in preparation for committing them to the repository. |
| 223 | + |
| 224 | +git commit -m "<Short description of what you have worked on.>" # Saves changes to the local repository, along with your commit message, usually describing the changes. |
| 225 | + |
| 226 | +git push origin main # Uploads local changes to your remote repository, on the main branch. |
| 227 | + |
| 228 | +git pull origin main # Downloads changes from the remote repository (main branch) and incorporates them into your local repository. |
| 229 | + |
| 230 | + ``` |
| 231 | + |
| 232 | +--- |
| 233 | + |
| 234 | +# Markdown and IDEs |
| 235 | + |
| 236 | +--- |
| 237 | + |
| 238 | +# Markdown and README.md |
| 239 | + |
| 240 | +- When creating a repository, you usually start off by writing a **README.md** file in a Markup language called Markdown. |
| 241 | + |
| 242 | +- The **README.md** summarises important information about the contents of the repo, instructions on how to edit or run the software, etc. |
| 243 | + |
| 244 | +- *Markdown* is a lightweight markup language for creating formatted text using a plain-text editor. |
| 245 | + |
| 246 | + |
| 247 | +--- |
| 248 | + |
| 249 | +# IDEs |
| 250 | + |
| 251 | +- **IDE** = An Integrated development environment is a software for application building. It combines tools into a single graphical user interface (GUI). |
| 252 | + |
| 253 | +- Why use an IDE? --> The tools needed are already there and ready to use. It is efficient and makes life easier. |
| 254 | + |
| 255 | +- Imagine repairing a car in a parking lot VS repairing it in a garage. |
| 256 | + |
| 257 | +- You can develop applications without an IDE, but the you would have to build your own IDE by manually integrating the tools you need. |
| 258 | + |
| 259 | +- Replit = a cloud IDE --> No need for downloading software and configuring local environments. No more "But it works on my machine". |
| 260 | + |
| 261 | +--- |
0 commit comments