├── .gitignore
├── 01. Python
├── 00. Before You Start
│ ├── 00 Introduction.ipynb
│ ├── 01 Setup.ipynb
│ └── 02 Conda Environments.ipynb
├── 01. Basics
│ ├── 03 Interacting with Python.ipynb
│ ├── 04 Basic Data Types.ipynb
│ ├── 05 Variables.ipynb
│ ├── 06 Operators and Expressions.ipynb
│ ├── 07 Strings.ipynb
│ ├── 08 Composite Data Types: Lists and Tuples.ipynb
│ ├── 09 Composite Data Types: Dictionary.ipynb
│ ├── 10 Composite Data Types: Sets.ipynb
│ ├── 11 Python Program Lexical Structure.ipynb
│ ├── 12 Conditional Statements in Python.ipynb
│ ├── 13 Python "while" Loops (Indefinite Iteration).ipynb
│ ├── 14 Python "for" Loops (Definite Iteration).ipynb
│ ├── 15 List Comprehension.ipynb
│ ├── 16 Basic Input, Output, and String Formatting in Python.ipynb
│ ├── 17 Newer Python String Format Techniques.ipynb
│ ├── 18 Defining Your Own Python Function.ipynb
│ ├── 19 Namespaces and Scope in Python.ipynb
│ └── images
│ │ ├── break-continue.png
│ │ ├── celebrate.png
│ │ ├── conda-not-found.png
│ │ ├── dictionary.webp
│ │ ├── f-strings-fast.png
│ │ ├── f-strings-speed.png
│ │ ├── flat-v-container.png
│ │ ├── for-loop.webp
│ │ ├── format-2.webp
│ │ ├── format.webp
│ │ ├── func-arguments.webp
│ │ ├── func.webp
│ │ ├── global.webp
│ │ ├── if-block-c.png
│ │ ├── if-block.png
│ │ ├── int-pointer-2.png
│ │ ├── int-pointer-m-n.png
│ │ ├── int-pointer.png
│ │ ├── int-string-pointer.png
│ │ ├── intersection.webp
│ │ ├── legb.webp
│ │ ├── line-wrap.webp
│ │ ├── list-in-list.webp
│ │ ├── list-negative-index.webp
│ │ ├── list.webp
│ │ ├── nonlocal.png
│ │ ├── python-shell.png
│ │ ├── string-indexing-negative.png
│ │ ├── string-indexing.png
│ │ ├── string-slicing-stride-2.PNG
│ │ ├── string-slicing-stride.png
│ │ ├── string-slicing.png
│ │ ├── tuple-packing.webp
│ │ ├── tuple-unpacking.webp
│ │ ├── union.png
│ │ ├── variable-passing-func-1.webp
│ │ └── variable-passing-func-2.webp
├── 02. Object Oriented Programming
│ ├── 01 OOP Paradigm.ipynb
│ ├── 02 OOP in Python.ipynb
│ ├── 03.1 Inheritance.ipynb
│ ├── 03.2 Supercharge Your Classes With Python super().ipynb
│ ├── 04 Composition.ipynb
│ ├── 05 Overriding.ipynb
│ ├── 06 Data Types Methods.ipynb
│ ├── 07. Reading and Writing Files.ipynb
│ └── images
│ │ ├── difference.webp
│ │ ├── fileformat.webp
│ │ ├── intersection.webp
│ │ ├── multi-diff.webp
│ │ ├── python.png
│ │ ├── supercharge-your-classes-with-python-super()
│ │ └── multiple_inheritance.22fc2c1ac608.png
│ │ ├── sym-diff.webp
│ │ └── union.png
├── 03. Modular Programming
│ ├── 07.1 Modular Programming, Modules.ipynb
│ ├── 07.2 Modular Programming, Packages.ipynb
│ ├── 07.3 Absolute vs Relative Imports in Python.ipynb
│ ├── 07.4 Defining Main Functions in Python.ipynb
│ └── 07.5 How to Run Your Python Scripts.ipynb
├── 04. Advanced
│ ├── 01. The Meaning of Underscore (_).ipynb
│ ├── 02. Error Handling.ipynb
│ ├── 03.1 Decorators.ipynb
│ ├── 03.2 Fancy Decorators.ipynb
│ ├── 03.3 Decorating Classes.ipynb
│ ├── 04.1 Iterators.ipynb
│ ├── 04.2 Generators.ipynb
│ ├── 04.3 Itertools.ipynb
│ ├── 05.1 Descriptors.ipynb
│ ├── 05.2 Python's property.ipynb
│ ├── 06. with Context Manager.ipynb
│ ├── 07.1 Speed Up Your Python Program With Concurrency.ipynb
│ ├── 07.2 An Intro to Threading in Python.ipynb
│ ├── 07.3 What Is the Python Global Interpreter Lock (GIL)?.ipynb
│ ├── 07.4 Async IO in Python, A Complete Walkthrough.ipynb
│ ├── 07.5 Multiprocessing in Python.ipynb
│ ├── 08.1 Getting Started With Testing in Python.ipynb
│ ├── 08.2 Effective Python Testing With Pytest.ipynb
│ ├── 09. Python Type Checking (Guide).ipynb
│ ├── 10.1 Data Transfer Objects in Python Overview.ipynb
│ └── 10.2 Data Classes.ipynb
├── 05. Modules
│ ├── 01.1 Serialization (json).ipynb
│ ├── 01.2 Serialization (pickle).ipynb
│ ├── 01.3 Serialization (yaml).ipynb
│ ├── 02. collections.ipynb
│ ├── 03. pathlib, Taming the File System.ipynb
│ ├── 04.1 datetime.ipynb
│ ├── 04.2 time.ipynb
│ ├── 05. csv.ipynb
│ ├── 06. openpyxl.ipynb
│ └── 07. Build Command Line Interfaces with argparse.ipynb
├── 06. Nice to Know
│ ├── Cool New Features in Python 3.8.ipynb
│ └── images
│ │ └── cool-new-features-in-python-3.8
│ │ └── steering_council.1aae31a91dad.jpg
├── XX. Practice Sesions
│ ├── XX. Practice Sessions-Solutions
│ │ ├── 01. Data Types + Functions + IO.ipynb
│ │ ├── 02. Data Types + Functions + IO (with Solutions).ipynb
│ │ ├── 02. Search Engine (With Solutions).ipynb
│ │ ├── 03. OOP (With Solutions).ipynb
│ │ ├── 04. OOP + Modularization.ipynb
│ │ ├── 05. Review.ipynb
│ │ └── geo.py
│ └── XX. Practice Sessions
│ │ ├── 01 Data Types + Functions + IO.ipynb
│ │ ├── 02 OOP.ipynb
│ │ ├── 03 OOP + Modularization.ipynb
│ │ ├── 04 Review.ipynb
│ │ └── solution.ipynb
├── files
│ ├── decoded.txt
│ ├── encoded.txt
│ ├── image.png
│ ├── myfile.txt
│ ├── pkg
│ │ ├── __init__.py
│ │ ├── mod1.py
│ │ ├── mod2.py
│ │ ├── sub_pkg
│ │ │ ├── mod1.py
│ │ │ ├── mod2.py
│ │ │ └── mod3.py
│ │ ├── sub_pkg_1
│ │ │ ├── mod1.py
│ │ │ ├── mod3.py
│ │ │ └── mod4.py
│ │ └── sub_pkg_2
│ │ │ └── mod5.py
│ ├── pkg_1
│ │ ├── mod1.py
│ │ └── mod2.py
│ └── pkg_2
│ │ ├── __init__.py
│ │ ├── mod1.py
│ │ └── mod2.py
└── images
│ ├── car_instance.png
│ ├── cpubound.png
│ ├── exception-class-hierarchy.png
│ ├── init.png
│ ├── iobound.png
│ ├── jupyter-error.png
│ ├── jupyterlab.png
│ ├── myfile.txt
│ ├── notebook.png
│ ├── oop-inheritance-types.png
│ ├── package.png
│ ├── paradigms.png
│ ├── shape-all.png
│ ├── shape-rec-square.png
│ ├── shape-rectangle.png
│ ├── sub_pkg.png
│ ├── the-anatomy-of-PosixPath.jfif
│ ├── try-else.png
│ ├── try-except.png
│ ├── try-finally.png
│ ├── xl-append.png
│ └── xl.png
├── 02. Linux
├── 01 Fundamentals.ipynb
├── 02. Linux Terminal
│ ├── 01. Command Structure.md
│ ├── 02. Linux Manual.md
│ ├── 03. Permissions.md
│ ├── 04. Command Input & Output.md
│ ├── 05. Redirection.md
│ ├── 06. Piping.md
│ └── 07. Aliases.md
├── 03. Linux File System
│ ├── 01. Navigating the File System.md
│ ├── 02. File Extensions.md
│ ├── 03. Wildcards.md
│ ├── 04. Creating Files and Directories.md
│ ├── 05. Deleting File and Directories.md
│ ├── 06. Copying, Moving, Renaming.md
│ ├── 07. Nano Editor.md
│ ├── 08. Search for Files.md
│ ├── 09. Viewing Files.md
│ ├── 10. Search File Content.md
│ └── 11. Archiving and Compression.md
├── 04. Bash Shell Scripting
│ ├── 01. Introduction.md
│ ├── 02. Script Execution.md
│ ├── 03. Variables.md
│ ├── 04. Redirection.md
│ ├── 05. Functions.md
│ ├── 06. Comparison.md
│ ├── 07. Conditional Statement.md
│ └── 08. Loops.md
├── basckup.sh
├── hello.sh
├── images
│ ├── alias.png
│ ├── command_in_out.png
│ ├── egrep.png
│ ├── fdfind.png
│ ├── fgrep.png
│ ├── file-permissions-2.gif
│ ├── file-permissions.png
│ ├── grep-escape.png
│ ├── grep-r-h.png
│ ├── grep-r.png
│ ├── locate.png
│ ├── ls-l.jpg
│ ├── nano-l.png
│ ├── nano.png
│ ├── tar-gzip.png
│ └── tee.png
├── variable.sh
└── welcome.sh
├── 03. Data Structure and Algorithm
├── 01- BIG-O.ipynb
├── 02- Array & Linked List.ipynb
├── 03- Stack & Queue.ipynb
├── 04- Hash.ipynb
├── 05- Blockchain.md
└── images
│ ├── array-linkedlist.jpg
│ ├── array.png
│ ├── binary-graph.jpg
│ ├── binary-graph.png
│ ├── binary-list.jpg
│ ├── binary-list.png
│ ├── blockchain
│ ├── 1.png
│ ├── 10.png
│ ├── 2.png
│ ├── 3.png
│ ├── 4.png
│ ├── 5.png
│ ├── 6.png
│ ├── 7.png
│ ├── 8.png
│ ├── 9.png
│ ├── blockchain-nonce.png
│ ├── blockchain-tamper-2nd.png
│ ├── blockchain-tamper-compete.png
│ ├── blockchain-tamper.png
│ ├── blockchain.png
│ ├── decrypt-msg.png
│ ├── ledger.PNG
│ ├── no-bank.png
│ ├── paper.png
│ ├── public-private-key.png
│ └── sign-msg.png
│ ├── capsule_616x353.jpg
│ ├── closed_addressing.PNG
│ ├── doubly_linked_list.png
│ ├── singly_linked_list.png
│ └── stack.jpg
├── 04. Data Science
├── 02. Data Processing
│ ├── 02. Numpy
│ │ ├── 1.01 Basics.ipynb
│ │ ├── 1.02 Example.ipynb
│ │ ├── 1.03 Memory Management.ipynb
│ │ ├── 1.04 Array Shapes and Axes.ipynb
│ │ ├── 1.05 Filter, Order, Aggregate.ipynb
│ │ ├── 1.06 Optimizing Storage: Numpy Data Types.ipynb
│ │ ├── 1.07 More on Data Types.ipynb
│ │ ├── 1.08 File IO.ipynb
│ │ └── 1.09 Linear Algebra.ipynb
│ ├── 03. Pandas
│ │ ├── Untitled.ipynb
│ │ └── tmp
│ │ │ ├── 1. Introduction.ipynb
│ │ │ ├── 2. Data Structures.ipynb
│ │ │ ├── 3. Series.ipynb
│ │ │ ├── 4. DataFrames.ipynb
│ │ │ ├── 5. How Pandas Work Under the Hood.ipynb
│ │ │ ├── 6. Data Access.ipynb
│ │ │ └── nba_all_elo.csv
│ ├── Untitled.ipynb
│ └── images
│ │ ├── axb.jpg
│ │ ├── broadcasting-1.png
│ │ ├── broadcasting-2.jpg
│ │ ├── broadcasting-3.jpg
│ │ ├── cpu-cache.jpg
│ │ ├── ds-pipe.png
│ │ ├── jupyterlab.png
│ │ ├── loc-iloc.png
│ │ ├── notebook.png
│ │ ├── np_dot.jpg
│ │ ├── np_outerdot.jpg
│ │ ├── np_vdot.jpg
│ │ └── numpy-array.png
├── 03. Statistics
│ ├── 01. Introduction.ipynb
│ ├── 02. Descriptive Statistics
│ │ ├── 01. Frequency Distribution.ipynb
│ │ ├── 02. Describing Data with Averages.ipynb
│ │ ├── 03. Describing Variability.ipynb
│ │ ├── 04. Normal Distributions and Standard (z) Scores.ipynb
│ │ └── 05. Describing Relationships Correlation.ipynb
│ ├── 03. Inferential Statistics
│ │ ├── 01. Population, Samples, and Probability.ipynb
│ │ ├── 02. Sampling Distribution.ipynb
│ │ ├── 03. Hypothesis Testing: The z Test.ipynb
│ │ ├── 04. Estimation (Confidence Interval).ipynb
│ │ └── 05. t Test for One Sample.ipynb
│ ├── Statistics-11th-Edition-by-Robert-S-Witte.pdf
│ └── images
│ │ ├── amazon.PNG
│ │ ├── assignment-survey.png
│ │ ├── averages.png
│ │ ├── boundaries-z.png
│ │ ├── boundaries.png
│ │ ├── coincidence.png
│ │ ├── correaltion-vs-causality.png
│ │ ├── correlation.png
│ │ ├── curvelinear.png
│ │ ├── data-types.png
│ │ ├── hypothesized-sampling-dist.png
│ │ ├── level-of-significance.png
│ │ ├── mean-sampling-dist.png
│ │ ├── minority-majority.png
│ │ ├── normal-curve.png
│ │ ├── obs-experiment.png
│ │ ├── sample-population.png
│ │ ├── sampling-dist-is-normal-2.png
│ │ ├── sampling-dist-is-normal.png
│ │ ├── t-vs-z.png
│ │ ├── table-4.3.png
│ │ ├── two-estimate-of-variance.png
│ │ ├── typical_shapes.png
│ │ ├── variability-experiment.png
│ │ └── variability.png
└── 04. Linear Algebra
│ ├── Gilbert Strang - Introduction to Linear Algebra (2016, Wellesley-Cambridge Press) (1).pdf
│ └── Link to Text Book.txt
├── 05. Git
├── 01. Introduction
│ ├── 01. Overview.md
│ ├── 02. Introduction.md
│ ├── 03. Installation.md
│ └── 04. Key Concepts.md
├── 02. Getting Started
│ └── 01. Setting Up a Repository.md
├── 03. Saving Changes
│ ├── 01. Add and Commit.md
│ ├── 02. Inspecting a Repository.md
│ ├── 03. gitignore.md
│ └── 04. Branching.md
├── 04. Remote Repository
│ ├── 01. Remote Repository Setup.md
│ └── 02. Configuration.md
├── 05. Comparison
│ └── 01. Comparing Changes.md
├── 05. Merge.md
├── 06. Undoing Changes
│ ├── 0.1 Stashing Your Work.md
│ ├── 02. What is Lost?.md
│ ├── 03. Undoing a Committed Snapshot.md
│ ├── 04. Undoing Uncommitted Changes.md
│ └── 05. reset, checkout, revert.md
├── files
│ └── text.txt
└── images
│ ├── 3-stages.png
│ ├── after-checkout-branch.png
│ ├── after-reset.png
│ ├── before-checkout-branch.png
│ ├── before-reset.png
│ ├── branch.svg
│ ├── checkout-branch.png
│ ├── checkout-commit.png
│ ├── create-branch-pointer.svg
│ ├── create-branch.svg
│ ├── detached-head.png
│ ├── diff-new.png
│ ├── diff-no-output.png
│ ├── git-add.png
│ ├── git-commit.png
│ ├── git-directory.png
│ ├── git-github.png
│ ├── git-init.png
│ ├── git-log.png
│ ├── git-push.png
│ ├── git-stages.png
│ ├── git-stash.png
│ ├── merge.svg
│ └── merge_2.svg
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── Tools
└── VSCode.ipynb
├── _config.yml
└── images
├── banners
├── python-advanced.png
├── python-basics.png
├── python-modular.png
├── python-modules.png
├── python-oop.png
└── python-practice.png
├── logo.png
├── logos
├── checkmark.png
├── checkmark_white.png
├── light.png
├── python.png
├── toc.png
└── web.png
└── memes
├── functions.jpg
├── jobs.jpg
└── memory.jpg
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
131 |
132 |
133 |
134 | # --------------------------------------------------
135 | # my custom gitignore
136 | .vscode/
137 | *.xlsx
138 | *.html
139 | *.bin
140 | *.json
141 | *.pkl
142 |
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/break-continue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/break-continue.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/celebrate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/celebrate.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/conda-not-found.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/conda-not-found.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/dictionary.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/dictionary.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/f-strings-fast.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/f-strings-fast.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/f-strings-speed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/f-strings-speed.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/flat-v-container.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/flat-v-container.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/for-loop.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/for-loop.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/format-2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/format-2.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/format.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/format.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/func-arguments.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/func-arguments.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/func.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/func.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/global.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/global.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/if-block-c.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/if-block-c.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/if-block.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/if-block.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/int-pointer-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/int-pointer-2.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/int-pointer-m-n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/int-pointer-m-n.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/int-pointer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/int-pointer.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/int-string-pointer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/int-string-pointer.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/intersection.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/intersection.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/legb.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/legb.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/line-wrap.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/line-wrap.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/list-in-list.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/list-in-list.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/list-negative-index.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/list-negative-index.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/list.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/list.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/nonlocal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/nonlocal.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/python-shell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/python-shell.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/string-indexing-negative.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/string-indexing-negative.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/string-indexing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/string-indexing.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/string-slicing-stride-2.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/string-slicing-stride-2.PNG
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/string-slicing-stride.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/string-slicing-stride.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/string-slicing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/string-slicing.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/tuple-packing.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/tuple-packing.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/tuple-unpacking.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/tuple-unpacking.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/union.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/union.png
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/variable-passing-func-1.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/variable-passing-func-1.webp
--------------------------------------------------------------------------------
/01. Python/01. Basics/images/variable-passing-func-2.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/01. Basics/images/variable-passing-func-2.webp
--------------------------------------------------------------------------------
/01. Python/02. Object Oriented Programming/images/difference.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/02. Object Oriented Programming/images/difference.webp
--------------------------------------------------------------------------------
/01. Python/02. Object Oriented Programming/images/fileformat.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/02. Object Oriented Programming/images/fileformat.webp
--------------------------------------------------------------------------------
/01. Python/02. Object Oriented Programming/images/intersection.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/02. Object Oriented Programming/images/intersection.webp
--------------------------------------------------------------------------------
/01. Python/02. Object Oriented Programming/images/multi-diff.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/02. Object Oriented Programming/images/multi-diff.webp
--------------------------------------------------------------------------------
/01. Python/02. Object Oriented Programming/images/python.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/02. Object Oriented Programming/images/python.png
--------------------------------------------------------------------------------
/01. Python/02. Object Oriented Programming/images/supercharge-your-classes-with-python-super()/multiple_inheritance.22fc2c1ac608.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/02. Object Oriented Programming/images/supercharge-your-classes-with-python-super()/multiple_inheritance.22fc2c1ac608.png
--------------------------------------------------------------------------------
/01. Python/02. Object Oriented Programming/images/sym-diff.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/02. Object Oriented Programming/images/sym-diff.webp
--------------------------------------------------------------------------------
/01. Python/02. Object Oriented Programming/images/union.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/02. Object Oriented Programming/images/union.png
--------------------------------------------------------------------------------
/01. Python/06. Nice to Know/images/cool-new-features-in-python-3.8/steering_council.1aae31a91dad.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/06. Nice to Know/images/cool-new-features-in-python-3.8/steering_council.1aae31a91dad.jpg
--------------------------------------------------------------------------------
/01. Python/XX. Practice Sesions/XX. Practice Sessions-Solutions/04. OOP + Modularization.ipynb:
--------------------------------------------------------------------------------
1 | {"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["
"]}, {"cell_type": "markdown", "id": "moved-visibility", "metadata": {}, "source": ["#
OOP and Modularization \n"]}, {"cell_type": "markdown", "metadata": {}, "source": ["##
Table of Contents \n---"]}, {"cell_type": "markdown", "id": "supreme-discovery", "metadata": {}, "source": ["1. Given an list of points where `points[i] = Point(xi, yi)` represents a point on the X-Y plane and an integer `k`, return the `k` closest points to the origin `(0, 0)`.\n", "\n", "The distance between two points on the X-Y plane is the Euclidean distance (i.e, $\\sqrt{x_1^2 + y_1^2)}$.\n", "\n", "```python\n", "class Point:\n", " pass\n", "\n", "mylist = [Point(3, 4), Point(6, 8), Point(2, 2), Point(9, 11)]\n", "```"]}, {"cell_type": "code", "execution_count": 9, "id": "ready-trauma", "metadata": {}, "outputs": [], "source": ["class Point(object):\n", " def __init__(self, x, y):\n", " self.x = x\n", " self.y = y\n", " \n", " def __abs__(self):\n", " return (self.x ** 2 + self.y ** 2) ** 0.5\n", " \n", " # defining greater than operation\n", " def __gt__(self, obj):\n", " return abs(self) > abs(obj)"]}, {"cell_type": "code", "execution_count": 10, "id": "medical-finance", "metadata": {}, "outputs": [], "source": ["mylist = [Point(3, 4), Point(6, 8), Point(2, 2), Point(9, 11)]"]}, {"cell_type": "code", "execution_count": 11, "id": "speaking-preference", "metadata": {}, "outputs": [{"data": {"text/plain": ["[<__main__.Point at 0x7f17954cff90>,\n", " <__main__.Point at 0x7f17954cfad0>,\n", " <__main__.Point at 0x7f17954cfcd0>,\n", " <__main__.Point at 0x7f17954cfc90>]"]}, "execution_count": 11, "metadata": {}, "output_type": "execute_result"}], "source": ["sorted(mylist)"]}, {"cell_type": "code", "execution_count": 12, "id": "patient-acceptance", "metadata": {}, "outputs": [{"data": {"text/plain": ["False"]}, "execution_count": 12, "metadata": {}, "output_type": "execute_result"}], "source": ["Point(3, 4) > Point(6, 8)"]}, {"cell_type": "markdown", "id": "public-fusion", "metadata": {}, "source": ["2. Define `__str__` and `__repr__` dunder methods."]}, {"cell_type": "code", "execution_count": 16, "id": "entertaining-cookbook", "metadata": {}, "outputs": [], "source": ["class Point(object):\n", " def __init__(self, x, y):\n", " self.x = x\n", " self.y = y\n", " \n", " def __abs__(self):\n", " return (self.x ** 2 + self.y ** 2) ** 0.5\n", " \n", " # defining greater than operation\n", " def __gt__(self, obj):\n", " return abs(self) > abs(obj)\n", "\n", " def __str__(self):\n", " # best solution using f-string\n", " return f\"{self.__class__.__name__}({self.x}, {self.y}) [str]\"\n", "\n", " # using .format\n", " return \"{}({}, {}) [with format]\".format(self.__class__.__name__, self.x, self.y)\n", "\n", " # worst solution\n", " return self.__class__.__name__ + \"(\" + str(self.x) + \", \" + str(self.y) + \") [simple]\"\n", " \n", " def __repr__(self):\n", " return f\"{self.__class__.__name__}({self.x}, {self.y})\""]}, {"cell_type": "markdown", "id": "demonstrated-constitution", "metadata": {}, "source": ["Read [Python String Conversion 101: Why Every Class Needs a \u201crepr\u201d](https://dbader.org/blog/python-repr-vs-str) for a complete tutorial on `__repr__` and the difference between `__repr__` and `__str__`."]}, {"cell_type": "markdown", "id": "renewable-estonia", "metadata": {}, "source": ["3. Extend your class to `n` dimensions ($\\sqrt[2]{x_1^2 + x_2^2 + ... + x_n^2}$)"]}, {"cell_type": "code", "execution_count": 17, "id": "loose-contents", "metadata": {}, "outputs": [], "source": ["class Point:\n", " def __init__(self, *args):\n", " self.args = args\n", " \n", " def __abs__(self):\n", " sum_values = sum([item ** 2 for item in self.args])\n", " return sum_values ** 0.5\n", " \n", " def __gt__(self, obj):\n", " return abs(self) > abs(obj)\n", "\n", " def __repr__(self):\n", " return f\"{self.__class__.__name__}{self.args}\""]}, {"cell_type": "code", "execution_count": 18, "id": "optimum-disco", "metadata": {}, "outputs": [], "source": ["mylist = [Point(3, 4, 5), Point(6, 8), Point(2, 2, 2, 2), Point(9)]"]}, {"cell_type": "code", "execution_count": 19, "id": "similar-logic", "metadata": {}, "outputs": [{"data": {"text/plain": ["[Point(2, 2, 2, 2), Point(3, 4, 5), Point(9,), Point(6, 8)]"]}, "execution_count": 19, "metadata": {}, "output_type": "execute_result"}], "source": ["sorted(mylist)"]}, {"cell_type": "markdown", "id": "warming-neighborhood", "metadata": {}, "source": ["4. Write your class in a module named `geo.py` and import it."]}, {"cell_type": "code", "execution_count": 20, "id": "personal-development", "metadata": {}, "outputs": [], "source": ["from geo import Point"]}], "metadata": {"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10"}}, "nbformat": 4, "nbformat_minor": 5}
--------------------------------------------------------------------------------
/01. Python/XX. Practice Sesions/XX. Practice Sessions-Solutions/05. Review.ipynb:
--------------------------------------------------------------------------------
1 | {"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["
"]}, {"cell_type": "markdown", "id": "adopted-latino", "metadata": {}, "source": ["#
05. Review \n"]}, {"cell_type": "markdown", "metadata": {}, "source": ["##
Table of Contents \n* [1. Write a function that receives an iterable and an item, returns `True` if the item exists in iterable, `False` if it does not.](#1._write_a_function_that_receives_an_iterable_and_an_item,_returns_`true`_if_the_item_exists_in_iterable,_`false`_if_it_does_not.)\n * [2. Write the previous function with `for else`.](#2._write_the_previous_function_with_`for_else`.)\n * [3. Which one is more efficient? Why?](#3._which_one_is_more_efficient?_why?)\n * [4. Write a code that counts the number of items in an iterable.](#4._write_a_code_that_counts_the_number_of_items_in_an_iterable.)\n * [5. Write a function that generates passwords and a function that checks if a password is valid.](#5._write_a_function_that_generates_passwords_and_a_function_that_checks_if_a_password_is_valid.)\n * [6. What is the output in lines indicated by `#?`? Why?](#6._what_is_the_output_in_lines_indicated_by_`#?`?_why?)\n\n---"]}, {"cell_type": "markdown", "id": "regulation-passport", "metadata": {}, "source": ["", "\n", "### 1. Write a function that receives an iterable and an item, returns `True` if the item exists in iterable, `False` if it does not.\n", "\n", "**Note:** You should not use `item in mylist`. Use a for loop instead.\n", "\n", "```python\n", "def search(iterable, item):\n", " # code here\n", "```"]}, {"cell_type": "markdown", "id": "chinese-surprise", "metadata": {}, "source": ["", "\n", "### 2. Write the previous function with `for else`."]}, {"cell_type": "markdown", "id": "dense-italian", "metadata": {}, "source": ["", "\n", "### 3. Which one is more efficient? Why?\n", "\n", "1.\n", "```python\n", "for key in mydict:\n", " print(key, mydict[key])\n", "```\n", "\n", "2.\n", "```python\n", "for key, value in mydict:\n", " print(key, value)\n", "```"]}, {"cell_type": "markdown", "id": "mineral-proof", "metadata": {}, "source": ["", "\n", "### 4. Write a code that counts the number of items in an iterable.\n", "\n", "```python\n", "mylist = ['red', 'green', 'red', 'blue', 'green', 'red', 'red', 'red', 'blue', 'blue']\n", "```\n", "\n", "Output should look like this:\n", "```python\n", "{\n", " 'red': 5,\n", " 'green': 2,\n", " 'blue': 3'\n", "}\n", "```"]}, {"cell_type": "markdown", "id": "raising-mercy", "metadata": {}, "source": ["", "\n", "### 5. Write a function that generates passwords and a function that checks if a password is valid.\n", "\n", "Password requirements:\n", "- Length > 8\n", "- Have at least 1 capital letter.\n", "- Have at least 1 non numeric/alphabetic characters.\n", "\n", "```python\n", "def generate_password():\n", " # code here\n", "\n", "def check_password(password):\n", " # code here\n", "```"]}, {"cell_type": "markdown", "id": "specific-pride", "metadata": {}, "source": ["", "\n", "### 6. What is the output in lines indicated by `#?`? Why?\n", "\n", "```python\n", "def add_employee(emp, emp_list=[]):\n", " emp_list.append(emp)\n", " \n", " return emp_list\n", "\n", "add_employee(\"Name 1\") #?\n", "add_employee(\"Name 2\") #?\n", "add_employee(\"Name 3\") #?\n", "```\n", "\n", "##### If there are unexpected results, what is your solution?"]}], "metadata": {"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10"}}, "nbformat": 4, "nbformat_minor": 5}
--------------------------------------------------------------------------------
/01. Python/XX. Practice Sesions/XX. Practice Sessions-Solutions/geo.py:
--------------------------------------------------------------------------------
1 | class Point:
2 | def __init__(self, *args):
3 | self.args = args
4 |
5 | def __abs__(self):
6 | sum_values = sum([item ** 2 for item in self.args])
7 | return sum_values ** 0.5
8 |
9 | def __gt__(self, obj):
10 | return abs(self) > abs(obj)
11 |
12 | def __repr__(self):
13 | return f"Point{self.args}"
14 |
15 | def add(a, b):
16 | return a + b
17 |
18 |
19 | __all__ = [Point]
--------------------------------------------------------------------------------
/01. Python/XX. Practice Sesions/XX. Practice Sessions/02 OOP.ipynb:
--------------------------------------------------------------------------------
1 | {"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["
"]}, {"cell_type": "markdown", "id": "ignored-double", "metadata": {"hideCode": false, "hidePrompt": false, "slideshow": {"slide_type": "-"}}, "source": ["#
OOP \n"]}, {"cell_type": "markdown", "metadata": {}, "source": ["##
Table of Contents \n---"]}, {"cell_type": "markdown", "id": "described-treaty", "metadata": {}, "source": ["1. Create a `Vehicle` class without any variables and methods."]}, {"cell_type": "markdown", "id": "infrared-infrared", "metadata": {"hideCode": false, "hidePrompt": false}, "source": ["2. Create a `Vehicle` class with `max_speed` and `mileage` instance attributes."]}, {"cell_type": "markdown", "id": "inclusive-century", "metadata": {}, "source": ["3. Create a child class `Bus` that will inherit all of the variables and methods of the `Vehicle` class\n", "\n", "```python\n", "class Vehicle:\n", "\n", " def __init__(self, name, max_speed, mileage):\n", " self.name = name\n", " self.max_speed = max_speed\n", " self.mileage = mileage\n", "```"]}, {"cell_type": "markdown", "id": "talented-history", "metadata": {}, "source": ["4. Create a `Bus` class that inherits from the `Vehicle` class. Give the capacity argument of `Bus.seating_capacity()` a default value of 50.\n", "\n", "Use the following code for your parent `Vehicle` class. You need to use method overriding.\n", "\n", "```python\n", "class Vehicle:\n", " def __init__(self, name, max_speed, mileage):\n", " self.name = name\n", " self.max_speed = max_speed\n", " self.mileage = mileage\n", "\n", " def seating_capacity(self, capacity):\n", " return f\"The seating capacity of a {self.name} is {capacity} passengers\"\n", "```"]}, {"cell_type": "markdown", "id": "sized-darwin", "metadata": {}, "source": ["5. Define a property `color` that should have the same value for every class instance\n", "\n", "Use the following code for this exercise.\n", "```python\n", "class Vehicle:\n", "\n", " def __init__(self, name, max_speed, mileage):\n", " self.name = name\n", " self.max_speed = max_speed\n", " self.mileage = mileage\n", "\n", "class Bus(Vehicle):\n", " pass\n", "\n", "class Car(Vehicle):\n", " pass\n", "```"]}, {"cell_type": "markdown", "id": "pleasant-citizen", "metadata": {}, "source": ["6. Create a `Bus` child class that inherits from the `Vehicle` class. The default fare charge of any vehicle is `seating capacity * 100`. If `Vehicle` is `Bus` instance, we need to add an extra 10% on full fare as a maintenance charge. So total fare for bus instance will become the `final amount = total fare + 10%` of the total fare\n", "\n", "```python\n", "class Vehicle:\n", " def __init__(self, name, mileage, capacity):\n", " self.name = name\n", " self.mileage = mileage\n", " self.capacity = capacity\n", "\n", " def fare(self):\n", " return self.capacity * 100\n", "\n", "class Bus(Vehicle):\n", " pass\n", "\n", "school_bus = Bus(\"school Bus\", 12, 50)\n", "print(\"Total Bus fare is:\", school_bus.fare())\n", "```"]}, {"cell_type": "markdown", "id": "realistic-department", "metadata": {}, "source": ["**Note:** The bus seating capacity is 50. so the final fare amount should be 5500. You need to override the fare() method of a Vehicle class in Bus class."]}, {"cell_type": "markdown", "id": "accurate-warning", "metadata": {}, "source": ["7. Determine if `school_bus` is also an instance of the `Vehicle` class"]}], "metadata": {"hide_code_all_hidden": false, "kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10"}}, "nbformat": 4, "nbformat_minor": 5}
--------------------------------------------------------------------------------
/01. Python/XX. Practice Sesions/XX. Practice Sessions/03 OOP + Modularization.ipynb:
--------------------------------------------------------------------------------
1 | {"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["
"]}, {"cell_type": "markdown", "id": "moved-visibility", "metadata": {}, "source": ["#
OOP and Modularization \n"]}, {"cell_type": "markdown", "metadata": {}, "source": ["##
Table of Contents \n---"]}, {"cell_type": "markdown", "id": "supreme-discovery", "metadata": {}, "source": ["1. Given an list of points where `points[i] = Point(xi, yi)` represents a point on the X-Y plane and an integer `k`, return the `k` closest points to the origin `(0, 0)`.\n", "\n", "The distance between two points on the X-Y plane is the Euclidean distance (i.e, $\\sqrt{x_1^2 + y_1^2)}$.\n", "\n", "```python\n", "class Point:\n", " pass\n", "\n", "mylist = [Point(3, 4), Point(6, 8), Point(2, 2), Point(9, 11)]\n", "```"]}, {"cell_type": "markdown", "id": "public-fusion", "metadata": {}, "source": ["2. Define `__str__` and `__repr__` dunder methods."]}, {"cell_type": "markdown", "id": "demonstrated-constitution", "metadata": {}, "source": ["Read [Python String Conversion 101: Why Every Class Needs a \u201crepr\u201d](https://dbader.org/blog/python-repr-vs-str) for a complete tutorial on `__repr__` and the difference between `__repr__` and `__str__`."]}, {"cell_type": "markdown", "id": "renewable-estonia", "metadata": {}, "source": ["3. Extend your class to `n` dimensions ($\\sqrt[n]{x_1^2 + x_2^2 + ... + x_n^2}$)"]}, {"cell_type": "markdown", "id": "warming-neighborhood", "metadata": {}, "source": ["4. Write your class in a module named `geo.py` and import it."]}], "metadata": {"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10"}}, "nbformat": 4, "nbformat_minor": 5}
--------------------------------------------------------------------------------
/01. Python/XX. Practice Sesions/XX. Practice Sessions/04 Review.ipynb:
--------------------------------------------------------------------------------
1 | {"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["
"]}, {"cell_type": "markdown", "id": "adopted-latino", "metadata": {}, "source": ["#
05. Review \n"]}, {"cell_type": "markdown", "metadata": {}, "source": ["##
Table of Contents \n* [1. Write a function that receives an iterable and an item, returns `True` if the item exists in iterable, `False` if it does not.](#1._write_a_function_that_receives_an_iterable_and_an_item,_returns_`true`_if_the_item_exists_in_iterable,_`false`_if_it_does_not.)\n * [2. Write the previous function with `for else`.](#2._write_the_previous_function_with_`for_else`.)\n * [3. Which one is more efficient? Why?](#3._which_one_is_more_efficient?_why?)\n * [4. Write a code that counts the number of items in an iterable.](#4._write_a_code_that_counts_the_number_of_items_in_an_iterable.)\n * [5. Write a function that generates passwords and a function that checks if a password is valid.](#5._write_a_function_that_generates_passwords_and_a_function_that_checks_if_a_password_is_valid.)\n * [6. What is the output in lines indicated by `#?`? Why?](#6._what_is_the_output_in_lines_indicated_by_`#?`?_why?)\n\n---"]}, {"cell_type": "markdown", "id": "regulation-passport", "metadata": {}, "source": ["", "\n", "### 1. Write a function that receives an iterable and an item, returns `True` if the item exists in iterable, `False` if it does not.\n", "\n", "**Note:** You should not use `item in mylist`. Use a for loop instead.\n", "\n", "```python\n", "def search(iterable, item):\n", " # code here\n", "```"]}, {"cell_type": "markdown", "id": "chinese-surprise", "metadata": {}, "source": ["", "\n", "### 2. Write the previous function with `for else`."]}, {"cell_type": "markdown", "id": "dense-italian", "metadata": {}, "source": ["", "\n", "### 3. Which one is more efficient? Why?\n", "\n", "1.\n", "```python\n", "for key in mydict:\n", " print(key, mydict[key])\n", "```\n", "\n", "2.\n", "```python\n", "for key, value in mydict.items():\n", " print(key, value)\n", "```"]}, {"cell_type": "markdown", "id": "mineral-proof", "metadata": {}, "source": ["", "\n", "### 4. Write a code that counts the number of items in an iterable.\n", "\n", "```python\n", "mylist = ['red', 'green', 'red', 'blue', 'green', 'red', 'red', 'red', 'blue', 'blue']\n", "```\n", "\n", "Output should look like this:\n", "```python\n", "{\n", " 'red': 5,\n", " 'green': 2,\n", " 'blue': 3'\n", "}\n", "```"]}, {"cell_type": "markdown", "id": "raising-mercy", "metadata": {}, "source": ["", "\n", "### 5. Write a function that generates passwords and a function that checks if a password is valid.\n", "\n", "Password requirements:\n", "- Length > 8\n", "- Have at least 1 capital letter.\n", "- Have at least 1 non numeric/alphabetic characters.\n", "\n", "```python\n", "def generate_password():\n", " # code here\n", "\n", "def check_password(password):\n", " # code here\n", "```"]}, {"cell_type": "markdown", "id": "specific-pride", "metadata": {}, "source": ["", "\n", "### 6. What is the output in lines indicated by `#?`? Why?\n", "\n", "```python\n", "def add_employee(emp, emp_list=[]):\n", " emp_list.append(emp)\n", " \n", " return emp_list\n", "\n", "add_employee(\"Name 1\") #?\n", "add_employee(\"Name 2\") #?\n", "add_employee(\"Name 3\") #?\n", "```\n", "\n", "##### If there are unexpected results, what is your solution?"]}], "metadata": {"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10"}}, "nbformat": 4, "nbformat_minor": 5}
--------------------------------------------------------------------------------
/01. Python/XX. Practice Sesions/XX. Practice Sessions/solution.ipynb:
--------------------------------------------------------------------------------
1 | {"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["
"]}, {"cell_type": "code", "execution_count": 55, "id": "bd76afad-1382-492f-9f0b-1ab2ef3e05de", "metadata": {}, "outputs": [], "source": ["from collections import defaultdict, Counter"]}, {"cell_type": "code", "execution_count": 25, "id": "42d16c06-2827-444f-84bc-c029862f0d74", "metadata": {}, "outputs": [], "source": ["mylist = list(range(1000))"]}, {"cell_type": "code", "execution_count": 38, "id": "ed4f7e24-0eff-4fd2-9de9-c18d9bc4fb2e", "metadata": {}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["63.4 \u00b5s \u00b1 1.15 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10000 loops each)\n"]}], "source": ["%%timeit\n", "# solution 1: O(n) o(n)\n", "counter = {}\n", "for item in mylist:\n", " if item in counter:\n", " counter[item] += 1\n", " else:\n", " counter[item] = 1"]}, {"cell_type": "code", "execution_count": 39, "id": "09360424-edcd-4dea-9f5e-39aa76b546b5", "metadata": {}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["116 \u00b5s \u00b1 1.55 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10000 loops each)\n"]}], "source": ["%%timeit\n", "# solution 2: O(n) o(2n)\n", "counter = {}\n", "for item in mylist:\n", " counter[item] = counter.get(item, 0) + 1"]}, {"cell_type": "code", "execution_count": 52, "id": "46e104d0-b46e-4017-bb8d-039680571ac3", "metadata": {}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["182 \u00b5s \u00b1 2.21 \u00b5s per loop (mean \u00b1 std. dev. of 7 runs, 10000 loops each)\n"]}], "source": ["%%timeit\n", "# solution 3: O(n) o(3n)\n", "counter = defaultdict(int)\n", "for item in mylist:\n", " counter[item] += 1"]}, {"cell_type": "code", "execution_count": 57, "id": "46d629b7-0d59-41f9-a77e-a027dddbd977", "metadata": {}, "outputs": [{"name": "stdout", "output_type": "stream", "text": ["35.7 \u00b5s \u00b1 472 ns per loop (mean \u00b1 std. dev. of 7 runs, 10000 loops each)\n"]}], "source": ["%%timeit\n", "# solution 4: O(n) o(0.5n)\n", "Counter(mylist)"]}, {"cell_type": "code", "execution_count": null, "id": "139929ed-9109-4475-bfe4-ccb3266e3f39", "metadata": {}, "outputs": [], "source": ["%%timeit\n", "# solution 5: O(n^2)\n", "counter = {}\n", "for item in set(mylist):\n", " counter[item] = mylist.count(item)"]}, {"cell_type": "code", "execution_count": null, "id": "ffdccd2f-7a23-480f-87dc-5eb0a09d9900", "metadata": {}, "outputs": [], "source": []}], "metadata": {"kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.10"}}, "nbformat": 4, "nbformat_minor": 5}
--------------------------------------------------------------------------------
/01. Python/files/decoded.txt:
--------------------------------------------------------------------------------
1 | Heil Hitler,
2 |
3 | If you are reading this message, it means that you have cracked our code successfully!
4 |
5 | Sincerely,
6 | - Nazis
--------------------------------------------------------------------------------
/01. Python/files/encoded.txt:
--------------------------------------------------------------------------------
1 | Pmqt(Pq|tmz4Qn(w}(izm(zmilqvo(|pq{(um{{iom4(q|(umiv{(|pi|(w}(pi~m(kziksml(w}z(kwlm({}kkm{{n}tt)[qvkmzmt45(Viq{
--------------------------------------------------------------------------------
/01. Python/files/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/files/image.png
--------------------------------------------------------------------------------
/01. Python/files/myfile.txt:
--------------------------------------------------------------------------------
1 | this is line 1
2 | this is line 1
3 | this is line 1
4 | this is line 1
5 | this is line 1
6 | this is line 1
7 | this is line 1
8 | this is line 1
9 | this is line 1
10 | this is line 1
11 | this is line 1
12 | this is line 1
13 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/__init__.py:
--------------------------------------------------------------------------------
1 | print(f'Invoking __init__.py for {__name__}')
2 | A = ['item_1', 'item_2', 'item_3']
3 |
4 | __all__ = ['mod1', 'mod2']
5 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/mod1.py:
--------------------------------------------------------------------------------
1 | __all__ = ['foo']
2 |
3 | def foo():
4 | print('[mod1] foo()')
5 |
6 | class Foo:
7 | pass
8 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/mod2.py:
--------------------------------------------------------------------------------
1 | def multiply(a, b):
2 | return a * b
3 |
4 | class Bar:
5 | pass
6 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/sub_pkg/mod1.py:
--------------------------------------------------------------------------------
1 | def sub_foo():
2 | print('[mod1] foo()')
3 |
4 | class SubFoo:
5 | pass
6 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/sub_pkg/mod2.py:
--------------------------------------------------------------------------------
1 | def sub_bar():
2 | print('[mod2.py] baz()')
3 |
4 | class SubBar:
5 | pass
6 |
7 | from pkg.sub_pkg.mod1 import sub_foo
8 | sub_foo()
9 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/sub_pkg/mod3.py:
--------------------------------------------------------------------------------
1 | from .. import sub_pkg
2 | print(sub_pkg)
3 |
4 | from ..sub_pkg.mod1 import foo
5 | foo()
6 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/sub_pkg_1/mod1.py:
--------------------------------------------------------------------------------
1 | def sub_foo():
2 | print('[mod1.py] foo()')
3 |
4 | class SubFoo:
5 | pass
6 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/sub_pkg_1/mod3.py:
--------------------------------------------------------------------------------
1 | def sub_foo():
2 | print('[mod1.py] foo()')
3 |
4 | class SubFoo:
5 | pass
6 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/sub_pkg_1/mod4.py:
--------------------------------------------------------------------------------
1 | def sub_bar():
2 | print('[mod2.py] baz()')
3 |
4 | class SubBar:
5 | pass
6 |
7 | from pkg.sub_pkg_1.mod1 import sub_foo
8 | sub_foo()
9 |
--------------------------------------------------------------------------------
/01. Python/files/pkg/sub_pkg_2/mod5.py:
--------------------------------------------------------------------------------
1 | from .. import sub_pkg_1
2 | print(sub_pkg_1)
3 |
4 | from ..sub_pkg_1.mod3 import sub_foo
5 | sub_foo()
6 |
--------------------------------------------------------------------------------
/01. Python/files/pkg_1/mod1.py:
--------------------------------------------------------------------------------
1 | def add(a, b):
2 | return a + b
3 |
4 | class Foo:
5 | pass
6 |
--------------------------------------------------------------------------------
/01. Python/files/pkg_1/mod2.py:
--------------------------------------------------------------------------------
1 | def multiply(a, b):
2 | return a * b
3 |
4 | class Bar:
5 | pass
6 |
--------------------------------------------------------------------------------
/01. Python/files/pkg_2/__init__.py:
--------------------------------------------------------------------------------
1 | print(f'Invoking __init__.py for {__name__}')
2 | A = ['item_1', 'item_2', 'item_3']
--------------------------------------------------------------------------------
/01. Python/files/pkg_2/mod1.py:
--------------------------------------------------------------------------------
1 | from pkg_2 import A
2 | print(A)
3 |
4 | def add(a, b):
5 | return a + b
6 |
7 | class Foo:
8 | pass
9 |
--------------------------------------------------------------------------------
/01. Python/files/pkg_2/mod2.py:
--------------------------------------------------------------------------------
1 | def multiply(a, b):
2 | return a * b
3 |
4 | class Bar:
5 | pass
6 |
--------------------------------------------------------------------------------
/01. Python/images/car_instance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/car_instance.png
--------------------------------------------------------------------------------
/01. Python/images/cpubound.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/cpubound.png
--------------------------------------------------------------------------------
/01. Python/images/exception-class-hierarchy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/exception-class-hierarchy.png
--------------------------------------------------------------------------------
/01. Python/images/init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/init.png
--------------------------------------------------------------------------------
/01. Python/images/iobound.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/iobound.png
--------------------------------------------------------------------------------
/01. Python/images/jupyter-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/jupyter-error.png
--------------------------------------------------------------------------------
/01. Python/images/jupyterlab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/jupyterlab.png
--------------------------------------------------------------------------------
/01. Python/images/myfile.txt:
--------------------------------------------------------------------------------
1 | this is line 1
2 | this is line 2
3 | this is line 3
4 | this is line 4
5 | this is line 5
6 | this is line 6
7 |
--------------------------------------------------------------------------------
/01. Python/images/notebook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/notebook.png
--------------------------------------------------------------------------------
/01. Python/images/oop-inheritance-types.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/oop-inheritance-types.png
--------------------------------------------------------------------------------
/01. Python/images/package.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/package.png
--------------------------------------------------------------------------------
/01. Python/images/paradigms.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/paradigms.png
--------------------------------------------------------------------------------
/01. Python/images/shape-all.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/shape-all.png
--------------------------------------------------------------------------------
/01. Python/images/shape-rec-square.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/shape-rec-square.png
--------------------------------------------------------------------------------
/01. Python/images/shape-rectangle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/shape-rectangle.png
--------------------------------------------------------------------------------
/01. Python/images/sub_pkg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/sub_pkg.png
--------------------------------------------------------------------------------
/01. Python/images/the-anatomy-of-PosixPath.jfif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/the-anatomy-of-PosixPath.jfif
--------------------------------------------------------------------------------
/01. Python/images/try-else.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/try-else.png
--------------------------------------------------------------------------------
/01. Python/images/try-except.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/try-except.png
--------------------------------------------------------------------------------
/01. Python/images/try-finally.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/try-finally.png
--------------------------------------------------------------------------------
/01. Python/images/xl-append.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/xl-append.png
--------------------------------------------------------------------------------
/01. Python/images/xl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/01. Python/images/xl.png
--------------------------------------------------------------------------------
/02. Linux/02. Linux Terminal/01. Command Structure.md:
--------------------------------------------------------------------------------
1 | # Command Structure
2 |
3 | By the end: Commands will begin to look like a langauge not random gibberish.
4 |
5 | Right now each command has its own unique behavior. You can actually look up using something called the manual pages which I'll show you how to do later.
6 |
7 | But the general command structure goes like this.
8 | 1. you type out the command name. So it would be like `date` or `echo`.
9 | 2. Then you give the comments of options to customize its behavior.
10 | 3. Then you give the command some inputs to actually operate on.
11 |
12 | --> `command_name -options inputs`
13 |
14 | ## Command Name
15 |
16 | Now the first thing you type is the command name. Now that lets the shell know what program you actually want to run. And once the Shell knows what program you want to run it knows the name of the program you want to run the show will then search for that program on something called your Shell's path which is just a list of folders that contain these programs.
17 |
18 | Now you can actually see your Shell's path by typing `echo $PATH`. So what the shell will do is it'll start at the very left of the path and it will look inside that folder for a command called `echo`. If it's not found, it will do the same on the next folder and so on and so forth.
19 |
20 | **Note**: If two programs with the same name are in different folders of `$PATH`, the one in the far left folder will always run.
21 |
22 |
23 | Now you can actually see which folder the command is stored in by using the `which` command:
24 | - `which cal` --> `/usr/bin/cal`
25 | - `which date` --> `/usr/bin/date`
26 |
27 | Now you can customize the way that commands work by giving them different **options** and different **inputs**.
28 |
29 | ## Inputs
30 | It's important to note that not all commands actually require inputs. Some inputs are optional. For example the date command doesn't strictly require an input.
31 |
32 | **Note**: Because commands **operate** on the input the input is sometimes called an **operand**.
33 |
34 | So for example if we take the cow command I could just type cow OK and press enter and I would get this month's calendar. But to customize the behavior I can give it one or more inputs: `cal 2021`, `cal 12 2017`
35 |
36 | ## Options
37 |
38 | That's common for commands to be preceded by dashes and hyphens and things: `cal -y`, `date -u` (UTC time)
39 |
40 | So sometimes options actually have long form names proceded by `--`: `date --universal`
41 |
42 | **Note:** The long form commands can make commands easier to read but they're not available for all options. It really depends upon the command that you're using.
43 |
44 | Now the only other thing to know is that sometimes options can have their own inputs. For example there is an option that will allow us to see a certain amount of months after a time:
45 | - `cal -A 1 12 2017` --> 1 month after (`-A`) December (12) 2017
46 | - `cal -B 1 12 2017` --> 1 month before (`-B`) December (12) 2017
47 | - `cal -A 1 -B 1 12 2017` --> 1 month after (`-A`) and before (`-B`) December (12) 2017
48 |
49 | ## Summary
50 | - Command: `command_name -options inputs`
51 | - Command name must be on the shell's **search path** (`$PATH`).
52 | - Commands operate on inputs.
53 | - Options modify command's behaviour
54 |
--------------------------------------------------------------------------------
/02. Linux/02. Linux Terminal/02. Linux Manual.md:
--------------------------------------------------------------------------------
1 | # Linux Manual
2 |
3 | Like we saw each of the Linux commands is implemented slightly differently and they behave slightly differently.
4 |
5 | So other than memorizing a jillion different implementations of things how can we actually know how to use each of the Linux commands properly. Well the answer is to use the manual pages known as **man pages** for sure.
6 |
7 | ## Manual Structure
8 |
9 | Manual is broken up into eight sections and each of these sections deals with a specific type of thing.
10 |
11 | |Section|Contains|Description|Example|
12 | |:--|:--|:--|:--|
13 | |1|User Commands|commands that can just be run from the shell by any regular user. You don't need any particular administration privileges or any root privileges to be able to run these|`date`, `cal`|
14 | |2|System Calls|this contains programming functions that can be used within an application that you write to make calls to the Linux kernel which is a very low level part of the operating system||
15 | |3|C Library Functions|hese are libraries for the C programming language and these are functions and libraries that provide interfaces to specific things on your computer such as graphical user interfaces or other libraries that you might want to use if you're writing some C code that you want to have access to your computer with||
16 | |4|Devices and Special Files|This is about how the different device is on your computer are managed. So things such as CD drives or things such as random number generators or things such as U.S. ports and stuff like that.||
17 | |5|File Formats and Conventions|It's about all the different formats and the conventions of specific files and on your computer. So you know formats for word documents or formats where PDA documents a format for specific configuration files.||
18 | |6|Games|Any games that are installed on your computer they have their own section and different commands.||
19 | |7|Miscellaneous|More miscellaneous stuff more Uncategorized stuff. So it's usually stuff like protocols or file systems and information about those.||
20 | |8|System Administration|All the commands that can actually that actually require root privileges and administration privileges to be run on your computers this is things like changing passwords. This is things like you know really editing important stuff on your computer setting up automation and things like that.||
21 |
22 |
23 | **Note:** Section 1 Section 5 and section 8 are what you will likely use most often.
24 |
25 | ## Search Manual
26 |
27 | You would have to use the `man` command that a `man` command is short for the word manual. And it's the command that deals with everything to do with the manual basically: `man -k search_term`
28 | - `man -k which`
29 | - `man -k ls`
30 | - ...
31 |
32 | To see the manual for a command: `man command`:
33 | - `man which`
34 | - `man ls`
35 | - ...
36 |
37 | Example of a man page: `man which`
38 |
39 | ```
40 | WHICH(1) General Commands Manual WHICH(1) NAME which - locate a command SYNOPSIS which [-a] filename ... DESCRIPTION which returns the pathnames of the files (or links) which would be exe‐ cuted in the current environment, had its arguments been given as com‐ mands in a strictly POSIX-conformant shell. It does this by searching the PATH for executable files matching the names of the arguments. It does not canonicalize path names. OPTIONS -a print all matching pathnames of each argument
41 | EXIT STATUS
42 | 0 if all specified commands are found and executable 1 if one or more specified commands is nonexistent or not executable 2 if an invalid option is specified
43 | ```
44 |
45 | **Note**: in manual pages:
46 | - Anything inside `<>` is **mandatory**.
47 | - Anything inside `[]` is **optional**
48 | - For example:
49 | - in `which [-a] `, `-a` is optional but `something` is mandatory.
50 | - in `ls [OPTION]... [FILE]...` everything is optional and only ls is mandatory.
51 |
52 | - `|` inside `[]` means `or` which means you have to pick one of them not both. For example in `[-a | -f]` using `-af` is invalid
53 |
54 | ##
--------------------------------------------------------------------------------
/02. Linux/02. Linux Terminal/04. Command Input & Output.md:
--------------------------------------------------------------------------------
1 | # Command Input & Output
2 |
3 | The ways **data** flows **into** and **out** of a **command**.
4 |
5 | Be ready to connect commands.
6 |
7 | 
8 |
9 | Standard output is something called a standard data stream just like a stream of water data stream start somewhere and they end somewhere. **So where does standard output lead?**
10 |
11 | Well **by default** standard output will lead to your terminal. So that's why when we type commands the output of the command appears on the screen.
12 |
13 | The amazing thing about output data streams is that you can **redirect** where they go using a process imaginative imaginatively called redirection.
14 |
15 | Similarly, standard input is a data stream and is by default connected to the keyboard. So it can be redirected as well.
16 |
17 | That makes them so powerful you can simply pass the standard output stream from one command to the standard input stream of another then pass the standard output stream of that second command to the standard input stream of the third command and so on and so on until you build up a very powerful pipeline connecting outputs to inputs in this way is known as **piping** together commands and it's an incredibly important concept in Linux as it's what makes working with the command line so powerful and effective.
18 |
19 |
20 | ## Summary
21 | - There are two ways to get data into commands and two ways to get data out.
22 | 1. Command line arguments
23 | 3. Standard Input
24 | 2. Standard Output
25 | 4. Standard Error
26 | - Standard Input, Standard Output, and Standard Error are Standard Data Streams.
27 | - Data streams can be redirected from their default locations to wherever you wish.
28 | - You can redirect the standard output of one command to the standard input of another in a process know as **piping**.
29 |
--------------------------------------------------------------------------------
/02. Linux/02. Linux Terminal/05. Redirection.md:
--------------------------------------------------------------------------------
1 | # Redirection
2 | - You will be able to **redirect the standard data streams**.
3 |
4 | But by the end, you'll be able to redirect standard input standard output and standard error to your heart's content and you'll feel much more like a computer genius already.
5 |
6 | ## Examples
7 | - `cat`: `cat` needs standard input in order to run but because standard input is by default connected to the keyboard cat just sits there and waits for us to enter something on the keyboard.
8 | - `cat 1> output.txt`: Every data stream not only has a name like standard outputs and imports on that, but it also has a number associated with it.
9 | - Standard Input is number zero.
10 | - Standard output is number one.
11 | - Standard error is number two.
12 |
13 | Here, we are redirecting or changing the destination of standard output because standard output is number one.
14 |
15 | - `cat -k bla 2> error.txt`: Redirect standard error data stream to error.txt
16 | - `cat 0< input.txt 1> output.txt 2> error.txt`
17 |
18 | **Notes:**
19 | - You don't actually even need to put the number 1 in `cat 1> output.txt` (default for output: 1).
20 | - You don't actually even need to put the number 0 in `cat 0< input.txt`> (default for input: 0).
21 | - Use two arrows to write to a file again using redirection without truncating it (`cat 1>> output.txt`)
22 |
23 | ## Summary
24 | - Standard input, standard output, and standard error are data streams.
25 | - Using redirection you can control where those streams **flow**.
26 | - Standard Input: 0
27 | - Standard Output: 1
28 | - Standard Error: 2
29 | - `>` will overwrite a file before writing it.
30 | - `>>` will append to what's already there.
31 |
32 | **Read More**:
33 | - [Redirections](https://www.gnu.org/software/bash/manual/html_node/Redirections.html)
34 | - [BashGuide/InputAndOutput](http://mywiki.wooledge.org/BashGuide/InputAndOutput?#Redirection)
--------------------------------------------------------------------------------
/02. Linux/02. Linux Terminal/06. Piping.md:
--------------------------------------------------------------------------------
1 | # Piping
2 |
3 | What if you wanted to connect the standard output of one command so that it flowed into the standard input of another command? Well that's where **piping** comes.
4 |
5 | Each Linux command is designed to do one task extremely well. So if you can continually pipe these highly specialized commands together and pass data between them, you can build advanced pipelines to do pretty much any task that you can think of.
6 |
7 | **piping is all about connecting standard output of one command to standard input of another command.**
8 |
9 | ## Example
10 | For example if you want to get the weekday from date command, this is one way to do it:
11 | 1. `date > date.txt`
12 | 2. `cut < date.txt --delimiter " " --fields 1`
13 |
14 | It's very cool command but this this works but it's kind of clunky. OK first we're writing the standard output of the date command to a file which takes up space on our computer. Right then we have to read that file into the command.
15 | - A lot more typing.
16 | - Makes unnecessary files.
17 | - Inefficient and awkward.
18 |
19 | So instead we can pipe the standard output of the data command directly into the standard input of the cut command.
20 | - `date | cut --delimiter " " --fields 1`
21 |
22 | Or you can send the standard output to a file:
23 | - `date | cut --delimiter " " --fields 1 > today.txt`
24 | - `date | cut > today.txt --delimiter " " --fields 1`
25 | - `date | cut --delimiter " " > today.txt --fields 1`
26 |
27 | Send the data from the command into yet another command (multiple piping):
28 | - `date | cut --delimiter " " --fields 1 | command -options args`
29 |
30 | Remember the data can't really go two places at once. For example, piping is broken here and only date standard output is stored in `date.txt`:
31 | - `date > date.txt | cut --delimiter " " --fields 1`
32 |
33 | ## `tee` Command
34 | `tee` - read from standard input and write to standard output and files.
35 |
36 | How can we go about actually saving this information into a file but at the same time also pass it down into the pipeline?
37 |
38 | 
39 |
40 | - `date | tee fulldate.txt | cut --delimiter " " --fields 1`
41 |
42 | You can also send the standard output to a file:
43 | - `date | tee fulldate.txt | cut --delimiter " " --fields 1 > today.txt`
44 | - `date | tee fulldate.txt | cut --delimiter " " --fields 1 | tee today.txt`
45 |
46 | By `tee` command, you can actually pass data through your pipeline but also take snapshots of the data as it flows through and save those snapshots into a file.
47 |
48 | The `tee` command is really useful because by doing normal redirection you break your pipeline but by using the command you can save data but still keep your pipeline flowing.
49 |
50 | ## `xarg` Command
51 | What do you think will happen if I take the date command and pipe that into Echo?
52 | - `date | echo`
53 |
54 | this is a common mistake actually that people make when using pipelines for the first time they try to pipe things into Echo.
55 | **`echo` doesn't accept standard input.**
56 |
57 | the key is to convert the data from standard input into command line arguments so the command can continue to work like normal.
58 |
59 | - `date | xargs echo`
60 | - `date | xargs echo "hello world"`
61 | - `date | cut --delimiter " " --fields | xargs echo`
62 |
63 | `rm` is another command that delets files and directories:
64 | - `rm file`
65 | - `rm -r directory`
66 |
67 | Now create a file that contains two file names and name it `filestodelete.txt`.
68 | ```
69 | file_1.txt
70 | file_2.txt
71 | ```
72 |
73 | This does not work to delete files:
74 | - `cat filestodelete.txt | rm`
75 |
76 | But this workds:
77 | - `cat filestodelete.txt | xargs rm`
78 |
79 | It's as if we run this command:
80 | - `rm file_1.txt file_2.txt`
81 |
82 | ## Summary
83 | - Piping connects **STDOUT** of one command to **STDIN** of another.
84 | - Redirection of **STDOUT** breaks pipelines.
85 | - To save a data snapshot without breaking pipelines, use the `tee` command.
86 | - If a command does not accept **STDIN**, but you want to pipt to it, use `xargs`.
87 | - Command you use with `xargs` can still have their own arguments.
88 |
--------------------------------------------------------------------------------
/02. Linux/02. Linux Terminal/07. Aliases.md:
--------------------------------------------------------------------------------
1 | # Aliases
2 |
3 | Linux users often need to use one command over and over again. Typing or copying the same command again and again reduces your productivity and distracts you from what you are actually doing.
4 |
5 | You can save yourself some time by creating **aliases** for your most used commands. **Aliases** are like custom shortcuts used to represent a command (or set of commands) executed with or without custom options. Chances are you are already using aliases on your Linux system.
6 |
7 | ## List Currently Defined Aliases in Linux
8 | You can see a list of defined aliases on your profile by simply executing `alias` command.
9 |
10 | 
11 |
12 | ## How to Create Aliases in Linux
13 |
14 | Creating aliases is relatively easy and quick process. You can create two types of aliases – temporary ones and permanent. We will review both types.
15 |
16 | ### Creating Temporary Aliases
17 | What you need to do is type the word alias then use the name you wish to use to execute a command followed by "=" sign and quote the command you wish to alias.
18 |
19 | `alias shortName="your custom command here"`
20 |
21 | For example:
22 | `alias ls="ls -l"`
23 |
24 | ### Creating Permanent Aliases
25 |
26 | To keep aliases between sessions, you can save them in your user’s shell configuration profile file. This can be:
27 |
28 | ```
29 | Bash – ~/.bashrc
30 | ZSH – ~/.zshrc
31 | Fish – ~/.config/fish/config.fish
32 | ```
33 |
34 | The syntax you should use is practically the same as creating a temporary alias. The only difference comes from the fact that you will be saving it in a file this time. So for example, in bash, you can open `.bashrc` file with your favorite editor like this:
35 |
36 | `code ~/.bashrc`
37 |
38 | Find a place in the file, where you want to keep the aliases. For example, you can add them in the end of the file. For organizations purposes you can leave a comment before your aliases something like this:
39 |
40 | ```
41 | # my custom aliases
42 | alias home="ssh -i ~/.ssh/mykep.pem tecmint@192.168.0.100"
43 | alias ll="ls -alF"
44 | ```
45 |
46 | **Note:** If you are using [zsh](https://linuxhint.com/install_zsh_shell_ubuntu_1804/), then you should open `~/.zshrc` file.
47 |
48 |
49 | ## Summary
50 |
51 | - An alias is a custom nickname for a command or pipeline.
52 | - aliases are accessible when you restart your terminal.
53 |
--------------------------------------------------------------------------------
/02. Linux/03. Linux File System/01. Navigating the File System.md:
--------------------------------------------------------------------------------
1 | # Navigating the File System
2 |
3 | ## Where are we?
4 | The first thing we'd like to know when navigating the system is where we currently are.
5 |
6 | And the shell already tells us this with **shell prompt** and the shell prompt is everything up to the dollar sign.
7 |
8 | ```bash
9 | $user@computer-name:~$
10 | ```
11 | First of all it tells you the user who is logged in which is `user` on this computer. Then you have the name of the computer which is `computer-name`.
12 |
13 | And then you `~` that's called Tilda which is a short way of representing the current user's home directory.
14 |
15 | We can actually confirm at any time what directory or what location our shell is currently operating in but using the `pwd` command and the `pwd` command stands for **print working directory**.
16 |
17 | ```bash
18 | $user@computer-name:~$ pwd
19 | /home/user
20 | ```
21 |
22 | The path starts all the way from the root directory the very base directory which is the `/` and works its way down until we get to the home directory for the user `user` which is the current user logged in.
23 |
24 | ## How to Navigate
25 | Now that we know where we are and we know that our shell is operating inside of our home folder how can we take a look around and see what's in the home folder?
26 |
27 | ### `ls`
28 | We need to use the `ls` command now the `ls` is short for the list and the `ls` command will list of files in a directory.
29 |
30 | |Command|Description|
31 | |:--|:--|
32 | |`ls`|List of files/directories in a directory|
33 | |`ls -F`|List files/directories with classification (directories appear with `/` at the end)|
34 | |`ls -l`|List of files/directories in **long format**|
35 | |`ls -lh`|List of files/directories in **human readable** long format (4096 will appear as 4K)|
36 | |`ls -a`|List of **all** (including hidden) files/directories|
37 |
38 | **Note:** Hidden files/directories start with a dot: `.`
39 |
40 | List of files/directories in long format:
41 | 
42 |
43 | ### `cd`
44 | How can we actually move from our home directory?
45 |
46 | The missing piece is the `cd` command and the `cd` command stands for **change directory**.
47 | ```bash
48 | user@computer ~ % cd /home/user/Downloads
49 | user@computer ~/Downloads % # directory is changed to ~/Downloads
50 | ```
51 |
52 | **Note:**
53 | - You can use **full path** (start at the base `/` directory such as `/home/user/`) or **relative path** (start at the current directory such as `./user`).
54 | - `.` means the current directory.
55 | - `..` means the parent folder or the folder above where we currently are.
56 | - `cd .` stays in the same directory.
57 | - `cd ..` changes directory to the parent directory.
58 | - Press tab for auto completion. For example type `cd ~/Do` and press tab to receive two suggestions.
59 | ```bash
60 | user@computer ~ % cd /home/user/Do
61 | Downloads Documents
62 | ```
63 |
64 | ## Summary
65 | - You can use `pwd` command to see the path to where on the file system the shell is currently operating.
66 | - You use `ls` to see what's around you.
67 | - You can use the `cd` command to move to a new location on the file system.
68 | - **Absolute Path** start at the base (`/`) directory.
69 | - **Relative Path** start from the current directory.
70 | - Every directory has the `.` (current directory) and `..` (parent directory) hidden folders.
71 | - **Tab Auto Completion** is a really usefull technique to speed up typing and avoid errors.
72 | - Tab auto completion can be used **anywhere**, not just when navigating.
73 |
--------------------------------------------------------------------------------
/02. Linux/03. Linux File System/02. File Extensions.md:
--------------------------------------------------------------------------------
1 | # File Extensions
2 | In linux, file extensions don't matter. Linux doesn't determine file type. Using the file extension but instead it reads a piece of code inserted at the top of every file and that piece of code is known as a header and it serves as a kind of label for Linux to read and when Linux reads that label it knows the file type.
3 |
4 | In linux, `file` command will tell us basically what type of file we are dealing with.
5 |
6 | ```bash
7 | $user@computer-name:~$ file image.png
8 | image.PNG: PNG image data, 1913 x 1086, 8-bit/color RGBA, non-interlaced
9 |
10 | $user@computer-name:~$ file document.txt
11 | document.txt: UTF-8 Unicode text
12 |
13 | $user@computer-name:~$ file document.txt
14 | document.txt: UTF-8 Unicode text
15 |
16 | $user@computer-name:~$ file myfolder
17 | myfolder: directory
18 | ```
19 |
20 | So changing just the name of the file won't make a difference because that file header won't have changed.
21 |
22 | Although the operating system will know what file format the actual file is by reading the header, The extra programs that are installed on top of the operating system such as this PDA viewer are trying to open the files that might require a certain formats or the file extensions in order to work.
23 |
24 | The important distinction to make there the programs that are installed on top of the operating system such as PDF viewers and the fact that they might need the file to have a specific file extension in order to open them but the operating system itself does not care.
25 |
26 | ## Summary
27 | - Use the `file` command to know what type of file you are dealing with.
28 | - You can name files whatever you want in linux (even `.blahblah`).
29 | - Try not to confuse third party softwares.
--------------------------------------------------------------------------------
/02. Linux/03. Linux File System/03. Wildcards.md:
--------------------------------------------------------------------------------
1 | # Wildcards
2 | Wild cards are very useful tools that will make your commands a lot more precise a lot more expressive and a lot more powerful.
3 |
4 | We're going to learn about the most common types of wildcards.
5 |
6 | ## `*` (Asterisk)
7 | This can represent any number of characters (including zero, in other words, zero or more characters).
8 |
9 | For example, `ls` command will list the contents of every directory that we give it a valid path to.
10 |
11 | But what if we wanted to have a look at what's inside our documents folder our downloads folder and our Pictures folder at the same time?
12 |
13 | ```bash
14 | $user@computer-name:~$ ls Documents/ Downloads/
15 | Documents/:
16 | file1.txt file2.txt file3.txt
17 |
18 | Downloads/:
19 | file1.txt
20 | ```
21 |
22 | But you can see how manual of a process this was.
23 |
24 | Now wildcards are basically special symbols that the shell interprets to have a special meaning. The idea behind wildcards is to build up powerful patterns known as regular expressions so that instead of typing out every command line argument manually you can instead say something like hey linux make this command act on anything that matches this pattern.
25 |
26 | And then one of the most used wildcards is the asterisk or the star wildcard. **Star wildcard matches anything.**
27 | ```bash
28 | $user@computer-name:~$ ls D*
29 | Documents/:
30 | file1.txt file2.txt file3.txt
31 |
32 | Downloads/:
33 | file1.txt
34 | ```
35 | and `ls *` will match everything and will show the contents of all directories.
36 |
37 | **Note:** Wildcards are case sensitive. So `ls D*` and `ls d*` will have different results.
38 |
39 | If you want to list all text file:
40 | ```bash
41 | $user@computer-name:~$ ls *.txt
42 | file1.txt file2.txt file3.txt file4.txt file5.txt
43 | ```
44 |
45 | ## `?` (Question Mark)
46 | This can represent any single character. If you specified something at the command line like `hd?` GNU/Linux would look for `hda`, `hdb`, `hdc` and every other letter/number between `a-z`, `0-9`.
47 |
48 | ```bash
49 | $user@computer-name:~$ ls ???e.txt
50 | file1.txt file2.txt file3.txt file4.txt file5.txt
51 | ```
52 |
53 | ## `[]` (Square Brackets)
54 | Specifies a range. If you did `m[a,o,u]m` it can become: `mam`, `mum`, `mom` if you did: `m[a-d]m` it can become anything that starts and ends with `m` and has any character `a` to `d` inbetween. For example, these would work: `mam`, `mbm`, `mcm`, `mdm`. This kind of wildcard specifies an **or** relationship (you only need one to match).
55 |
56 | ```bash
57 | $user@computer-name:~$ ls file[1-3].txt
58 | file1.txt file2.txt file3.txt
59 | $user@computer-name:~$ ls file[245].txt
60 | file2.txt file4.txt file5.txt
61 | $user@computer-name:~$ ls file[0-9][0-9].txt
62 | file11.txt
63 | ```
64 |
65 | **Note:** You can have combinations of capital letters, numbers, etc. such as `file[a-zA-Z0-9].txt`
66 |
67 | ## `{}` (Curly Brackets)
68 | Terms are separated by commas and each term must be the name of something or a wildcard. This wildcard will copy anything that matches either wildcard(s), or exact name(s) (an `or` relationship, one or the other).
69 |
70 | For example, `ls {*.txt,*.png}` matches all files with either `.txt` or `.png` extension.
71 | ```bash
72 | $user@computer-name:~$ ls {*.txt,*.png}
73 | file1.txt file2.txt file3.txt file4.txt file5.txt image1.png image2.png image3.png
74 | ```
75 |
76 | ## `\` (backslash)
77 | Is used as an **escape** character, i.e. to protect a subsequent special character. Thus, `\\` searches for a backslash. Note you may need to use quotation marks and backslash(es).
78 |
79 | ## `[^]`
80 | This construct is similar to the [ ] construct, except rather than matching any characters inside the brackets, it'll match any character, as long as it is not listed between the [ and ]. This is a logical NOT. For example `rm myfile[^9]` will remove all `myfiles*` (ie. `myfiles1`, `myfiles2` etc) but won't remove a file with the number 9 anywhere within it's name.
81 |
82 | ```bash
83 | $user@computer-name:~$ ls file[^2].txt
84 | file1.txt file3.txt file4.txt file5.txt
85 | $user@computer-name:~$ ls file[^2-4].txt
86 | file1.txt file5.txt
87 | ```
88 |
89 | ## Summary
90 | - Wildcards are used to build patterns called "regular expression"
91 | - Anything that matches the pattern will be passed as a command line argument to a command.
92 | - Covered wildcards:
93 | - `*`
94 | - `?`
95 | - `[]`
96 | - `{}`
97 | - `[^]`
--------------------------------------------------------------------------------
/02. Linux/03. Linux File System/04. Creating Files and Directories.md:
--------------------------------------------------------------------------------
1 | # Creating Files and Directories
2 |
3 | You're going to learn how to use the `touch` and the `mkdir` are commands to create files and directories.
4 |
5 | ## `touch`
6 | `touch` command can create new empty files.
7 |
8 | ```bash
9 | $user@computer-name:~$ touch file1.txt
10 | $user@computer-name:~$ touch /home/user/file1.txt
11 | ```
12 |
13 | You can directly create file and put contents in it with `echo`:
14 | ```bash
15 | $user@computer-name:~$ echo "Hello World!" > hello.txt
16 | ```
17 |
18 | ## `mkdir`
19 | The `mkdir` command in Linux/Unix allows users to create or make new directories. `mkdir` stands for **make directory**
20 |
21 | ```bash
22 | $user@computer-name:~$ mkdir newfolder
23 | $user@computer-name:~$ touch /home/user/newfolder
24 | ```
25 |
26 | Let's say I wanted to create `dir1/dir2/dir3`. OK but I can't go ahead and make that in one go because it is going to give us an error and it's going to say that the folder doesn't exist.
27 |
28 | This is because the shell tried to go to `dir1` then `dir2`, and then create `dir3`.
29 |
30 | You can make this work by adding `-p` option:
31 | ```bash
32 | $user@computer-name:~$ mkdir -p dir1/dir2/dir3
33 | ```
34 |
35 | **Note:** Try to avoid having spaces in directory/file names. It is a nightmare in linux. Instead use `_`. If you insist on having spaces, use quotations:
36 | ```bash
37 | $user@computer-name:~$ mkdir "new folder"
38 | ```
39 |
40 | ## Brace Expansion
41 | Brace expansion is a mechanism by which arbitrary strings may be generated.
42 |
43 | So let's say that you're working on a big five year project and every month you need to write a 100 memo files to keep track of the project and the folder should be named something like _Jan 2017_, _FEB 2017_, _March 2017, and so on and so on for five years.
44 |
45 | How can you create those files and folders up front?
46 |
47 | Well doing it graphically would be horrific. There's actually just no way around it.
48 |
49 | We're going to use a powerful feature of the shell known as **Brace Expansion**.
50 |
51 | We create all these directories in `project` directory:
52 | ```bash
53 | $user@computer-name:~$ mkdir project
54 | $user@computer-name:~$ cd prject
55 | $user@computer-name:~$ mkdir {jan,feb,mar,apr,may,jun,july,aug,sep,oct,nov,dec}_{2017,2018,2019,2020,2021,2022}
56 | ```
57 |
58 | You can then create `file1.txt` to `file100.txt` in each directory.
59 | ```bash
60 | $user@computer-name:~$ touch {jan,feb,mar,apr,may,jun,july,aug,sep,oct,nov,dec}_{2017,2018,2019,2020,2021,2022}/file{1..100}.txt
61 | ```
62 |
63 | Brace expansion isn't only possible for the `touch` and `mkdir` commands. It's actually usable across the whole shelf.
64 | ```bash
65 | $user@computer-name:~$ ls {jan,feb,mar,apr,may,jun,july,aug,sep,oct,nov,dec}_{2017,2018}
66 | ```
67 |
--------------------------------------------------------------------------------
/02. Linux/03. Linux File System/05. Deleting File and Directories.md:
--------------------------------------------------------------------------------
1 | # Deleting File and Directories
2 |
3 | The way to actually delete or remove that file is using something called the `rm` command.
4 |
5 | ## Delete Files
6 | ```bash
7 | $user@computer-name:~$ rm file1.txt
8 | $user@computer-name:~$ rm file2.txt file2.txt /home/user/file3.txt
9 | $user@computer-name:~$ rm file*.txt # deletes with wildcard
10 | $user@computer-name:~$ rm *[2,3]* # deletes everything
11 | $user@computer-name:~$ rm *.png # deletes all .png files
12 | $user@computer-name:~$ rm * # deletes everything
13 | ```
14 |
15 | ## Delete Directories
16 | To delete directories, you have to add `-r` option:
17 | ```bash
18 | $user@computer-name:~$ rm dir1
19 | rm: cannot remove 'dir/': Is a directory
20 | $user@computer-name:~$ rm -r dir1
21 | ```
22 |
23 | ```bash
24 | $user@computer-name:~$ touch delme/deleteme{1,2,3}/file{1,2,3}
25 | $user@computer-name:~$ rm -r delme
26 | ```
27 |
28 | **Note:** To ask shell to prompt before every removal, add `-i` option.
29 | ```bash
30 | $user@computer-name:~$ touch delme/deleteme{1,2,3}/file{1,2,3}
31 | $user@computer-name:~$ rm -ri delme
32 | rm: descend into directory 'delme'?
33 | rm: descend into directory 'delme/deleteme1'?
34 | rm: remove directory 'delme/deleteme1/file1'?
35 | ...
36 | ```
37 |
38 | Fortunately there's another command that specialized for only removing directories that are empty now because this command only removes empty directories. This means that you can tell it to delete everything. It will only delete the folders that are actually empty. Which means you'll never delete a file accidentally.
39 |
40 | ```bash
41 | $user@computer-name:~$ rmdir delme
42 | rmdir: failed to remove 'delme': Directory not empty
43 | ```
44 |
45 | To remove everything inside `delme` that is empty directory:
46 | ```bash
47 | $user@computer-name:~$ rmdir delme/*
48 | rmdir: failed to remove 'delme': Directory not empty
49 | ```
50 |
51 | ## Summary
52 | - The `rm` command needs `-r` option to delete folders (Be careful!).
53 | - The `i` option will allow the `rm` command to be **interactive** when deleting.
54 | - The `rmdir` command will only delete folders that are empty.
55 |
--------------------------------------------------------------------------------
/02. Linux/03. Linux File System/06. Copying, Moving, Renaming.md:
--------------------------------------------------------------------------------
1 | # Copying, Moving, Renaming
2 |
3 | ## Copy
4 | The `cp` command which handles all the copying of files and folders in Linux with `cp source_file dest` for files and `cp source_dir dest_dir` for directories.
5 |
6 | ```bash
7 | $user@computer-name:~$ cp file1.txt /home/user/file_1_copy.txt
8 | $user@computer-name:~$ cp -r dir_1 dir_1_copy
9 | ```
10 |
11 | ## Rename
12 | ```bash
13 | $user@computer-name:~$ mv file1.txt file_renamed.txt
14 | ```
15 |
16 | ## Move
17 | ```bash
18 | $user@computer-name:~$ mv file1.txt dest
19 | ```
20 |
21 | For directories, add `-r` option:
22 | ```bash
23 | $user@computer-name:~$ mv -r dir dir_renamed
24 | $user@computer-name:~$ mv -r dir dest/dir
25 | ```
26 |
27 | You can use wildcards:
28 | Move everything in `dir` to desktop:
29 | ```bash
30 | $user@computer-name:~$ mv -r dir/* /home/user/Desktop
31 | ```
32 |
33 | ## Summary
34 | - `cp `
35 | - `mv `
36 | - `mv `
37 | - **Create** using `touch` and `mkdir` commands.
38 | - **Delete** using the `rm` and `rmdir` commands.
39 | - **Copy** using the `cp` command.
40 | - **Move** and Rename using the `mv` command.
--------------------------------------------------------------------------------
/02. Linux/03. Linux File System/07. Nano Editor.md:
--------------------------------------------------------------------------------
1 | # Nano Editor
2 |
3 | When getting used to the command-line, Linux novices are often put off by other, more advanced text editors such as vim and emacs. While they are excellent programs, they do have a bit of a learning curve. Enter Nano, an easy-to-use text editor that proves itself versatile and simple. Nano is installed by default in Ubuntu and many other Linux distros and works well in conjunction with sudo, which is why we love it so much.
4 |
5 | ## Running Nano
6 | ```bash
7 | nano diary.txt
8 | ```
9 |
10 | You'll notice that our terminal has changed its look and we're actually now editing a file called diry that takes tape as you can see at the top.
11 |
12 | Down the bottom you can see that there's actually a little toolbar that tells you some of the things that you can do in nano and the options are in the white squares and then in the form of keyboard shortcuts. Hit **Ctrl+G** to bring up the Help documentation and scroll down to see a list of valid shortcuts. When you’re done looking at the list, hit **Ctrl+X** to exit help.
13 |
14 |
15 |
16 | In nano The little arrowhead that you see here the little hat or the carrot symbol means the control key on your keyboard.
17 |
18 | - **Write Out**: Save the file (press enter afterwards).
19 | - **Read File**: Insert another file content.
20 | - **Where Is**: Search in the file.
21 |
22 | If we had down to the bottom of the files if we shift down here and use `control + W` again you can see down the bottom that there are actually other options that pop up as well.
23 |
24 | ## Copying, Cutting, and Pasting
25 | Now some of these options begin with the the carrot symbol the heart which means the control key but some start with this `M-` which stands for modify and this is usually the alt key on your keyboard. For example **M-C**: **Alt+C** is to change case-sensitive for searching.
26 |
27 | - **Replace**: Replace words or phrases with something else.
28 | - **Cut**: You can cut a part of text that is highlighted.
29 | - **Paste Text**
30 |
31 | If you want to remove an entire line of text, simply hit Ctrl+K without highlighting anything. This sometimes comes in handy when editing configuration files.
32 |
33 | ## Quit
34 |
35 | When you want to quit nano, you just hit **Ctrl+X**. Nano will politely ask you if you want to save your buffer, and you can cancel this action as well.
36 |
37 | **Notes:**
38 |
39 | - `Ctrl+z` sends the program to the background. Use `fg %num` to bring job number `num` back to the foreground.
40 | - To show line numbers, use `nano diary.txt -l`.
41 |
42 |
43 |
44 |
45 |
46 | ## Summary
47 | - nano is a command line based text editor.
48 | - `^`: Ctrl
49 | - `M-`: Alt, Esc, or cmd (depending on your layout)
50 | - nano's configuration file is `/etc/nanorc`
51 |
--------------------------------------------------------------------------------
/02. Linux/03. Linux File System/09. Viewing Files.md:
--------------------------------------------------------------------------------
1 | # Viewing Files
2 |
3 | Linux provides a number of commands for viewing files. In this tutorial, we’ll look at the most commonly used `cat`, `more` and `less` commands.
4 |
5 | ## `cat`
6 | The cat command is the simplest way to view the contents of a file. It displays the contents of the file(s) specified on to the output terminal.
7 |
8 | ```bash
9 | cat file.txt
10 | ```
11 | Sometimes, we might want to number the lines in the output.
12 |
13 | We can do this by using the -n option:
14 | ```
15 | cat -n file.txt
16 | ```
17 |
18 | You can concatenate many files and display them:
19 | ```bash
20 | cat file_1.txt file_2.txt
21 | ```
22 |
23 | ## `tac` and `rev`
24 | `tac` is the reverse version of `cat` horizontally (linewise) meaning that the last line will be displayed first and the first line last.
25 | ```bash
26 | tac file.txt
27 | ```
28 |
29 | `rev` is the reverse version of `cat` vertically (characterwise) meaning that the last character will be displayed first and the first character last.
30 | ```bash
31 | tac file.txt
32 | ```
33 |
34 |
35 |
36 | ## `more`
37 | The `cat` command is all well and good for small files. But, if the file is large, the contents will zoom past and we’ll only see the last screen worth of content.
38 |
39 | The `more` command displays the contents of the file one screen at a time for large files. If the contents of the file fit a single screen, the output will be the same as the `cat` command.
40 |
41 | ```
42 | more large-file.txt
43 | ```
44 | The cursor will stay at the end of this text. Then, we can scroll through the contents of the file using the **Enter** key, one line at a time.
45 |
46 | We can also scroll through the file page by page by using the **Space bar**. And to scroll back to the previous page, we can use the b key. We’ll use the `q` key to go back to the command prompt.
47 |
48 | The more command can also be used to view multiple files. We just have to list each of them one after another:
49 |
50 | ```bash
51 | more file.txt large-file.txt
52 | ```
53 |
54 | Along with files, we can also pipe the more command with the output of other commands:
55 | ```bash
56 | find . | more
57 | ls -l | more
58 | ```
59 |
60 | Let’s suppose we want to view only a certain number of lines at a time. We can do this by specifying the number of lines as an option:
61 |
62 | ```bash
63 | more -5 large-file.txt
64 | ```
65 | This will display the first 5 lines of the file instead of a screen worth of content.
66 |
67 | We can also specify the line number in the file from where we want to start viewing the content:
68 | ```bash
69 | more +5 file.txt
70 | ```
71 |
72 | ## `less`
73 | Now, let’s move to the less command. The less command is similar to the more command but provides extensive features. Since it does not read the entire file before starting, it starts up faster compared to text editors — especially when we’re viewing large files.
74 |
75 | ```bash
76 | less file.txt
77 | ```
78 |
79 | Read more: [more-vs-less](More and Less Differences)
80 |
81 | ## `head` and `tail`
82 | As their names imply, the `head` command will output the first part of the file, while the `tail` command will print the last part of the file. Both commands write the result to standard output.
83 |
84 | ```bash
85 | head file.txt
86 | tail file.txt
87 | ```
88 | With the `-n` option, we can let the head command output the first `n` lines instead of the default `10`.
89 | ```bash
90 | # first 3 lines
91 | head -n 3 file.txt
92 |
93 | # last 3 lines
94 | head -n -3 file.txt
95 |
96 | # last 3 lines
97 | tail -n -3 file.txt
98 | tail -n 3 file.txt
99 | ```
100 |
101 | Use the head and the tail Together to show lines 5, 6, and 7.
102 | ```bash
103 | head -n 7 file.txt | tail -n 3
104 | ```
105 |
106 | ## Sorting Data
107 | Sort file alphabetically
108 | ```bash
109 | sort file.txt
110 |
111 | # reverse sort
112 | sort -r file.txt
113 | sort file.txt | tac
114 | ```
115 |
116 | Sort file numerically:
117 | ```bash
118 | sort -n file.txt
119 | sort -nr file.txt
120 | ```
121 |
122 | Sort and get unique results only:
123 | ```bash
124 | sort -u file.txt
125 | sort -nu file.txt
126 | ```
127 |
128 | ### Sort by the Column
129 | You can sort tabular data using the `-k` option:
130 | ```bash
131 | # sort the second column alphabeticall
132 | ls -l | sort -k 2
133 |
134 | # sort the second column numerically
135 | ls -l | sort -k 2n
136 |
137 | # sort the second column numerically but in reverse order
138 | ls -l | sort -k 2nr
139 |
140 | # sort the fifth column in human readable format
141 | ls -l | sort -k 5h
142 |
143 | # sort by month
144 | ls -lh / | sort -k 6M
145 | ```
146 |
147 | **Note:**
148 | - 2nr means sort using column `3` and use the `-n` and `-r` options.
149 | - To sort human-readable data use the `-h` option not `-n`.
150 | - To sort month data use the `-M` option.
151 |
--------------------------------------------------------------------------------
/02. Linux/04. Bash Shell Scripting/01. Introduction.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | ## Definition
4 |
5 | - Bash
6 |
7 | Bash is a command language interpreter. It is widely available on various operating systems and is a default command interpreter on most GNU/Linux systems. The name is an acronym for the ‘Bourne-Again SHell’.
8 |
9 | - Shell
10 |
11 | Shell is a macro processor which allows for an interactive or non-interactive command execution.
12 |
13 | - Scripting
14 |
15 | Scripting allows for an automatic commands execution that would otherwise be executed interactively one-by-one.
16 |
17 | ## Bash Shell Script Basics
18 |
19 | ### What is Shell
20 |
21 | Most likely, your are at the moment sitting in front of your computer, have a terminal window opened and wondering: "What should I do with this thing?"
22 |
23 | Well, the terminal window in front of you contains shell, and shell allows you by use of commands to interact with your computer, hence retrieve or store data, process information and various other simple or even extremely complex tasks.
24 |
25 | Try it now! Use your keyboard and type some commands such as date, cal, pwd or ls followed by the `ENTER` key.
26 |
27 | What you have just done, was that by use of commands and shell you interacted with your computer to retrieve a current date and time (`date`), looked up a calendar (`cal`), checked the location of your current working directory (`pwd`) and retrieved a list of all files and directories located within (`ls`).
28 |
29 | ### What is Scripting
30 |
31 | Now, imagine that the execution of all the above commands is your daily task. Every day you are required to execute all of the above commands without fail as well as store the observed information. Soon enough this will become an extremely tedious task destined for failure. Thus the obvious notion is to think of some way to execute all given commands together. This is where scripting becomes your salvation.
32 |
33 | To see what is meant by scripting, use shell in combination with your favorite text editor eg. `vi` to create a new file called `task.sh` containing all the above commands, each on a separate line. Once ready, make your new file executable using chmod command with an option `+x`. Lastly, execute your new script by prefixing its name with `./`.
34 |
35 | As you can see, by use of scripting, any shell interaction can be automated and scripted. Furthermore, it is now possible to automatically execute our new shell script `task.sh` daily at any given time by use of cron time-based job scheduler and store the script's output to a file every time it is executed. However, this is a tale for an another day, for now let's just concentrate on a task ahead.
36 |
37 | ### What is Bash
38 |
39 | So far we have covered shell and scripting. What about Bash? Where does the bash fit in? As already mentioned, the bash is a default interpreter on many GNU/Linux systems, thus we have been using it even without realising. This is why our previous shell script works even without us defining bash as an interpreter. To see what is your default interpreter execute command `echo $SHELL`:
40 |
41 | ```bash
42 | $ echo $SHELL
43 | /bin/bash
44 | ```
45 |
46 | There are various other shell interpreters available, such as Korn shell, C shell and more. From this reason, it is a good practice to define the shell interpreter to be used explicitly to interpret the script's content.
47 |
48 | To define your script's interpreter as Bash, first locate a full path to its executable binary using `which` command, prefix it with a [shebang](https://en.wikipedia.org/wiki/Shebang_%28Unix%29) `#!` and insert it as the first line of your script. There are various other techniques how to define shell interpreter, but this is a solid start.
49 |
50 | From now, all our scripts will include shell interpreter definition #!/bin/bash.
51 |
--------------------------------------------------------------------------------
/02. Linux/04. Bash Shell Scripting/02. Script Execution.md:
--------------------------------------------------------------------------------
1 | # Script Execution
2 |
3 | Next, let's talk about an alternative way on how to run bash scripts. In a highly simplistic view, a bash script is nothing else just a text file containing instructions to be executed in order from top to bottom. How the instructions are interpreted depends on defined shebang or the way the script is executed.
4 |
5 | Another way to execute bash scripts is to call bash interpreter explicitly eg. `$ bash date.sh`, hence executing the script without the need to make the shell script executable and without declaring shebang directly within a shell script. By calling bash executable binary explicitly, the content of our file `date.sh` is loaded and interpreted as Bash Shell Script.
6 |
7 | ## Hello World Bash Shell Script
8 |
9 | Now, it is time to write our first, most basic bash shell script. The whole purpose of this script is nothing else but print "Hello World" using `echo` command to the terminal output. Using any text editor create a new file named `hello-world.sh` containing the below code:
10 |
11 | ```bash
12 | #!/bin/bash
13 |
14 | echo "Hello World"
15 | ```
16 |
17 | Once ready, make your script executable with thechmod command and execute it using relative path `./hello-world.sh`:
18 |
19 | ```bash
20 | $ chmod +x hello-world.sh
21 | $ linuxconfig.org:~$ ./hello-world.sh
22 | Hello World
23 | ```
24 |
25 | ## Simple Backup Bash Shell Script
26 | Let's discuss a command line execution and how GNU/Linux commands fit into the shell script creation process in more detail.
27 |
28 | Any command which can be successfully executed directly via bash shell terminal can be in the same form used as part of bash shell script. In fact, there is no difference between command execution directly via terminal or within a shell script apart from the fact that the shell script offers non-interactive execution of multiple commands as a single process.
29 |
30 | The next example offers more practical application as it can be used to backup our user home directory. To create the backup script, we will be using `tar` command with various options `-czf` in order to create a compressed tar ball of entire user home directory `/home/linuxconfig/`. Insert the following code into a new file called `backup.sh`, make the script executable and run it:
31 |
32 | ```bash
33 | #!/bin/bash
34 |
35 | tar -czf /tmp/myhome_directory.tar.gz /home/linuxconfig
36 | ```
--------------------------------------------------------------------------------
/02. Linux/04. Bash Shell Scripting/03. Variables.md:
--------------------------------------------------------------------------------
1 | # Variables
2 |
3 | Variables are the essence of programming. Variables allow a programmer to store data, alter and reuse them throughout the script. Create a new script `welcome.sh` with the following content:
4 |
5 | ```bash
6 | #!/bin/bash
7 |
8 | greeting="Welcome"
9 | user=$(whoami)
10 | day=$(date +%A)
11 |
12 | echo "$greeting back $user! Today is $day, which is the best day of the entire week!"
13 | echo "Your Bash shell version is: $BASH_VERSION. Enjoy!"
14 | ```
15 |
16 | By now you should possess all required skills needed to create a new script, making it executable and running it on the command line. After running the above welcome.sh script, you will see an output similar to the one below:
17 |
18 | ```bash
19 | $ ./welcome.sh
20 | Welcome back linuxconfig! Today is Wednesday, which is the best day of the entire week!
21 | Your Bash shell version is: 4.4.12(1)-release. Enjoy!
22 | ```
23 |
24 | Let's look at the script more closely. First, we have declared a variable `greeting` and assigned a string value `Welcome` to it. The next variable `user` contains a value of user name running a shell session. This is done through a technique called command substitution. Meaning that the output of the `whoami` command will be directly assigned to the user variable. The same goes for our next variable `day` which holds a name of today's day produced by `date +%A` command.
25 |
26 | The second part of the script utilises the `echo` command to print a message while substituting variable names now prefixed by `$` sign with their relevant values. In case you wonder about the last variable used `$BASH_VERSION` know that this is a so called internal variable defined as part of your shell.
27 |
28 | **Note:** Never name your private variables using UPPERCASE characters. This is because uppercase variable names are reserved for internal shell variables, and you run a risk of overwriting them. This may lead to the dysfunctional or misbehaving script execution.
29 |
30 | Variables can also be used directly on the terminal's command line. The following example declares variables `a` and `b` with integer data. Using `echo` command, we can print their values or even perform an arithmetic operation as illustrated by the following example:
31 |
32 | ```bash
33 | a=4
34 | b=8
35 | echo $a
36 | echo $b
37 | echo $[$a + $b]
38 | ```
39 |
40 | Now that we have bash variable introduction behind us we can update our backup script to produce more meaningful output file name by incorporating a date and time when the backup on our home directory was actually performed.
41 |
42 | Furthermore, the script will no longer be bind to a specific user. From now on our `backup.sh` bash script can be run by any user while still backing up a correct user home directory:
43 |
44 | ```bash
45 | #!/bin/bash
46 |
47 | # This bash script is used to backup a user's home directory to /tmp/.
48 |
49 | user=$(whoami)
50 | input=/home/$user
51 | output=/tmp/${user}_home_$(date +%Y-%m-%d_%H%M%S).tar.gz
52 |
53 | tar -czf $output $input
54 | echo "Backup of $input completed! Details about the output backup file:"
55 | ls -l $output
56 | ```
57 |
58 | You may have already noticed that the above script introduces two new bash scripting concepts. Firstly, our new `backup.sh` script contains comment line. Every line starting with # sign except shebang will not be interpreted by bash and will only serve as a programmer's internal note.
59 |
60 | Secondly, the script uses a new shell scripting trick `${parameter}` called parameter expansion. In our case, curly braces `{}` are required because our variable `$user` is followed by characters which are not part of its variable name.
61 |
62 |
--------------------------------------------------------------------------------
/02. Linux/04. Bash Shell Scripting/04. Redirection.md:
--------------------------------------------------------------------------------
1 | # Input, Output and Error Redirections
2 |
3 | Normally commands executed on GNU/Linux command line either produce output, require input or throw an error message. This is a fundamental concept for shell scripting as well as for working with GNU/Linux's command line in general.
4 |
5 | Every time, you execute a command, three possible outcomes might happen. The first scenario is that the command will produce an expected output, second, the command will generate an error, and lastly, your command might not produce any output at all.
6 |
7 | Back to our `backup.sh` script. When executing our backup script, you may have noticed an extra message display by tar command:
8 |
9 | ```bash
10 | tar: Removing leading `/' from member names
11 | ```
12 |
13 | Despite the message's informative nature, it is sent to **stderr** descriptor. In a nutshell, the message is telling us that the absolute path has been removed thus extraction of the compressed file not overwrite any existing files.
14 |
15 | Now that we have a basic understanding of the output redirection we can eliminate this unwanted **stderr** message by redirecting it with `2>` notation to `/dev/null`. Imagine `/dev/null` as a data sink, which discards any data redirected to it. For more information run `man null`. Below is our new `backup.sh` version including tar's **stderr** redirection:
16 |
17 | ```bash
18 | #!/bin/bash
19 |
20 | # This bash script is used to backup a user's home directory to /tmp/.
21 |
22 | user=$(whoami)
23 | input=/home/$user
24 | output=/tmp/${user}_home_$(date +%Y-%m-%d_%H%M%S).tar.gz
25 |
26 | tar -czf $output $input 2> /dev/null
27 | echo "Backup of $input completed! Details about the output backup file:"
28 | ls -l $output
29 | ```
30 |
31 | After executing a new version of our backup.sh script, no tar stderr message will be displayed.
32 |
33 |
--------------------------------------------------------------------------------
/02. Linux/04. Bash Shell Scripting/05. Functions.md:
--------------------------------------------------------------------------------
1 | # Functions
2 |
3 | It is possible to avoid using functions and write any script without including a single function in it. However, you are likely to end up with a chunky, inefficient and hard to troubleshoot code.
4 |
5 | You can think of the function as a way to the group number of different commands into a single command. This can be extremely useful if the output or calculation you require consists of multiple commands, and it will be expected multiple times throughout the script execution. Functions are defined by using the function keyword and followed by function body enclosed by curly brackets.
6 |
7 | The syntax for declaring a bash function is straightforward. Functions may be declared in two different formats:
8 |
9 | 1. The first format starts with the function name, followed by parentheses. This is the preferred and more used format.
10 | ```bash
11 | function_name () {
12 | commands
13 | }
14 | ```
15 |
16 | Single line version:
17 | ```bash
18 | function_name () { commands; }
19 | ```
20 |
21 | 2. The second format starts with the reserved word `function`, followed by the function name.
22 |
23 | ```bash
24 | function function_name {
25 | commands
26 | }
27 | ```
28 |
29 | Single line version:
30 | ```bash
31 | function function_name { commands; }
32 | ```
33 |
34 | - The commands between the curly braces (`{}`) are called the body of the function. The curly braces must be separated from the body by spaces or newlines.
35 | - Defining a function doesn’t execute it. To invoke a bash function, simply use the function name. Commands between the curly braces are executed whenever the function is called in the shell script.
36 | - The function definition must be placed before any calls to the function.
37 | - When using single line “compacted” functions, a semicolon `;` must follow the last command in the function.
38 | - Always try to keep your function names descriptive.
39 |
40 | ## Function with Input
41 | To call a function with arguments:
42 |
43 | ```bash
44 | function_name "$arg1" "$arg2"
45 | ```
46 |
47 | The function refers to passed arguments by their position (not by name), that is $1, $2, and so forth. $0 is the name of the script itself.
48 |
49 | ```bash
50 | foo 1 # this will fail because foo has not been declared yet.
51 |
52 | foo() {
53 | echo "Parameter #1 is $1"
54 | }
55 |
56 | foo 2 # this will work.
57 | ```
58 |
59 | ## Return Output
60 | Bash functions, unlike functions in most programming languages do not allow you to return a value to the caller. When a bash function ends its return value is its status: zero for success, non-zero for failure. To return values, you can set a global variable with the result, or use command substitution, or you can pass in the name of a variable to use as the result variable. The examples below describe these different mechanisms.
61 |
62 | 1. The simplest way to return a value from a bash function is to just set a global variable to the result. Since all variables in bash are global by default this is easy:
63 |
64 | ```bash
65 | function myfunc()
66 | {
67 | myresult='some value'
68 | }
69 |
70 | myfunc
71 | echo $myresult
72 | ```
73 | The code above sets the global variable myresult to the function result. Reasonably simple, but as we all know, using global variables, particularly in large programs, can lead to difficult to find bugs.
74 |
75 | 2. A better approach is to use local variables in your functions. The problem then becomes how do you get the result to the caller. One mechanism is to use command substitution:
76 |
77 | ```bash
78 | function myfunc()
79 | {
80 | local myresult='some value'
81 | echo "$myresult"
82 | }
83 |
84 | result=$(myfunc) # or result=`myfunc`
85 | echo $result
86 | ```
87 | Here the result is output to the stdout and the caller uses command substitution to capture the value in a variable. The variable can then be used as needed.
88 |
89 | ```bash
90 | function myfunc()
91 | {
92 | local __resultvar=$1
93 | local myresult='some value'
94 | eval $__resultvar="'$myresult'"
95 | }
96 |
97 | myfunc result
98 | echo $result
99 | ```
100 |
101 | ## Example
102 | The following example defines a simple shell function to be used to print user details and will make two function calls, thus printing user details twice upon a script execution.
103 |
104 | The function name is `user_details`, and function body enclosed inside curly brackets consists of the group of two `echo` commands. Every time a function call is made by using the function name, both `echo` commands within our function definition are executed. It is important to point out that the function definition must precede function call, otherwise the script will return `function not found` error:
105 |
106 | ```bash
107 | #!/bin/bash
108 |
109 | funciton user_detail {
110 | echo "User Name: $(whoami)"
111 | echo "Home Directory: $HOME"
112 | }
113 | ```
114 |
115 | As illustrated by the above video example the `user_details` function grouped multiple commands in a single new command `user_details`.
116 |
117 | The `echo` commands within the `user_details` function definition were deliberately shifted one TAB right which makes our code more readable, easier to troubleshot.
118 |
119 |
120 |
--------------------------------------------------------------------------------
/02. Linux/04. Bash Shell Scripting/06. Comparison.md:
--------------------------------------------------------------------------------
1 | # Comparison
2 |
3 | In this section, we are going to learn some basics of numeric and string bash shell comparisons. Using comparisons, we can compare strings ( words, sentences ) or integer numbers whether raw or as variables. The following table lists rudimentary comparison operators for both numbers and strings:
4 |
5 | |Description|Numeric Comparison|String Comparison|
6 | |:--|:--|:--|
7 | |less than|`-lt`|`<`|
8 | |greater than|`-gt`|`>`|
9 | |equal|`-eq`|`=`|
10 | |not equal|`-ne`|`!=`|
11 | |less or equal|`-le`|N/A|
12 | |greater or equal|`-ge`|N/A|
13 |
14 | Next, we use square brackets and numeric comparison operators to perform the actual evaluation. Using echo $? command, we check for a return value of the previously executed evaluation. There or two possible outcomes for every evaluation, true or false. If the return value is equal to 0, then the comparison evaluation is true. However, if the return value is equal to 1, the evaluation resulted as false.
15 |
16 | ```bash
17 | string_a="UNIX"
18 | string_b="GNU"
19 |
20 | echo "Are $string_a and $string_b strings equal?"
21 | [ $string_a = $string_b ]
22 | echo $?
23 |
24 | num_a=100
25 | num_b=100
26 |
27 | echo "Is $num_a equal to $num_b ?"
28 | [ $num_a -eq $num_b ]
29 | echo $?
30 | ```
31 |
32 | Apart from the educational value, the above script does not serve any other purpose. Comparisons operations will make more sense once we learn about conditional statements like `if/else`. Conditional statements will be covered in the next chapter, and this is where we put comparison operations to better use.
33 |
--------------------------------------------------------------------------------
/02. Linux/04. Bash Shell Scripting/07. Conditional Statement.md:
--------------------------------------------------------------------------------
1 | # Conditional Statement
2 |
3 | Now, it is time to give our backup script some logic by including few conditional statements. Conditionals allow the programmer to implement decision making within a shell script based on certain conditions or events.
4 |
5 | The conditionals we are referring to are of course, `if`, `then` and `else`. For example, we can improve our backup script by implementing a sanity check to compare the number of files and directories within a source directory we intend to backup and the resulting backup file. The pseudocode for this kind of implementation will read as follows:
6 |
7 | Let's start by creating a simple bash script depicting a basic `if/then/else` construct.
8 |
9 | ```bash
10 | #!/bin/bash
11 |
12 | num_a=100
13 | num_b=200
14 |
15 | if [ $num_a -lt $num_b ]; then
16 | echo "$num_a is less than $num_b!"
17 | fi
18 | ```
19 |
20 | For now the `else` conditional was deliberately left out, we will include it once we understand the logic behind the above script. Save the script as, eg. `if_else.sh` and execute it:
21 |
22 | Lines 3-4 are used to initialize an integer variables. On Line 6 we begin an if conditional block. We further compare both variables and if the comparison evaluation yields true, then on Line 7 the echo command will inform us, that the value within the variable `$num_a` is less when compared with the variable `$num_b`. Lines 8 closes our `if` conditional block with a `fi` keyword.
23 |
24 | The important observation to make from the script execution is that, in the situation when the variable `$num_a` greater than `$num_b` our script fails to react. This is where the last piece of the puzzle, `else` conditional comes in handy. Update your script by adding else block and execute it:
25 |
26 | ```bash
27 | #!/bin/bash
28 |
29 | num_a=400
30 | num_b=200
31 |
32 | if [ $num_a -lt $num_b ]; then
33 | echo "$num_a is less than $num_b!"
34 | else
35 | echo "$num_a is greater than $num_b!"
36 | fi
37 | ```
38 | The Line 8 now holds the `else` part of our conditional block. If the comparison evaluation on Line 6 reports `false` the code below `else` statement, in our case Line 9 is executed.
39 |
40 |
--------------------------------------------------------------------------------
/02. Linux/04. Bash Shell Scripting/08. Loops.md:
--------------------------------------------------------------------------------
1 | # Loops
2 |
3 | So far our backup script functions as expected and its usability has been substantially increased in comparison with the initial code introduced at the beginning of this scripting tutorial. We can now easily backup any user directory by pointing the script to user's home directory using positional parameters during the script's execution.
4 |
5 | The trouble only arises when we need to backup multiple user directories on a daily basis. Hence this task will very quickly become tedious and time-consuming. At this stage, it would be great to have the means to backup any number of selected user home directories with a single backup.sh script execution.
6 |
7 | Fortunately, bash has us covered, as this task can be accomplished by use of loops. Loops are looping constructs used to iterate through any given number of tasks until all items in a specified list were completed or predefined conditions were met. There are three basic loop types available to our disposal.
8 |
9 | ## For Loop
10 |
11 | For loop is used to iterate through any given code for any number of supplied items in the list. Let's start with a simple for loop example:
12 |
13 | ```bash
14 | for i in 1 2 3; do echo $i; done
15 | ```
16 |
17 | The above for loop has used the echo command to print all items 1, 2 and 3 in the list. Using a semicolon allows us to execute for loop on a single command line. If we were to transfer the above for loop into a bash script, the code would look like follows:
18 |
19 | ```bash
20 | #!/bin/bash
21 |
22 | for i in 1 2 3; do
23 | echo $i
24 | done
25 | ```
26 |
27 | The for loop consists of four Shell Reserved Words: `for`, `in`, `do`, `done`. The above code can therefore also be read as: FOReach item INlist 1, 2 and 3 assign each item temporarily into a variable `i` after which DO `echo $i` in order to print the item as `STDOUT` and keep printing until all items INthe list are DONE.
28 |
29 | Printing numbers is undoubtedly fun but let's try something more meaningful instead. Using command substitution as explained earlier in this tutorial we can create any kind of list to be a part of for loop construct. The following slightly more sophisticated for loop example will count characters of each line for any given file:
30 |
31 | ```bash
32 | for i in $(cat items.txt); do
33 | echo -n $i | wc -c;
34 | done
35 | ```
36 |
37 | ## While Loop
38 |
39 | he next loop construct on our list is while loop. This particular loop acts on a given condition. Meaning, it will keep executing code enclosed withing DOand DONEwhile the specified condition is true. Once the specified condition becomes false, the execution will stop. Consider the following example:
40 |
41 | ```bash
42 | #!/bin/bash
43 | counter=0
44 | while [ $counter -lt 3 ]; do
45 | let counter+=1
46 | echo $counter
47 | done
48 | ```
49 |
--------------------------------------------------------------------------------
/02. Linux/basckup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | user=$(whoami)
4 | # input=/home/$user
5 | input="/mnt/c/Users/hejaz/OneDrive/Desktop/CS-Tutorial/Linux/images"
6 | output=/tmp/${user}_home_$(date +%Y-%m-%d_%H%M%S).tar.gz
7 |
8 | function total_files {
9 | find $1 -type f | wc -l
10 | }
11 |
12 | function total_directories {
13 | find $1 -type d | wc -l
14 | }
15 |
16 | function total_archived_directories {
17 | tar -tzf $1 | grep /$ | wc -l
18 | }
19 |
20 | function total_archived_files {
21 | tar -tzf $1 | grep -v /$ | wc -l
22 | }
23 |
24 | tar -czf $output $input 2> /dev/null
25 |
26 | src_files=$( total_files $input )
27 | src_directories=$( total_directories $input )
28 |
29 | arch_files=$( total_archived_files $output )
30 | arch_directories=$( total_archived_directories $output )
31 |
32 | echo "Files to be included: $src_files"
33 | echo "Directories to be included: $src_directories"
34 | echo "Files archived: $arch_files"
35 | echo "Directories archived: $arch_directories"
36 |
37 | if [ $src_files -eq $arch_files ]; then
38 | echo "Backup of $input completed!"
39 | echo "Details about the output backup file:"
40 | ls -l $output
41 | else
42 | echo "Backup of $input failed!"
43 | fi
--------------------------------------------------------------------------------
/02. Linux/hello.sh:
--------------------------------------------------------------------------------
1 | #! /usr/bin/bash
2 |
3 | echo "hello world!"
--------------------------------------------------------------------------------
/02. Linux/images/alias.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/alias.png
--------------------------------------------------------------------------------
/02. Linux/images/command_in_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/command_in_out.png
--------------------------------------------------------------------------------
/02. Linux/images/egrep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/egrep.png
--------------------------------------------------------------------------------
/02. Linux/images/fdfind.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/fdfind.png
--------------------------------------------------------------------------------
/02. Linux/images/fgrep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/fgrep.png
--------------------------------------------------------------------------------
/02. Linux/images/file-permissions-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/file-permissions-2.gif
--------------------------------------------------------------------------------
/02. Linux/images/file-permissions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/file-permissions.png
--------------------------------------------------------------------------------
/02. Linux/images/grep-escape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/grep-escape.png
--------------------------------------------------------------------------------
/02. Linux/images/grep-r-h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/grep-r-h.png
--------------------------------------------------------------------------------
/02. Linux/images/grep-r.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/grep-r.png
--------------------------------------------------------------------------------
/02. Linux/images/locate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/locate.png
--------------------------------------------------------------------------------
/02. Linux/images/ls-l.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/ls-l.jpg
--------------------------------------------------------------------------------
/02. Linux/images/nano-l.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/nano-l.png
--------------------------------------------------------------------------------
/02. Linux/images/nano.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/nano.png
--------------------------------------------------------------------------------
/02. Linux/images/tar-gzip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/tar-gzip.png
--------------------------------------------------------------------------------
/02. Linux/images/tee.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/02. Linux/images/tee.png
--------------------------------------------------------------------------------
/02. Linux/variable.sh:
--------------------------------------------------------------------------------
1 | a=4
2 | b=8
3 | echo $a
4 | echo $b
5 | echo $[$a + $b]
6 |
--------------------------------------------------------------------------------
/02. Linux/welcome.sh:
--------------------------------------------------------------------------------
1 | greeting="Welcome"
2 | user=$(whoami)
3 | day=$(date +%A)
4 |
5 | echo "$greeting back $user! Today is $day, which is the best day of the entire week!"
6 | echo "Your Bash shell version is: $BASH_VERSION. Enjoy!"
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/01- BIG-O.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# 01- Big-O"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "## Table of Contents:\n",
15 | "* [1. Time Complexity](#time-complexity)\n",
16 | " * [1. File Transfer Program](#file-transfer-problem)\n",
17 | " * [1. Common Big-Os](#common-big-o)\n",
18 | " * [1. Examples](#examples)\n",
19 | "* [2. Space Complexity](#space-complexity)"
20 | ]
21 | },
22 | {
23 | "cell_type": "markdown",
24 | "metadata": {},
25 | "source": [
26 | "\n",
27 | "## 1. Time Complexity"
28 | ]
29 | },
30 | {
31 | "cell_type": "markdown",
32 | "metadata": {},
33 | "source": [
34 | "\n",
35 | "### 1.1 File Transfer Problem\n",
36 | "**How to transfer a file?**\n",
37 | "1. plane: O(1)\n",
38 | "2. email: O(s)"
39 | ]
40 | },
41 | {
42 | "cell_type": "markdown",
43 | "metadata": {},
44 | "source": [
45 | "\n",
46 | "### 1.2 Common Big-Os\n",
47 | "- O(1)\n",
48 | "- O(Log N)\n",
49 | "- O(N)\n",
50 | "- O(N Log N)\n",
51 | "- O(N^2)\n",
52 | "- O(2^N)"
53 | ]
54 | },
55 | {
56 | "cell_type": "markdown",
57 | "metadata": {},
58 | "source": [
59 | "\n",
60 | "### 1.3 Examples"
61 | ]
62 | },
63 | {
64 | "cell_type": "markdown",
65 | "metadata": {},
66 | "source": [
67 | "```python\n",
68 | "for i in range(n):\n",
69 | " for j in range(n):\n",
70 | " # O(1) operation here\n",
71 | "```"
72 | ]
73 | },
74 | {
75 | "cell_type": "markdown",
76 | "metadata": {},
77 | "source": [
78 | "```python\n",
79 | "for i in range(n):\n",
80 | " for j in range(m):\n",
81 | " # O(1) operation here\n",
82 | "```"
83 | ]
84 | },
85 | {
86 | "cell_type": "markdown",
87 | "metadata": {},
88 | "source": [
89 | "**Linear Search**\n",
90 | "```python\n",
91 | "for item in mylist:\n",
92 | " if item == \"target\":\n",
93 | " print(\"found it\")\n",
94 | "```"
95 | ]
96 | },
97 | {
98 | "cell_type": "markdown",
99 | "metadata": {},
100 | "source": [
101 | "**Binary Search**"
102 | ]
103 | },
104 | {
105 | "cell_type": "markdown",
106 | "metadata": {},
107 | "source": [
108 | ""
109 | ]
110 | },
111 | {
112 | "cell_type": "markdown",
113 | "metadata": {},
114 | "source": [
115 | ""
116 | ]
117 | },
118 | {
119 | "cell_type": "markdown",
120 | "metadata": {},
121 | "source": [
122 | "\n",
123 | "## 2. Space Complexity"
124 | ]
125 | }
126 | ],
127 | "metadata": {
128 | "kernelspec": {
129 | "display_name": "Python 3",
130 | "language": "python",
131 | "name": "python3"
132 | },
133 | "language_info": {
134 | "codemirror_mode": {
135 | "name": "ipython",
136 | "version": 3
137 | },
138 | "file_extension": ".py",
139 | "mimetype": "text/x-python",
140 | "name": "python",
141 | "nbconvert_exporter": "python",
142 | "pygments_lexer": "ipython3",
143 | "version": "3.7.6"
144 | }
145 | },
146 | "nbformat": 4,
147 | "nbformat_minor": 4
148 | }
149 |
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/02- Array & Linked List.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# 02- Array & Linked List"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "## Table of Contents:\n",
15 | "* [1. Array](#array)\n",
16 | "* [2. Linked List](#linked-list)\n",
17 | "* [3. Array vs. Linked List](#array-vs-linked-list)"
18 | ]
19 | },
20 | {
21 | "cell_type": "markdown",
22 | "metadata": {},
23 | "source": [
24 | "\n",
25 | "## 1. Array"
26 | ]
27 | },
28 | {
29 | "cell_type": "markdown",
30 | "metadata": {},
31 | "source": [
32 | "An array is defined as a set of a definite number of homogeneous elements or data items. It means an array can contain one type of data only, either all integers, all floating-point numbers, or all characters.\n",
33 | "\n",
34 | "Declaration of an array is as follows:\n",
35 | "\n",
36 | "C:\n",
37 | "```C\n",
38 | "int a [10];\n",
39 | "```\n",
40 | "\n",
41 | "Python:\n",
42 | "```python\n",
43 | "mylist = []\n",
44 | "```"
45 | ]
46 | },
47 | {
48 | "cell_type": "markdown",
49 | "metadata": {},
50 | "source": [
51 | "The individual elements of an array can be accessed by describing the name of the array, followed by index or subscript (determining the location of the element in the array) inside the square brackets.\n",
52 | "\n",
53 | "For example, to retrieve 5th element of the array, we need to write a statement `a[4]`."
54 | ]
55 | },
56 | {
57 | "cell_type": "markdown",
58 | "metadata": {},
59 | "source": [
60 | ""
61 | ]
62 | },
63 | {
64 | "cell_type": "markdown",
65 | "metadata": {},
66 | "source": [
67 | "\n",
68 | "## 2. Linked List"
69 | ]
70 | },
71 | {
72 | "cell_type": "markdown",
73 | "metadata": {},
74 | "source": [
75 | "Linked list is a particular list of some data elements linked to one other. In this every element point to the next element which represents the logical ordering. Each element is called a node, which has two parts"
76 | ]
77 | },
78 | {
79 | "cell_type": "markdown",
80 | "metadata": {},
81 | "source": [
82 | "**INFO** part which stores the information and **POINTER** which points to the next element. As you know for storing address, we have a unique data structures in C called pointers. Hence the second field of the list must be a pointer type."
83 | ]
84 | },
85 | {
86 | "cell_type": "markdown",
87 | "metadata": {},
88 | "source": [
89 | ""
90 | ]
91 | },
92 | {
93 | "cell_type": "markdown",
94 | "metadata": {},
95 | "source": [
96 | ""
97 | ]
98 | },
99 | {
100 | "cell_type": "markdown",
101 | "metadata": {},
102 | "source": [
103 | "\n",
104 | "## 3. Array vs. Linked List"
105 | ]
106 | },
107 | {
108 | "cell_type": "markdown",
109 | "metadata": {},
110 | "source": [
111 | "|Basis for Comparison|Array|Linked List|\n",
112 | "|:--|:--|:--|\n",
113 | "|**Basic**|It is a consistent set of a fixed number of data items. |It is an ordered set comprising a variable number of data items.|\n",
114 | "|**Size**|\tSpecified during declaration.|\tNo need to specify; grow and shrink during execution.|\n",
115 | "|**Storage**| Allocation|\tElement location is allocated during compile time.\tElement position is assigned during run time.|\n",
116 | "|**Order of the elements**|\tStored consecutively|\tStored randomly|\n",
117 | "|**Accessing the element**|\tDirect or randomly accessed, i.e., Specify the array index or subscript.|\tSequentially accessed, i.e., Traverse starting from the first node in the list by the pointer.|\n",
118 | "|**Insertion and deletion of element**|\tSlow relatively as shifting is required.|Easier, fast and efficient.\n",
119 | "|**Searching**|\tBinary search and linear search|Linear search|\n",
120 | "|**Memory required**|\tLess|\tMore|\n",
121 | "|**Memory Utilization**|\tIneffective|\tEfficient|"
122 | ]
123 | }
124 | ],
125 | "metadata": {
126 | "kernelspec": {
127 | "display_name": "Python 3",
128 | "language": "python",
129 | "name": "python3"
130 | },
131 | "language_info": {
132 | "codemirror_mode": {
133 | "name": "ipython",
134 | "version": 3
135 | },
136 | "file_extension": ".py",
137 | "mimetype": "text/x-python",
138 | "name": "python",
139 | "nbconvert_exporter": "python",
140 | "pygments_lexer": "ipython3",
141 | "version": "3.7.6"
142 | }
143 | },
144 | "nbformat": 4,
145 | "nbformat_minor": 4
146 | }
147 |
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/array-linkedlist.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/array-linkedlist.jpg
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/array.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/array.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/binary-graph.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/binary-graph.jpg
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/binary-graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/binary-graph.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/binary-list.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/binary-list.jpg
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/binary-list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/binary-list.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/1.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/10.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/2.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/3.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/4.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/5.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/6.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/7.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/8.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/9.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/blockchain-nonce.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/blockchain-nonce.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/blockchain-tamper-2nd.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/blockchain-tamper-2nd.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/blockchain-tamper-compete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/blockchain-tamper-compete.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/blockchain-tamper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/blockchain-tamper.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/blockchain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/blockchain.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/decrypt-msg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/decrypt-msg.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/ledger.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/ledger.PNG
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/no-bank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/no-bank.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/paper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/paper.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/public-private-key.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/public-private-key.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/blockchain/sign-msg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/blockchain/sign-msg.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/capsule_616x353.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/capsule_616x353.jpg
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/closed_addressing.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/closed_addressing.PNG
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/doubly_linked_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/doubly_linked_list.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/singly_linked_list.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/singly_linked_list.png
--------------------------------------------------------------------------------
/03. Data Structure and Algorithm/images/stack.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/03. Data Structure and Algorithm/images/stack.jpg
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/03. Pandas/Untitled.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "id": "f7b1e017-7104-4c1a-83f0-f9289e6e2c8c",
7 | "metadata": {},
8 | "outputs": [],
9 | "source": []
10 | }
11 | ],
12 | "metadata": {
13 | "kernelspec": {
14 | "display_name": "Python 3 (ipykernel)",
15 | "language": "python",
16 | "name": "python3"
17 | },
18 | "language_info": {
19 | "codemirror_mode": {
20 | "name": "ipython",
21 | "version": 3
22 | },
23 | "file_extension": ".py",
24 | "mimetype": "text/x-python",
25 | "name": "python",
26 | "nbconvert_exporter": "python",
27 | "pygments_lexer": "ipython3",
28 | "version": "3.9.7"
29 | }
30 | },
31 | "nbformat": 4,
32 | "nbformat_minor": 5
33 | }
34 |
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/03. Pandas/tmp/2. Data Structures.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "another-stability",
6 | "metadata": {},
7 | "source": [
8 | "# Data structures in pandas\n",
9 | "\n",
10 | "The pandas package was created by Wes McKinney in 2008 as a result of frustrations he encountered while working on time series data in R. It is built on top of NumPy and provides features not available in it. It provides fast, easy-to-understand data structures and helps fill the gap between Python and a language like R. NumPy deals with homogeneous blocks of data. Using pandas helps to deal with data in a tabular structure composed of different data types.\n",
11 | "\n",
12 | "The official documentation for pandas can be found at http://pandas.pydata.org/pandas-docs/stable/dsintro.html."
13 | ]
14 | },
15 | {
16 | "cell_type": "markdown",
17 | "id": "large-surprise",
18 | "metadata": {},
19 | "source": [
20 | "There are three main data structures in pandas:\n",
21 | "\n",
22 | "- Series—1D\n",
23 | "- DataFrame—2D\n",
24 | "- Panel—3D"
25 | ]
26 | }
27 | ],
28 | "metadata": {
29 | "kernelspec": {
30 | "display_name": "Python 3",
31 | "language": "python",
32 | "name": "python3"
33 | },
34 | "language_info": {
35 | "codemirror_mode": {
36 | "name": "ipython",
37 | "version": 3
38 | },
39 | "file_extension": ".py",
40 | "mimetype": "text/x-python",
41 | "name": "python",
42 | "nbconvert_exporter": "python",
43 | "pygments_lexer": "ipython3",
44 | "version": "3.7.9"
45 | }
46 | },
47 | "nbformat": 4,
48 | "nbformat_minor": 5
49 | }
50 |
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/Untitled.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "d51313f8-b0f4-4923-b3cc-95f635ade081",
6 | "metadata": {},
7 | "source": [
8 | "# Resources to Add"
9 | ]
10 | },
11 | {
12 | "cell_type": "markdown",
13 | "id": "d93a5d94-0228-4fce-919f-7cf45399c83f",
14 | "metadata": {},
15 | "source": [
16 | "## Statistics\n",
17 | "\n",
18 | "This book should be enough:\n",
19 | "- Statistics Book"
20 | ]
21 | },
22 | {
23 | "cell_type": "markdown",
24 | "id": "591bd82a-9328-4a1e-8dd5-358afc062def",
25 | "metadata": {},
26 | "source": [
27 | "## Data Visualization\n",
28 | "\n",
29 | "We can use the documentations of:\n",
30 | "- Matplotlib Basics\n",
31 | "- Seaborn\n",
32 | "- Plotly\n",
33 | "\n",
34 | "and add examples."
35 | ]
36 | },
37 | {
38 | "cell_type": "markdown",
39 | "id": "66666d9e-1250-45a4-8846-c98d75f94939",
40 | "metadata": {},
41 | "source": [
42 | "## Elements of AI"
43 | ]
44 | },
45 | {
46 | "cell_type": "markdown",
47 | "id": "a9e360ff-1ae0-4b5f-9783-9b6b7201d5fa",
48 | "metadata": {},
49 | "source": [
50 | "- Introduction to AI\n",
51 | "- High Level Overview\n",
52 | "- https://www.elementsofai.com/?_ga=2.45382182.343912389.1642607280-256642993.1642607280"
53 | ]
54 | },
55 | {
56 | "cell_type": "markdown",
57 | "id": "252a64eb-1d3d-4cc4-b6b8-ff6c88e5f984",
58 | "metadata": {},
59 | "source": [
60 | "# Scikit Learn\n",
61 | "\n",
62 | "- Scikit Learn Documentation"
63 | ]
64 | },
65 | {
66 | "cell_type": "code",
67 | "execution_count": null,
68 | "id": "b9dc86ad-466f-4b0d-b32a-ddd88ece559f",
69 | "metadata": {},
70 | "outputs": [],
71 | "source": []
72 | }
73 | ],
74 | "metadata": {
75 | "kernelspec": {
76 | "display_name": "Python 3",
77 | "language": "python",
78 | "name": "python3"
79 | },
80 | "language_info": {
81 | "codemirror_mode": {
82 | "name": "ipython",
83 | "version": 3
84 | },
85 | "file_extension": ".py",
86 | "mimetype": "text/x-python",
87 | "name": "python",
88 | "nbconvert_exporter": "python",
89 | "pygments_lexer": "ipython3",
90 | "version": "3.8.11"
91 | }
92 | },
93 | "nbformat": 4,
94 | "nbformat_minor": 5
95 | }
96 |
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/axb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/axb.jpg
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/broadcasting-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/broadcasting-1.png
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/broadcasting-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/broadcasting-2.jpg
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/broadcasting-3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/broadcasting-3.jpg
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/cpu-cache.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/cpu-cache.jpg
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/ds-pipe.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/ds-pipe.png
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/jupyterlab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/jupyterlab.png
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/loc-iloc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/loc-iloc.png
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/notebook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/notebook.png
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/np_dot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/np_dot.jpg
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/np_outerdot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/np_outerdot.jpg
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/np_vdot.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/np_vdot.jpg
--------------------------------------------------------------------------------
/04. Data Science/02. Data Processing/images/numpy-array.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/02. Data Processing/images/numpy-array.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/03. Inferential Statistics/04. Estimation (Confidence Interval).ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "presidential-connecticut",
6 | "metadata": {},
7 | "source": [
8 | "# Estimation (Confidence Interval)"
9 | ]
10 | },
11 | {
12 | "cell_type": "code",
13 | "execution_count": null,
14 | "id": "permanent-value",
15 | "metadata": {},
16 | "outputs": [],
17 | "source": []
18 | }
19 | ],
20 | "metadata": {
21 | "kernelspec": {
22 | "display_name": "Python 3",
23 | "language": "python",
24 | "name": "python3"
25 | },
26 | "language_info": {
27 | "codemirror_mode": {
28 | "name": "ipython",
29 | "version": 3
30 | },
31 | "file_extension": ".py",
32 | "mimetype": "text/x-python",
33 | "name": "python",
34 | "nbconvert_exporter": "python",
35 | "pygments_lexer": "ipython3",
36 | "version": "3.9.5"
37 | }
38 | },
39 | "nbformat": 4,
40 | "nbformat_minor": 5
41 | }
42 |
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/03. Inferential Statistics/05. t Test for One Sample.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "id": "comfortable-delta",
6 | "metadata": {},
7 | "source": [
8 | "# t Test for One Sample\n",
9 | "\n",
10 | "Whenever, as usually is the case, the population standard deviation is unknown, it must be estimated with the sample standard deviation. Estimating the unknown population standard deviation has important implications that require both the use of degrees of freedom and the replacement of the z test with the t test."
11 | ]
12 | },
13 | {
14 | "cell_type": "markdown",
15 | "id": "restricted-removal",
16 | "metadata": {},
17 | "source": [
18 | "## Sampling Distribution of t\n",
19 | " \n",
20 | "Like the sampling distribution of z, the sampling distribution of t represents the distribution that would be obtained if a value of t were calculated for each sample mean for all possible random samples of a given size from some population."
21 | ]
22 | },
23 | {
24 | "cell_type": "markdown",
25 | "id": "cubic-saskatchewan",
26 | "metadata": {},
27 | "source": [
28 | "In the early 1900s, William Gosset discovered the sampling distribution of t and subsequently reported his achievement under the pen name of “Student.” Actually, Gosset discovered not just one but an entire family of t sampling distributions (or “Student’s” distributions)."
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "id": "representative-minister",
35 | "metadata": {},
36 | "outputs": [],
37 | "source": []
38 | }
39 | ],
40 | "metadata": {
41 | "kernelspec": {
42 | "display_name": "Python 3",
43 | "language": "python",
44 | "name": "python3"
45 | },
46 | "language_info": {
47 | "codemirror_mode": {
48 | "name": "ipython",
49 | "version": 3
50 | },
51 | "file_extension": ".py",
52 | "mimetype": "text/x-python",
53 | "name": "python",
54 | "nbconvert_exporter": "python",
55 | "pygments_lexer": "ipython3",
56 | "version": "3.7.9"
57 | }
58 | },
59 | "nbformat": 4,
60 | "nbformat_minor": 5
61 | }
62 |
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/Statistics-11th-Edition-by-Robert-S-Witte.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/Statistics-11th-Edition-by-Robert-S-Witte.pdf
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/amazon.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/amazon.PNG
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/assignment-survey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/assignment-survey.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/averages.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/averages.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/boundaries-z.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/boundaries-z.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/boundaries.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/boundaries.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/coincidence.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/coincidence.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/correaltion-vs-causality.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/correaltion-vs-causality.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/correlation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/correlation.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/curvelinear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/curvelinear.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/data-types.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/data-types.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/hypothesized-sampling-dist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/hypothesized-sampling-dist.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/level-of-significance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/level-of-significance.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/mean-sampling-dist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/mean-sampling-dist.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/minority-majority.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/minority-majority.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/normal-curve.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/normal-curve.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/obs-experiment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/obs-experiment.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/sample-population.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/sample-population.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/sampling-dist-is-normal-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/sampling-dist-is-normal-2.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/sampling-dist-is-normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/sampling-dist-is-normal.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/t-vs-z.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/t-vs-z.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/table-4.3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/table-4.3.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/two-estimate-of-variance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/two-estimate-of-variance.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/typical_shapes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/typical_shapes.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/variability-experiment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/variability-experiment.png
--------------------------------------------------------------------------------
/04. Data Science/03. Statistics/images/variability.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/03. Statistics/images/variability.png
--------------------------------------------------------------------------------
/04. Data Science/04. Linear Algebra/Gilbert Strang - Introduction to Linear Algebra (2016, Wellesley-Cambridge Press) (1).pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/04. Data Science/04. Linear Algebra/Gilbert Strang - Introduction to Linear Algebra (2016, Wellesley-Cambridge Press) (1).pdf
--------------------------------------------------------------------------------
/04. Data Science/04. Linear Algebra/Link to Text Book.txt:
--------------------------------------------------------------------------------
1 | Visit this link to download the book in pdf version:
2 |
3 | https://github.com/S-Ngigi/ML/blob/master/Books/Linear%20Algebra/Gilbert%20Strang%20-%20Introduction%20to%20Linear%20Algebra%20(2016,%20Wellesley-Cambridge%20Press)%20(1).pdf
--------------------------------------------------------------------------------
/05. Git/01. Introduction/01. Overview.md:
--------------------------------------------------------------------------------
1 | # Overview
2 |
3 | 1. Introduction / Key Concepts
4 | 2. Git Installation and Setup
5 | 3. Quick Start
6 | 4. Basic Commands
7 | 5. Comparing
8 | 6. Branching and Merging
9 | 7. GitHub Introduction
10 | 8. Tools Setup (Text Editor, Compare / Merge Tool)
11 |
--------------------------------------------------------------------------------
/05. Git/01. Introduction/02. Introduction.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | ## What is a Version Control System?
4 | You can think of a version control system (VCS) as a kind of "database". It lets you save a snapshot of your complete project at any time you want. When you later take a look at an older snapshot (let's start calling it "version"), your VCS shows you exactly how it differed from the previous one.
5 |
6 | A Version Control System (VCS) allows you to revert files back to a previous state, revert the entire project back to a previous state, review changes made over time, see who last modified something that might be causing a problem, who introduced an issue and when, and more. Using a VCS also means that if you screw things up or lose files, you can generally recover easily. And sometimes you just want to know "who wrote this crap", and having access to that information is worthwhile?
7 |
8 | ## Why Source Control
9 | - Backup / Archive
10 | - Versioning / History
11 | - Undo Changes
12 | - Comparing
13 | - Collaboration / Teamwork
14 | - Blame! / Learning Moment
15 | - Isolation of Changes
16 | - Experimentation
17 | - Context Switching
18 | - Code Review
19 |
20 | ## Centralized vs. Distributed VCS
21 |
22 | ### Centralized Version Control
23 | Centralized version control systems are based on the idea that there is a single “central” copy of your project somewhere (probably on a server), and programmers will “commit” their changes to this central copy.
24 |
25 | With Centralized version control, programmers no longer have to keep many copies of files on their hard drives manually, because the version control tool can talk to the central copy and retrieve any version they need on the fly.
26 |
27 | Note: In centralized version control, programmer needs connection to central server for most operations.
28 |
29 | ### Distributed Version Control
30 |
31 | These systems do not necessarily rely on a central server to store all the versions of a project’s files. Instead, every developer “clones” a copy of a repository and has the full history of the project on their own hard drive. This copy (or “clone”) has all of the metadata of the original.
32 |
33 | This method may sound wasteful, but in practice, it’s not a problem. Most programming projects consist mostly of plain text files (and maybe a few images), and disk space is so cheap that storing many copies of a file doesn’t create a noticable dent in a hard drive’s free space. Modern systems also compress the files to use even less space.
34 |
35 | One common misconception about distributed version control systems is that there cannot be a central project repository. This is simply not true – there is nothing stopping you from saying “this copy of the project is the authoritative one.” This means that instead of a central repository being required by the tools you use, it is now optional.
36 |
37 | Note:
38 | - Most operations are local
39 | - Central server is not required
40 |
41 | ## What is Git
42 | By far, the most widely used modern version control system in the world today is Git. Git is a mature, actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous creator of the Linux operating system kernel.
43 |
44 | Having a distributed architecture, Git is an example of a DVCS (hence Distributed Version Control System). Rather than have only one single place for the full version history of the software as is common in once-popular version control systems like CVS or Subversion (also known as SVN), in Git, every developer's working copy of the code is also a repository that can contain the full history of all changes.
45 |
46 | [Read More](https://www.atlassian.com/git/tutorials/what-is-git)
--------------------------------------------------------------------------------
/05. Git/01. Introduction/03. Installation.md:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | The first two things you'll want to do are install git and create a free GitHub account.
4 |
5 | Follow the instructions [here](https://www.atlassian.com/git/tutorials/install-git) to install git (if it's not already installed).
6 |
7 | Note that for this tutorial we will be using git on the command line only. While there are some great git GUIs (graphical user interfaces), it's easier to learn git using git-specific commands first and then to try out a git GUI once you're more comfortable with the command.
8 |
9 | Once you've done that, create a GitHub account [here](https://github.com/).
10 |
11 | ## Git vs. Github
12 | Git and GitHub are not the same thing. Git is an open-source, version control tool created in 2005 by developers working on the Linux operating system; GitHub is a company founded in 2008 that makes tools which integrate with git. You do not need GitHub to use git, but you cannot use GitHub without using git. There are many other alternatives to GitHub, such as GitLab, BitBucket, and “host-your-own” solutions such as gogs and gittea. All of these are referred to in git-speak as “remotes”, and all are completely optional. You do not need to use a remote to use git, but it will make sharing your code with others easier.
--------------------------------------------------------------------------------
/05. Git/01. Introduction/04. Key Concepts.md:
--------------------------------------------------------------------------------
1 | # Key Concepts
2 |
3 | First, in Git, collections of version controlled files are kept together in a repository. The repository also contains the history of changes and any special configuration. Generally speaking, a repository would contain all the files related to a specific project or application.
4 |
5 | 
6 |
7 | Next, there are three local states related to files being managed by Git:
8 | - The working directory: the directory or folder on your computer that holds all the project or application files. Files within the working directory, may or may not be managed by Git. However, Git is aware of them.
9 | - Staging area: In-between is the Git staging area, often referred to as the Git index, that is a holding area for queueing up changes for the next commit.
10 | - The Git repository or the commit history: The Git repository manages the Git commit history, that is all the changes that are finalized and permanently part of the Git repository.
11 |
12 | 
13 |
14 | **Note:** Since files in the staging area haven't been committed yet, you can move the files in and out of the staging area without impacting the Git repository, and its history of changes.
15 |
16 | The three states of Git are specific to the local Git repository, but I like to tack on a fourth state, the remote state. Although the remote repository is just another repository with its own three states internally, conceptually, I think of the remote repository as a fourth state; since it is the last step in the basic Git workflow, and since few people use Git without a corresponding remote repository.
17 |
18 | 
19 |
20 | While there are several Git hosting services (remote repository) out there, [GitHub](https://www.github.com) is by far the most popular. You can see a comparison of different git hosting services [here](https://bitbucket.org/product/code-repository).
21 |
--------------------------------------------------------------------------------
/05. Git/02. Getting Started/01. Setting Up a Repository.md:
--------------------------------------------------------------------------------
1 | # Setting Up a Repository
2 |
3 | This tutorial provides an overview of how to set up a repository (repo) under Git version control. This resource will walk you through initializing a Git repository for a new or existing project. Included below are workflow examples of repositories both created locally and cloned from remote repositories. This guide assumes a basic familiarity with a command-line interface.
4 |
5 | ## Initialize a New Repository: `git init`
6 | To create a new repo, you'll use the `git init` command. `git init` is a one-time command you use during the initial setup of a new repo. Executing this command will create a new `.git` subdirectory in your current working directory. This will also create a new **main** branch.
7 |
8 | **Note:** All new Git repositories on GitHub will be named "main" instead of "master" starting October 1, 2020. See [here](https://www.zdnet.com/article/github-to-replace-master-with-main-starting-next-month/)
9 |
10 | 
11 |
12 | The `git init` command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. Most other Git commands are not available outside of an initialized repository, so this is usually the first command you'll run in a new project.
13 |
14 | Executing `git init` creates a `.git` subdirectory in the current working directory, which contains all of the necessary Git metadata for the new repository. This metadata includes subdirectories for objects, refs, and template files. A `HEAD` file is also created which points to the currently checked out commit.
15 |
16 | ### Usage
17 | Git does not require any pre-existing server or admin privileges. All you have to do is cd into your project subdirectory and run `git init`, and you'll have a fully functional Git repository.
18 |
19 | If you've already run `git init` on a project directory and it contains a `.git` subdirectory, you can safely run `git init` again on the same project directory. It will not override an existing `.git` configuration.
20 |
21 | ## Clone an Existing Repository: `git clone`
22 | `git clone` is a Git command line utility which is used to target an existing repository and create a clone, or copy of the target repository.
23 |
24 | If a project has already been set up in a central repository, the `git clone` command is the most common way for users to obtain a development copy. Like `git init`, cloning is generally a one-time operation. Once a developer has obtained a working copy, all version control operations and collaborations are managed through their local repository.
25 |
26 | ### Usage
27 | `git clone` is primarily used to point to an existing repo and make a clone or copy of that repo at in a new directory, at another location. The original repository can be located on the local filesystem or on remote machine accessible supported protocols. The `git clone` command copies an existing Git repository.
28 |
29 | ### Git URLs
30 | Git has its own URL syntax which is used to pass remote repository locations to Git commands
31 |
32 | Git URL protocols:
33 | - **SSH**: Secure Shell (SSH) is a ubiquitous authenticated network protocol that is commonly configured by default on most servers. Because SSH is an authenticated protocol, you'll need to establish credentials with the hosting server before connecting.
34 |
35 | - **HTTP**: Hyper text transfer protocol. The protocol of the web, most commonly used for transferring web page HTML data over the Internet. Git can be configured to communicate over HTTP.
36 |
--------------------------------------------------------------------------------
/05. Git/03. Saving Changes/01. Add and Commit.md:
--------------------------------------------------------------------------------
1 | # Add and Commit
2 | Developing a project revolves around the basic edit/stage/commit pattern. First, you edit your files in the working directory. When you’re ready to save a copy of the current state of the project, you stage changes with git add. After you’re happy with the staged snapshot, you commit it to the project history with `git commit`.
3 |
4 | ## `git add`
5 | When working in Git, or other version control systems, the concept of "saving" is a more nuanced process than saving in a word processor or other traditional file editing applications. The traditional software expression of "saving" is synonymous with the Git term "committing" and Git committing is an operation that acts upon a collection of files and directories.
6 |
7 | The `git add ` command adds a change in the working directory to the staging area. It tells Git that you want to include updates to a particular file in the next commit. However, `git add ` doesn't really affect the repository in any significant way—changes are not actually recorded until you run `git commit`.
8 |
9 |
10 |
11 | The primary function of the `git add` command, is to promote pending changes in the working directory, to the git staging area. The staging area is one of Git's more unique features, and it can take some time to wrap your head around it. The staging area is considered one of the "three trees" of Git, along with, the working directory, and the commit history.
12 |
13 | Instead of committing all of the changes you've made since the last commit, the stage lets you group related changes into highly focused snapshots before actually committing it to the project history. This means you can make all sorts of edits to unrelated files, then go back and split them up into logical commits by adding related changes to the stage and commit them piece-by-piece. As in any revision control system, it’s important to create atomic commits so that it’s easy to track down bugs and revert changes with minimal impact on the rest of the project.
14 |
15 | ## `git commit`
16 |
17 | The `git commit` command captures a snapshot of the project's currently staged changes. Committed snapshots can be thought of as “safe” versions of a project—Git will never change them unless you explicitly ask it to. Prior to the execution of `git commit`, The `git add` command is used to promote or 'stage' changes to the project that will be stored in a commit. These two commands `git commit` and `git add` are two of the most frequently used.
18 |
19 | Instead of making a change and committing it directly to the central repo, Git developers have the opportunity to accumulate commits in their local repo. it makes it easier to split up a feature into atomic commits, keep related commits grouped together, and clean up local history before publishing it to the central repository. It also lets developers work in an isolated environment, deferring integration until they’re at a convenient point to merge with other users. While isolation and deferred integration are individually beneficial, it is in a team's best interest to integrate frequently and in small units.
20 |
21 | **Note:** Git records the entire contents of each file in every commit, not the differences. This makes many Git operations much faster than other version controls such as SVN, since a particular version of a file doesn’t have to be “assembled” from its diffs—the complete revision of each file is immediately available from Git's internal database.
22 |
23 |
24 |
25 | ### Options
26 |
27 | - `git commit`: Commit the staged snapshot. This will launch a text editor prompting you for a commit message. After you’ve entered a message, save the file and close the editor to create the actual commit.
28 | - `git commit -a`: Commit a snapshot of all changes in the working directory. This only includes modifications to tracked files (those that have been added with `git add` at some point in their history).
29 | - `git commit -m "commit message"`: A shortcut command that immediately creates a commit with a passed commit message. By default, `git commit` will open up the locally configured text editor, and prompt for a commit message to be entered. Passing the -m option will forgo the text editor prompt in-favor of an inline message.
30 | - `git commit -am "commit message"`: A power user shortcut command that combines the `-a` and `-m` options. This combination immediately creates a commit of all the staged changes and takes an inline commit message.
31 | - `git commit --amend`: This option adds another level of functionality to the commit command. Passing this option will modify the last commit. Instead of creating a new commit, staged changes will be added to the previous commit. This command will open up the system's configured text editor and prompt to change the previously specified commit message.
32 |
33 |
34 | **What is a tracked file?** A tracked file is any file that Git is aware of and tracking actively. That would be any file that has already been committed into the Git repository, or any file that has been added to the Git index, or the Git staging area.
35 |
--------------------------------------------------------------------------------
/05. Git/03. Saving Changes/02. Inspecting a Repository.md:
--------------------------------------------------------------------------------
1 | # Inspecting a Repository
2 |
3 | ## `git status`
4 |
5 | The `git status` command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven’t, and which files aren’t being tracked by Git. Status output does not show you any information regarding the committed project history. For this, you need to use `git log`.
6 |
7 | `git status` list which files are staged, unstaged, and untracked.
8 |
9 | The `git status` command is a relatively straightforward command. It simply shows you what's been going on with git add and git commit. Status messages also include relevant instructions for staging/unstaging files.
10 |
11 | ### Ignoring Files
12 |
13 | Untracked files typically fall into two categories.
14 | 1. Files that have just been added to the project and haven't been committed yet
15 | 2. Compiled binaries like .pyc, .obj, .exe, etc.
16 |
17 | While it's definitely beneficial to include the former in the `git status` output, the latter can make it hard to see what’s actually going on in your repository.
18 |
19 | For this reason, Git lets you completely ignore files by placing paths in a special file called `.gitignore`. Any files that you'd like to ignore should be included on a separate line, and the * symbol can be used as a wildcard. For example, adding the following to a `.gitignore` file in your project root will prevent compiled Python modules from appearing in `git status`:
20 |
21 | ```
22 | *.pyc
23 | ```
24 |
25 | ## `git log`
26 | The git log command displays committed snapshots. It lets you list the project history, filter it, and search for specific changes. While `git status` lets you inspect the working directory and the staging area, git log only operates on the committed history.
27 |
28 |
29 |
30 | Log output can be customized in several ways, from simply filtering commits to displaying them in a completely user-defined format. Some of the most common configurations of `git log` are presented below.
31 |
32 | - `git log`: Display the entire commit history using the default formatting. If the output takes up more than one screen, you can use Space to scroll and `q` to exit.
33 | - `git log -n `: Limit the number of commits to display. For example, `git log -n 3` will display only 3 commits.
34 | - `git log --oneline`: Condense each commit to a single line. This is useful for getting a high-level overview of the project history.
35 | - `git log --stat`: Along with the ordinary git log information, include which files were altered and the relative number of lines that were added or deleted from each of them.
36 | - `git log `: Only display commits that include the specified file. This is an easy way to see the history of a particular file.
37 | - `git log -p`: Display the patch representing each commit. This shows the full diff of each commit, which is the most detailed view you can have of your project history.
38 | - `git log -p `: Display the patch representing for ``
39 | - `git log --author=""`: Search for commits by a particular author. The argument can be a plain string or a regular expression.
40 | - `git log --grep=""`: Search for commits with a commit message that matches, which can be a plain string or a regular expression.
41 | - `git log --graph --decorate`: The --graph flag that will draw a text based graph of the commits on the left hand side of the commit messages. --decorate adds the names of branches or tags of the commits that are shown.
42 |
43 |
--------------------------------------------------------------------------------
/05. Git/04. Remote Repository/01. Remote Repository Setup.md:
--------------------------------------------------------------------------------
1 | # Remote Repository Setup
2 |
3 | You’ve now got a local git repository. You can use git locally, like that, if you want. But if you want the thing to have a home on github, do the following.
4 |
5 | 1. Go to github.
6 | 2. Log in to your account.
7 | 3. Click the **new repository** button in the top-right.
8 | 4. Choose a proper name for the remote repository. Add a description (optional).
9 | 5. You may select **Private** if you choose who can see and commit to this repository or **Public** so that anyone on the internet can see this repository and you choose who can commit.
10 | 6. You’ll have an option there to initialize the repository with a `README` file, a `.gitignore` template file, and a license.
11 | 7. Click the **Create repository** button.
12 |
13 | You now have a remote repository.
14 |
--------------------------------------------------------------------------------
/05. Git/04. Remote Repository/02. Configuration.md:
--------------------------------------------------------------------------------
1 | # Configuration
2 |
3 | Once you have a remote repo setup, you will need to add a remote repo url to your local git config, and set an upstream branch for your local branches. The git remote command offers such utility:
4 | - `git remote add `
5 |
6 | This command will map remote repository at to a ref in your local repo under. Once you have mapped the remote repo you can push local branches to it:
7 | - `git push -u `
8 |
9 | This command will push the local repo branch under `` to the remote repo at ``.
10 |
11 | **Note:** If you clone a repo, your remote is already set up. You can see the list of remotes by running `git remote -v`.
12 |
13 | ## Git Config Levels
14 | In addition to configuring a remote repo URL, you may also need to set global Git configuration options such as username, or email. The `git config` command lets you configure your Git installation (or an individual repository) from the command line. This command can define everything from user info, to preferences, to the behavior of a repository. Several common configuration options are listed below.
15 |
16 | Git stores configuration options in three separate files, which lets you scope options to individual repositories (local), user (Global), or the entire system (system):
17 | - Local: `/.git/config` – **Repository-specific** settings.
18 |
19 | By default, `git config` will write to a local level if no configuration option is passed. Local level configuration is applied to the context repository `git config` gets invoked in. Local configuration values are stored in a file that can be found in the repo's .git directory: .git/config
20 |
21 | - Global: `/.gitconfig` – **User-specific** settings. This is where options set with the --global flag are stored.
22 |
23 | Global level configuration is user-specific, meaning it is applied to an operating system user. Global configuration values are stored in a file that is located in a user's home directory. `~/.gitconfig` on unix systems and `C:\Users\\.gitconfig on windows
24 |
25 | - System: `$(prefix)/etc/gitconfig` – **System-wide** settings.
26 |
27 | System-level configuration is applied across an entire machine. This covers all users on an operating system and all repos. The system level configuration file lives in a gitconfig file off the system root path. `$(prefix)/etc/gitconfig` on unix systems. On windows this file can be found at `C:\Documents and Settings\All Users\Application Data\Git\config` on Windows XP, and in `C:\ProgramData\Git\config` on Windows Vista and newer.
28 |
29 | Thus the order of priority for configuration levels is: local, global, system. This means when looking for a configuration value, Git will start at the local level and bubble up to the system level.
30 |
31 | ## Writing a Value
32 | Expanding on what we already know about `git config`, let's look at a few example in which we write a value:
33 |
34 | Define the author name to be used for all commits in the current repository. Typically, you’ll want to use the --global flag to set configuration options for the current user.
35 |
36 | Define the author name to be used for all commits by the current user.
37 | ```
38 | git config --global user.name
39 | ```
40 |
41 | Adding the `--local` option or not passing a config level option at all, will set the user.name for the current local repository.
42 | ```
43 | git config --local user.email
44 | ```
45 |
46 | Create a **shortcut** (**alias**) for a Git command. This is a powerful utility to create custom shortcuts for commonly used git commands. A simplistic example would be:
47 |
48 | ```bash
49 | git config --global alias.hist "log --oneline"
50 | ```
51 | This creates a `git hist` command that you can execute as a shortcut to `git log --oneline`.
52 |
53 | To open the local/global/system wide configuration file in a text editor for manual editing:
54 | ```
55 | git config --global --edit
56 | ```
57 | ## Git Editor
58 | Many Git commands will launch a text editor to prompt for further input. One of the most common use cases for `git config` is configuring which editor Git should use. Listed below is a table of popular editors and matching `git config` commands:
59 |
60 |
61 | |Editor|Config Command|
62 | |:--|:--|
63 | |Atom|`git config --global core.editor "atom --wait"`}
64 | |emacs|`git config --global core.editor "emacs"`|
65 | |nano|`git config --global core.editor "nano -w"`|
66 | |vim|`git config --global core.editor "vim"`|
67 | |Sublime Text (Mac)|`git config --global core.editor "subl -n -w"`|
68 | |Sublime Text (Win, 32-bit install)|`git config --global core.editor "'c:/program files (x86)/sublime text 3/sublimetext.exe' -w"`|
69 | |Sublime Text (Win, 64-bit install)|`git config --global core.editor "'c:/program files/sublime text 3/sublimetext.exe' -w"`|
70 | |Textmate|`git config --global core.editor "mate -w"`|
--------------------------------------------------------------------------------
/05. Git/05. Merge.md:
--------------------------------------------------------------------------------
1 | # Merge
2 | Merging is Git's way of putting a forked history back together again. The `git merge` command lets you take the independent lines of development created by `git branch` and integrate them into a single branch.
3 |
4 | Note that all of the commands presented below merge into the current branch. The current branch will be updated to reflect the merge, but the target branch will be completely unaffected. Again, this means that `git merge` is often used in conjunction with `git checkout` for selecting the current branch and `git branch -d` for deleting the obsolete target branch.
5 |
6 | ## How it works
7 |
8 | `git merge` will combine multiple sequences of commits into one unified history. In the most frequent use cases, `git merge` is used to combine two branches. The following examples in this document will focus on this branch merging pattern. In these scenarios, `git merge` takes two commit pointers, usually the branch tips, and will find a common base commit between them. Once Git finds a common base commit it will create a new "merge commit" that combines the changes of each queued merge commit sequence.
9 |
10 | Say we have a new branch feature that is based off the `master` branch. We now want to merge this feature branch into `master`.
11 |
12 |
13 |
14 | Invoking this command will merge the specified branch feature into the current branch, we'll assume master. Git will determine the merge algorithm automatically (discussed below).
15 |
16 |
17 |
18 | Merge commits are unique against other commits in the fact that they have two parent commits. When creating a merge commit Git will attempt to auto magically merge the separate histories for you. If Git encounters a piece of data that is changed in both histories it will be unable to automatically combine them. This scenario is a version control conflict and Git will need user intervention to continue.
19 |
--------------------------------------------------------------------------------
/05. Git/06. Undoing Changes/0.1 Stashing Your Work.md:
--------------------------------------------------------------------------------
1 | # Stashing Your Work
2 |
3 | The `git stash` command takes your uncommitted changes (both staged and unstaged), saves them away for later use, and then reverts them from your working copy. For example:
4 |
5 | ```bash
6 | $ git status
7 | On branch master
8 | Changes to be committed:
9 |
10 | new file: style.css
11 |
12 | Changes not staged for commit:
13 |
14 | modified: index.html
15 |
16 | $ git stash
17 | Saved working directory and index state WIP on master: 5002d47 our new homepage
18 | HEAD is now at 5002d47 our new homepage
19 |
20 | $ git status
21 | On branch master
22 | nothing to commit, working tree clean
23 | ```
24 |
25 | At this point you're free to make changes, create new commits, switch branches, and perform any other Git operations; then come back and re-apply your stash when you're ready.
26 |
27 | Note that the stash is local to your Git repository; stashes are not transferred to the server when you push.
28 |
29 | ## Re-applying your stashed changes
30 | You can reapply previously stashed changes with `git stash pop`:
31 | ```bash
32 | git stash pop
33 | ```
34 |
35 | Popping your stash removes the changes from your stash and reapplies them to your working copy.
36 |
37 | Alternatively, you can reapply the changes to your working copy and keep them in your stash with `git stash apply`:
38 | ```bash
39 | git stash apply
40 | ```
41 |
42 | This is useful if you want to apply the same stashed changes to multiple branches.
43 |
44 | Now that you know the basics of stashing, there is one caveat with `git stas`h you need to be aware of: by default Git won't stash changes made to **untracked** or **ignored files**.
45 |
46 | ## Stashing untracked or ignored files
47 | By default, running `git stash` will stash:
48 |
49 | - changes that have been added to your index (staged changes)
50 | - changes made to files that are currently tracked by Git (unstaged changes)
51 |
52 | But it will **not** stash:
53 | - New files in your working copy that have not yet been staged
54 | - files that have been ignored
55 |
56 | So if we add a third file to our example above, but don't stage it (i.e. we don't run `git add`), `git stash` won't stash it.
57 |
58 | Adding the `-u` option (or `--include-untracked`) tells `git stash` to also stash your untracked files:
59 | ```bash
60 | git stash -u
61 | ```
62 |
63 | You can include changes to ignored files as well by passing the `-a` option (or `--all`) when running `git stash`.
64 |
65 |
66 |
67 | ## Managing multiple stashes
68 |
69 | You aren't limited to a single stash. You can run `git stash` several times to create multiple stashes, and then use `git stash list` to view them. By default, stashes are identified simply as a **WIP** – work in progress – on top of the branch and commit that you created the stash from. After a while it can be difficult to remember what each stash contains:
70 |
71 | ```bash
72 | $ git stash list
73 | stash@{0}: WIP on master: 5002d47 our new homepage
74 | stash@{1}: WIP on master: 5002d47 our new homepage
75 | stash@{2}: WIP on master: 5002d47 our new homepage
76 | ```
77 |
78 | To provide a bit more context, it's good practice to annotate your stashes with a description, using `git stash save "message"`:
79 |
80 | ```bash
81 | $ git stash save "add style to our site"
82 | Saved working directory and index state On master: add style to our site
83 | HEAD is now at 5002d47 our new homepage
84 |
85 | $ git stash list
86 | stash@{0}: On master: add style to our site
87 | stash@{1}: WIP on master: 5002d47 our new homepage
88 | stash@{2}: WIP on master: 5002d47 our new homepage
89 | ```
90 |
91 | By default, git stash pop will re-apply the most recently created stash: `stash@{0}`
92 |
93 | You can choose which stash to re-apply by passing its identifier as the last argument, for example:
94 |
95 | ```bash
96 | git stash pop stash@{2}
97 | ```
98 |
99 | ## Viewing stash diffs
100 | You can view a summary of a stash with `git stash show`:
101 | ```bash
102 | $ git stash show
103 | index.html | 1 +
104 | style.css | 3 +++
105 | 2 files changed, 4 insertions(+)
106 | ```
107 |
108 | Or pass the `-p` option (or `--patch`) to view the full diff of a stash:
109 | ```bash
110 | git stash show -p
111 | ```
112 |
113 | ## Partial stashes
114 | You can also choose to stash just a single file, a collection of files, or individual changes from within files. If you pass the `-p` option (or `--patch`) to `git stash`, it will iterate through each changed "hunk" in your working copy and ask whether you wish to stash it:
115 | ```bash
116 | git stash -p
117 | ```
118 |
119 | You can hit `?` for a full list of hunk commands. Commonly useful ones are:
120 |
121 | |Command|Description|
122 | |:--|:--|
123 | |`/`|search for a hunk by regex|
124 | |`?`|help|
125 | |`n`|don't stash this hunk|
126 | |`q`|quit (any hunks that have already been selected will be stashed)|
127 | |`s`|split this hunk into smaller hunks|
128 | |`y`|stash this hunk|
129 |
130 | There is no explicit "abort" command, but hitting `CTRL-C` will abort the stash process.
131 |
132 | ## Cleaning up your stash
133 | If you decide you no longer need a particular stash, you can delete it with `git stash drop`:
134 |
135 | ```bash
136 | git stash drop stash@{0}
137 | ```
138 |
139 | Or you can delete all of your stashes with:
140 | ```bash
141 | git stash clear
142 | ```
143 |
144 | ## Summary
145 | - Stash your work (any will do)
146 | ```bash
147 | $ git stash save
148 | $ git stash
149 | ```
150 |
151 | - See what you got
152 | ```bash
153 | $ git stash list
154 | ```
155 |
156 | - Apply
157 | ```bash
158 | $ git stash apply stash@{0}
159 | ```
160 |
161 | - Clean up (any will do)
162 | ```bash
163 | $ git stash drop stash@{0}
164 | $ git stash pop
165 | $ git stash clear
166 | ```
167 |
--------------------------------------------------------------------------------
/05. Git/06. Undoing Changes/02. What is Lost?.md:
--------------------------------------------------------------------------------
1 | # Undoing Commits and Changes
2 |
3 | In this section, we will discuss the available 'undo' Git strategies and commands. It is first important to note that Git does not have a traditional 'undo' system like those found in a word processing application. It will be beneficial to refrain from mapping Git operations to any traditional 'undo' mental model. Additionally, Git has its own nomenclature for 'undo' operations that it is best to leverage in a discussion. This nomenclature includes terms like `reset`, `revert`, `checkout`, `clean`, and more.
4 |
5 | A fun metaphor is to think of Git as a timeline management utility. Commits are snapshots of a point in time or points of interest along the timeline of a project's history. Additionally, multiple timelines can be managed through the use of branches. When 'undoing' in Git, you are usually moving back in time, or to another timeline where mistakes didn't happen.
6 |
7 | This section provides all of the necessary skills to work with previous revisions of a software project. First, it shows you how to explore old commits, then it explains the difference between reverting public commits in the project history vs. resetting unpublished changes on your local machine.
8 |
9 | ## Finding what is lost: Reviewing old commits
10 | The whole idea behind any version control system is to store “safe” copies of a project so that you never have to worry about irreparably breaking your code base. Once you’ve built up a project history of commits, you can review and revisit any commit in the history. One of the best utilities for reviewing the history of a Git repository is the `git log` command. In the example below, we use `git log` to get a list of the latest commits to a popular open-source graphics library.
11 |
12 | Each commit has a unique SHA-1 identifying hash. These IDs are used to travel through the committed timeline and revisit commits. By default, `git log` will only show commits for the currently selected branch. It is entirely possible that the commit you're looking for is on another branch. You can view all commits across all branches by executing `git log --branches=*`. The command `git branch` is used to view and visit other branches. Invoking the command, `git branch -a` will return a list of all known branch names. One of these branch names can then be logged using `git log`.
13 |
14 | When you have found a commit reference to the point in history you want to visit, you can utilize the git checkout command to visit that commit. Git checkout is an easy way to “load” any of these saved snapshots onto your development machine. During the normal course of development, the `HEAD` usually points to master or some other local branch, but when you check out a previous commit, `HEAD` no longer points to a branch—it points directly to a commit. This is called a **detached HEAD** state, and it can be visualized as the following:
15 |
16 |
17 |
18 | Checking out an old file does not move the `HEAD` pointer. It remains on the same branch and same commit, avoiding a 'detached head' state. You can then commit the old version of the file in a new snapshot as you would any other changes. So, in effect, this usage of git checkout on a file, serves as a way to revert back to an old version of an individual file.
19 |
--------------------------------------------------------------------------------
/05. Git/06. Undoing Changes/03. Undoing a Committed Snapshot.md:
--------------------------------------------------------------------------------
1 |
2 | # Undoing a committed snapshot
3 | There are technically several different strategies to 'undo' a commit. The following examples will assume we have a commit history that looks like:
4 |
5 | ```
6 | git log --oneline
7 | 872fa7e Try something crazy
8 | a1e8fb5 Make some important changes to hello.txt
9 | 435b61d Create hello.txt
10 | 9773e52 Initial import
11 | ```
12 | We will focus on undoing the `872fa7e` Try something crazy commit. Maybe things got a little too crazy.
13 |
14 | ## How to undo a commit with `git checkout`
15 | Using the git checkout command we can checkout the previous commit, `a1e8fb5`, putting the repository in a state before the crazy commit happened. Checking out a specific commit will put the repo in a "detached HEAD" state. This means you are no longer working on any branch. In a detached state, any new commits you make will be orphaned when you change branches back to an established branch. Orphaned commits are up for deletion by Git's garbage collector. The garbage collector runs on a configured interval and permanently destroys orphaned commits. To prevent orphaned commits from being garbage collected, we need to ensure we are on a branch.
16 |
17 | From the detached `HEAD` state, we can execute `git checkout -b new_branch_without_crazy_commit`. This will create a new branch named `new_branch_without_crazy_commit` and switch to that state. The repo is now on a new history timeline in which the `872fa7e` commit no longer exists. At this point, we can continue work on this new branch in which the `872fa7e` commit no longer exists and consider it 'undone'. Unfortunately, if you need the previous branch, maybe it was your master branch, this undo strategy is not appropriate. Let's look at some other 'undo' strategies.
18 |
19 | ## How to undo a public commit with `git revert`
20 | Let's assume we are back to our original commit history example. The history that includes the `872fa7e` commit. This time let's try a revert 'undo'. If we execute `git revert HEAD`, Git will create a new commit with the inverse of the last commit. This adds a new commit to the current branch history and now makes it look like:
21 |
22 | At this point, we have again technically 'undone' the `872fa7e` commit. Although `872fa7e` still exists in the history, the new `e2f9a78` commit is an inverse of the changes in `872fa7e`. Unlike our previous checkout strategy, we can continue using the same branch. This solution is a satisfactory undo. This is the ideal 'undo' method for working with public shared repositories. If you have requirements of keeping a curated and minimal Git history this strategy may not be satisfactory.
23 |
24 | ## Undoing the last commit with `git commit --amend`
25 | In the previous section, we discussed different strategies for undoing commits. These strategies are all applicable to the most recent commit as well. In some cases though, you might not need to remove or reset the last commit. Maybe it was just made prematurely. In this case you can amend the most recent commit. Once you have made more changes in the working directory and staged them for commit by using `git add`, you can execute `git commit --amend`. This will have Git open the configured system editor and let you modify the last commit message. The new changes will be added to the amended commit.
26 |
--------------------------------------------------------------------------------
/05. Git/06. Undoing Changes/04. Undoing Uncommitted Changes.md:
--------------------------------------------------------------------------------
1 | # Undoing Uncommitted Changes
2 | Before changes are committed to the repository history, they live in the staging index and the working directory. You may need to undo changes within these two areas. The staging index and working directory are internal Git state management mechanisms.
3 |
4 | ## The Working Directory
5 |
6 | The working directory is generally in sync with the local file system. To undo changes in the working directory you can edit files like you normally would using your favorite editor. Git has a couple utilities that help manage the working directory. There is the git clean command which is a convenience utility for undoing changes to the working directory. Additionally, git reset can be invoked with the --mixed or --hard options and will apply a reset to the working directory.
7 |
8 |
--------------------------------------------------------------------------------
/05. Git/files/text.txt:
--------------------------------------------------------------------------------
1 | asdfasdf
--------------------------------------------------------------------------------
/05. Git/images/3-stages.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/3-stages.png
--------------------------------------------------------------------------------
/05. Git/images/after-checkout-branch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/after-checkout-branch.png
--------------------------------------------------------------------------------
/05. Git/images/after-reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/after-reset.png
--------------------------------------------------------------------------------
/05. Git/images/before-checkout-branch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/before-checkout-branch.png
--------------------------------------------------------------------------------
/05. Git/images/before-reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/before-reset.png
--------------------------------------------------------------------------------
/05. Git/images/checkout-branch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/checkout-branch.png
--------------------------------------------------------------------------------
/05. Git/images/checkout-commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/checkout-commit.png
--------------------------------------------------------------------------------
/05. Git/images/detached-head.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/detached-head.png
--------------------------------------------------------------------------------
/05. Git/images/diff-new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/diff-new.png
--------------------------------------------------------------------------------
/05. Git/images/diff-no-output.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/diff-no-output.png
--------------------------------------------------------------------------------
/05. Git/images/git-add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-add.png
--------------------------------------------------------------------------------
/05. Git/images/git-commit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-commit.png
--------------------------------------------------------------------------------
/05. Git/images/git-directory.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-directory.png
--------------------------------------------------------------------------------
/05. Git/images/git-github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-github.png
--------------------------------------------------------------------------------
/05. Git/images/git-init.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-init.png
--------------------------------------------------------------------------------
/05. Git/images/git-log.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-log.png
--------------------------------------------------------------------------------
/05. Git/images/git-push.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-push.png
--------------------------------------------------------------------------------
/05. Git/images/git-stages.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-stages.png
--------------------------------------------------------------------------------
/05. Git/images/git-stash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/git-stash.png
--------------------------------------------------------------------------------
/05. Git/images/merge.svg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/merge.svg
--------------------------------------------------------------------------------
/05. Git/images/merge_2.svg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/05. Git/images/merge_2.svg
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Sina Karaji
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # CS Tutorial
2 |
3 |
4 | Source codes for CS courses offered by [**Ali Hejazizo**](https://www.hejazizo.com).
5 |
6 | # Table of Content
7 | 
8 | 
9 | 
10 | 
11 |
12 | This organization covers different CS-based material including but not limited to;
13 |
14 | - ## Pure Programming
15 | - [Python](Python)
16 | - [Data Structure](Data%20Structure)
17 |
18 | - ## Operating Systems
19 | - [Linux](Linux)
20 |
21 | - ## Database Tools
22 | - [Git](Git)
23 |
24 | - ## Data Science
25 | - [Introduction](Data%20Science/Introduction)
26 | - [Linear Algebra](Data%20Science/Linear%20Algebra)
27 | - [Statistics](Data%20Science/Statistics)
28 |
29 | - ## Projects
30 | - **Programming**
31 | - Telegram
32 | - [Template-Telegram-Bot](https://github.com/pytopia/project-template-telegram-bot)
33 | - [Nashenas-Telegram-Bot](https://github.com/pytopia/project-nashenas-telegram-bot)
34 | - [Telegram-Statistics](https://github.com/pytopia/project-telegram-statistics)
35 | - File Handler
36 | - [Clean Directory](https://github.com/pytopia/project-clean-directory)
37 |
38 | - **Data Science**
39 | - Coming Soon...
40 |
41 |
42 | ## How to Contribute
43 |
44 | We are very happy to receive and merge your contributions into this repository!
45 |
46 | To contribute via pull request, please read [How to Contribute](CONTRIBUTING.md)
--------------------------------------------------------------------------------
/Tools/VSCode.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# VSCode"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "## Extensions"
15 | ]
16 | },
17 | {
18 | "cell_type": "markdown",
19 | "metadata": {},
20 | "source": [
21 | "1. [python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)\n",
22 | "2. [TODO Highlight](https://marketplace.visualstudio.com/items?itemName=wayou.vscode-todo-highlight)\n",
23 | "3. [Python Docstring Generator](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring)"
24 | ]
25 | }
26 | ],
27 | "metadata": {
28 | "kernelspec": {
29 | "display_name": "Python 3",
30 | "language": "python",
31 | "name": "python3"
32 | },
33 | "language_info": {
34 | "codemirror_mode": {
35 | "name": "ipython",
36 | "version": 3
37 | },
38 | "file_extension": ".py",
39 | "mimetype": "text/x-python",
40 | "name": "python",
41 | "nbconvert_exporter": "python",
42 | "pygments_lexer": "ipython3",
43 | "version": "3.7.9"
44 | }
45 | },
46 | "nbformat": 4,
47 | "nbformat_minor": 4
48 | }
49 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-minimal
--------------------------------------------------------------------------------
/images/banners/python-advanced.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/banners/python-advanced.png
--------------------------------------------------------------------------------
/images/banners/python-basics.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/banners/python-basics.png
--------------------------------------------------------------------------------
/images/banners/python-modular.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/banners/python-modular.png
--------------------------------------------------------------------------------
/images/banners/python-modules.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/banners/python-modules.png
--------------------------------------------------------------------------------
/images/banners/python-oop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/banners/python-oop.png
--------------------------------------------------------------------------------
/images/banners/python-practice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/banners/python-practice.png
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/logo.png
--------------------------------------------------------------------------------
/images/logos/checkmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/logos/checkmark.png
--------------------------------------------------------------------------------
/images/logos/checkmark_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/logos/checkmark_white.png
--------------------------------------------------------------------------------
/images/logos/light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/logos/light.png
--------------------------------------------------------------------------------
/images/logos/python.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/logos/python.png
--------------------------------------------------------------------------------
/images/logos/toc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/logos/toc.png
--------------------------------------------------------------------------------
/images/logos/web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/logos/web.png
--------------------------------------------------------------------------------
/images/memes/functions.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/memes/functions.jpg
--------------------------------------------------------------------------------
/images/memes/jobs.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/memes/jobs.jpg
--------------------------------------------------------------------------------
/images/memes/memory.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pytopia/CS-Tutorial/3853a92830efe8827a90911d1ae0bdb6eb539bf0/images/memes/memory.jpg
--------------------------------------------------------------------------------