├── .editorconfig ├── .gitignore ├── README.md ├── ideas.md └── presentations ├── 12 Factor App ├── content.md ├── images │ ├── aas.png │ ├── attached-resources.png │ ├── ci-cd.png │ ├── codebase-deploys.png │ ├── docker.png │ ├── horizontal-vs-vertical-scaling.png │ ├── process-types.png │ └── release.png ├── index.html └── static │ └── style.css ├── Anti-patterns └── anti-patterns.pdf ├── Async-Programming ├── content.md ├── images │ └── long-web-request-async.gif ├── index.html └── static │ └── style.css ├── Container Orchestration └── Container Orchestration.pdf ├── DBMS └── quera.L&D.DBMSs.pdf ├── Dependency Injection └── Dependency Injection.pdf ├── GraphQL └── graphql_project │ ├── .gitignore │ ├── blog │ ├── __init__.py │ ├── admin.py │ ├── apps.py │ ├── migrations │ │ ├── 0001_initial.py │ │ ├── 0002_auto_20210105_0935.py │ │ └── __init__.py │ ├── models.py │ ├── schema.py │ ├── tests.py │ ├── urls.py │ └── views.py │ ├── data.json │ ├── graphql_project │ ├── __init__.py │ ├── asgi.py │ ├── schema.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py │ ├── manage.py │ ├── react_app │ ├── .graphqlconfig │ ├── README.md │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── robots.txt │ ├── schema.graphql │ ├── src │ │ ├── App.css │ │ ├── App.tsx │ │ ├── Components │ │ │ ├── Category.tsx │ │ │ ├── CategoryContainer.tsx │ │ │ ├── InputField.tsx │ │ │ ├── Loading.tsx │ │ │ ├── Post.tsx │ │ │ └── PostContainer.tsx │ │ ├── actions.ts │ │ ├── context.tsx │ │ ├── index.tsx │ │ ├── queries.ts │ │ ├── react-app-env.d.ts │ │ ├── reducer.ts │ │ └── types.ts │ └── tsconfig.json │ ├── readme.md │ └── requirements.txt ├── Introduction_to_Prometheus └── intro_to_Prometheus.pdf ├── Measuring-Test-Effectiveness ├── content.md ├── demo-js │ ├── .babelrc │ ├── .gitignore │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── logo192.png │ │ ├── logo512.png │ │ ├── manifest.json │ │ └── robots.txt │ ├── src │ │ ├── App.css │ │ ├── App.js │ │ ├── App.test.js │ │ ├── index.css │ │ ├── index.js │ │ └── setupTests.js │ └── stryker.conf.js ├── images │ ├── X-X-Everywhere.jpg │ ├── any-questions.jpg │ ├── ariane-5-bg.jpg │ ├── ariane-5.jpg │ ├── bugs-everywhere.jpg │ ├── cfg.png │ ├── cfg.xml │ ├── dark-knight-lighter.jpg │ ├── dark-knight.jpg │ ├── demillo.jpg │ ├── demillo.png │ ├── first-bug.jpg │ ├── generic-mutators.png │ ├── generic-mutators.txt │ ├── knight-bg-2.jpg │ ├── knight-bg.jpg │ ├── knight-capital.jpg │ ├── lipton-demillo.png │ ├── lipton.jpg │ ├── mars-bg.jpg │ ├── react-instantsearch.png │ ├── stryker-bg.png │ ├── therac-25-2.jpg │ ├── therac-25.jpg │ ├── therac-25.png │ ├── xmen-1.png │ └── xmen-2.png ├── index.html └── static │ └── style.css ├── New Python Features ├── content.md ├── images │ ├── python-logo.svg │ └── walrus.jpg ├── index.html └── static │ └── style.css ├── OWASP-Top-Ten ├── content.md ├── demo │ ├── db.sqlite3 │ ├── demo │ │ ├── __init__.py │ │ ├── settings.py │ │ ├── urls.py │ │ └── wsgi.py │ ├── demoapp │ │ ├── __init__.py │ │ ├── apps.py │ │ ├── templates │ │ │ └── demoapp │ │ │ │ ├── index.html │ │ │ │ └── injection.html │ │ └── views.py │ └── manage.py ├── images │ ├── OWASP-mark.png │ ├── any-questions.jpg │ ├── attack-knowledge.png │ ├── cia-triad.png │ ├── cybersecurity-statistics-2020-1-overall-1.png │ ├── cybersecurity-statistics-2020-2-data-breach-1.png │ ├── cybersecurity-statistics-2020-3-crime-1.png │ ├── cybersecurity-statistics-2020-4-compliance-1.png │ ├── cybersecurity-statistics-2020-5-costs-1.png │ ├── heartbleed.png │ ├── mitm.png │ ├── owasp-2013-2017.png │ ├── owasp-risk-factors.png │ ├── owasp.png │ ├── privilege-escalation.png │ ├── security-risk.png │ ├── sql-injection.png │ ├── vulnerability.png │ └── xkcd-heartbleed.png ├── index.html └── static │ └── style.css ├── RegEx └── Quera.L&D.RegEx.pdf ├── Reinforcement learning └── intro.pdf ├── SOLID-principles ├── content.md ├── images │ ├── solid_1_srp_fun.jpg │ ├── solid_2_ocp.jpg │ ├── solid_2_ocp.png │ ├── solid_2_ocp_full.png │ ├── solid_2_ocp_fun.jpeg │ ├── solid_3_lsp_fun.jpg │ ├── solid_4_isp_fun.jpeg │ ├── solid_5_dip_fun.jpeg │ ├── solid_domino.png │ ├── solid_graphical.png │ └── solid_oop_fun.jpg ├── index.html └── static │ └── style.css ├── Theory-of-Computation-1 ├── content.md ├── images │ ├── any-questions.jpg │ ├── bg │ │ ├── abacus.jpg │ │ ├── dominos.jpg │ │ ├── imitation-game.jpg │ │ └── kent-tupas-u7SCebzS57Q-unsplash.jpg │ ├── book-cover.png │ └── figures │ │ ├── fig1.png │ │ ├── fig10.png │ │ ├── fig2.png │ │ ├── fig3.png │ │ ├── fig4.png │ │ ├── fig5.png │ │ ├── fig6.png │ │ └── fig7.png ├── index.html └── static │ └── style.css ├── gRPC └── index.html └── static ├── favicon.ico └── remark.0.14.0.min.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | indent_style = space 7 | indent_size = 4 8 | end_of_line = lf 9 | max_line_length = 120 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | charset = utf-8 13 | 14 | # Do not add "md" here! It breaks Markdown re-formatting in PyCharm. 15 | [*.{js,ts,jsx,tsx,json,yml,yaml}] 16 | indent_size = 2 17 | 18 | [*.md] 19 | # Shorter lines in documentation files improves readability 20 | max_line_length = 80 21 | # 2 spaces at the end of a line forces a line break in MarkDown 22 | trim_trailing_whitespace = false 23 | 24 | [Makefile] 25 | indent_style = tab 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.pyc 3 | __pycache__ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Software Engineering Talks at Quera 2 | 3 | At Quera's engineering team, we have presentations about various topics 4 | including but not limited to software engineering, software development, new 5 | technologies, best practices, ... 6 | 7 | We publish our presentations here to keep them organized and make them 8 | available to other developers. Some talks are not prepared by our team. 9 | 10 | | Title | Presented by | Presented at | View | Source | 11 | |-------|--------------|--------------|------|--------| 12 | | **New Python Features** | [Mohammad Javad Naderi](https://github.com/mjnaderi) | 2019 Oct 26 | [Slides](https://querateam.github.io/talks/presentations/New%20Python%20Features/) | | 13 | | **Dependency Injection** | [Saeed Tahmasebi](https://github.com/saeed617) | 2019 Nov 9 | [Slides](https://querateam.github.io/talks/presentations/Dependency%20Injection/Dependency%20Injection.pdf) | | 14 | | **Anti-patterns** | [Mehran Salmani](https://github.com/mehransi) | 2019 Nov 27 | [Slides](https://querateam.github.io/talks/presentations/Anti-patterns/anti-patterns.pdf) | | 15 | | **12 Factor App** | [Arian Akbari](https://github.com/arianakbari) | 2020 Feb 5 | [Slides](https://querateam.github.io/talks/presentations/12%20Factor%20App/) | | 16 | | **SOLID Principles** | [Peyman Najafi](https://github.com/peynaj) | 2020 Feb 18 | [Slides](https://querateam.github.io/talks/presentations/SOLID-principles) | | 17 | | **The Perils of Inheritance** | Ariel Ortiz | 2020 Mar 29 | [Video](https://www.youtube.com/watch?v=YXiaWtc0cgE) - [Slides](https://docs.google.com/presentation/d/e/2PACX-1vRNv4rLHUdM03wPOfe8GuqZQWjrVKfaDtULV2K_qVa4oHkR4WPfjsYaQy22sCuZcoAO26WToGcI7HME/pub?start=false&loop=false&delayms=3000&slide=id.g567ca5727c_0_67) | PyCon 2019 | 18 | | **gRPC** | [Mohammad Jafari](https://linkedin.com/in/mjafari98) | 2020 Sep 23 | [Video](https://quera.ir/qbox/view/sBzkBRraFP/grpc.mp4) - [Slides](https://querateam.github.io/talks/presentations/gRPC/) | | 19 | | **Async-Programming** | [Peyman Najafi](https://github.com/peynaj) | 2020 Oct 21 | [Slides](https://querateam.github.io/talks/presentations/Async-Programming/) | | 20 | | **WWH of Testing:
What, Why and How to Test** | [Abdollah Keshtkar](https://github.com/HamadTheIronside) | 2020 Oct 28 | [Video](https://quera.ir/qbox/view/588alqgiHm/Test.mp4) - [Slides](https://docs.google.com/presentation/d/1tsw0WAwfFzGhypr8ZX0fNCbw2ixQbrvRpLxCfsbbJVM/edit?usp=sharing) | | 21 | | **OWASP Top Ten** | [Mohammad Javad Naderi](https://github.com/mjnaderi) | 2020 Nov 25 | [Video](https://quera.ir/qbox/view/RU2C4ZPhWX/OWASP.mp4) - [Slides](https://querateam.github.io/talks/presentations/OWASP-Top-Ten/) | | 22 | | **Container Orchestration** | [Mehran Salmani](https://github.com/mehransi) | 2020 Dec 19 | [Slides](https://querateam.github.io/talks/presentations/Container%20Orchestration/Container%20Orchestration.pdf) | | 23 | | **DBMS types** | [Peyman Najafi](https://github.com/peynaj) | 2021 Jan 03 | [Slides](https://querateam.github.io/talks/presentations/DBMS/quera.L%26D.DBMSs.pdf) | | 24 | | **GraphQL** | [Abdollah Keshtkar](https://github.com/HamadTheIronside) | 2021 Jan 06 | [Slides](https://docs.google.com/presentation/d/15qQ3F9UvttgneID8KAdug_UnWFzWcaQm0zxYLmvUhDM/edit?usp=sharing) | | 25 | | **Python AsyncIO** | [AmirHossein Safavi](https://github.com/AmirSbss) | 2021 Jan 16 | [Slides](https://docs.google.com/presentation/d/1NMLJHt-Fnbloxs2p6TzQDzbHoe3ytFALk5L_Wed-Dow/edit?usp=sharing) | | 26 | | **Measuring Test Effectiveness** | [Mohammad Javad Naderi](https://github.com/mjnaderi) | 2021 Jan 30 | [Video](https://quera.ir/qbox/view/lmKhTFjgjn/Measuring-Test-Effectiveness.webm) - [Slides](https://querateam.github.io/talks/presentations/Measuring-Test-Effectiveness/) | | 27 | | **Introduction to Reinforcement Learning** | [Mehran Salmani](https://github.com/mehransi) | 2021 March 13 | [Slides](https://querateam.github.io/talks/presentations/Reinforcement%20learning/intro.pdf) | | 28 | | **Regular Expressions** | [Peyman Najafi](https://github.com/peynaj) | 2021 April 14 | [Slides](https://querateam.github.io/talks/presentations/RegEx/Quera.L%26D.RegEx.pdf) | | 29 | | **Distributed Databases & NoSQL** | [Danial Keimasi](https://github.com/danialkeimasi) | 2021 May 22 |[Slides](https://docs.google.com/presentation/d/1ptD1vHeVJWgEuLItt8k0wqefySsVu6Qaq8VoAXCGZ5A/present) | | 30 | | **GIL in python** | [Negar Rezaei](https://github.com/negar-r) | 2021 May 29 | [Video](https://quera.ir/qbox/view/ZNZWl5V0zT/Negar-GIL.mkv) - [Slides](https://docs.google.com/presentation/d/1RpHnlqRDa6GvSHMoXbxjpCTcJfzj0OlQH7pm9JbTV5o/present) | | 31 | | **Introduction to the
Theory of Computation
(Part One)** | [Mohammad Javad Naderi](https://github.com/mjnaderi) | 2021 Jul 07 | [Video](https://quera.ir/qbox/view/0hGpuhzMJY/TheoryOfComputation-Part1.mp4) - [Slides](https://querateam.github.io/talks/presentations/Theory-of-Computation-1/) | | 32 | | **Data Base Indexing** | [Mohammadreza Varasteh](https://github.com/The-Daishogun) | 24 Nov 2021 | [Video](https://drive.google.com/file/d/1vhNOlzAvst2EdyZHoF8mhSTnqnRuyr9o/view?usp=sharing) - [Slides](https://docs.google.com/presentation/d/1qy-vqsRK0zC7svaNwyjub6xjWXu2ZO4cNwB2GbSLFjE/edit?usp=sharing) || 33 | | **Reproducibility** | [Mohammad Jafari](https://linkedin.com/in/mjafari98) | 2022 Feb 23 | [Video](https://drive.google.com/file/d/1rZEdrsT7SD-wklNJy_7r50m6SOFYCQJV/view?usp=sharing) - [Slides](https://docs.google.com/presentation/d/1bhX8XQIUGFfW5ccT1S1VV7_GriE7niLiJWXCOQKbu7o/edit?usp=sharing) | | 34 | | **Introduction to Prometheus** | [Mehran Salmani](https://github.com/mehransi) | 2022 May 16 | [Video](https://drive.google.com/file/d/1i2_aUWFwhuMLl2EROK9-AIA0k__AvaeT/view?usp=sharing) - [Slides](https://querateam.github.io/talks/presentations/Introduction_to_Prometheus/intro_to_Prometheus.pdf) 35 | -------------------------------------------------------------------------------- /ideas.md: -------------------------------------------------------------------------------- 1 | # Ideas 2 | 3 | - SSR 4 | - Man in the middle 5 | - Microservices 6 | - Regex 7 | - Dev tools 8 | - Python AsyncIO 9 | - React Design Patterns 10 | - Python Type Hints 11 | - Ansible 12 | - Git in action (scenario-based) 13 | - CI/CD 14 | - GIL 15 | - Elasticsearch 16 | - ELK stack 17 | - Benchmark, Load Test 18 | - IoC Container 19 | - Linux pro max 20 | - Message Queue 21 | - Cryptography 22 | - Algorithms (Ali Shafiee) 23 | - Javascript event loop 24 | - Sass 25 | - How the browser processes a web page 26 | - Arch vs Ubuntu 27 | - Design Patterns 28 | - Bad Smell 29 | - NginX 30 | - WSGI/ASGI 31 | - Polymorphism 32 | - C Binding 33 | - PyPy 34 | - Javascript Promise/Async 35 | - Vue.js 36 | - Why not to use REST? 37 | - NextJS 38 | - Python Gotchas 39 | - Golang 40 | - Rust 41 | - HTTP 1/2/3 42 | - Prometheus 43 | - Python Speed 44 | - OAuth 45 | - Kernel Modules 46 | - Architectural Design Patterns 47 | - Python Compilers 48 | - Who is a Software Engineer? 49 | - Technical Roles (DevOps, SRE, etc) 50 | - Big Data Technologies (Spark, Hadoop, etc) 51 | - Free Software 52 | - Distributed Algorithms 53 | - MapReduce 54 | - Blockchain 55 | - Bitcoin 56 | - Git vs SVN 57 | - Fuzz Testing 58 | -------------------------------------------------------------------------------- /presentations/12 Factor App/content.md: -------------------------------------------------------------------------------- 1 | class: center, middle 2 | 3 |

Software Engineering Patterns

4 | 5 |

12 Factor App

6 | 7 | ### Arian Akbari 8 | 9 |
10 | 11 | Quera 12 | 13 | February 2020 14 | 15 | --- 16 | 17 | class: center,middle 18 | 19 |

Concepts

20 | 21 | --- 22 | 23 | # ...aaS Models 24 | 25 | aaS Models 26 | 27 | --- 28 | 29 | # SaaS 30 | 31 | In the modern era, software is commonly delivered as a service: 32 | - called *web apps* 33 | - or *software-as-a-service* (SaaS) 34 | 35 | A third-party provider hosts applications and makes them available 36 | to customers over the Internet. 37 | 38 | --- 39 | 40 | # Cloud Scalability 41 | 42 | Horizontal vs Vertical Scaling 44 | 45 | - Scale **UP** vs. Scale **OUT** 46 | - You can't scale up forever. 47 | - **Horizontal** scaling is the winner! 48 | 49 | --- 50 | 51 | # CI/CD 52 | 53 | **Continuous Integration (CI)** 54 | - The practice of merging all developer working copies to a shared mainline several times a day. 55 | - To avoid **integration hell** or merge hell 56 | - CI puts a great emphasis on **automated tests** 57 | 58 | **Continuous Delivery (CD)** 59 | - An extension of continuous integration to make sure that 60 | you can release new changes to your customers **quickly** in a **sustainable** way. 61 | - Release process is automated. You can decide to release daily, weekly, ... 62 | 63 | **Continuous Deployment (CD)** 64 | - No release day. No human intervention. Only a failed test will prevent a new change to be deployed to production. 65 | 66 | --- 67 | class: center,middle 68 | 69 | # CI/CD & DevOps 70 | 71 | 72 | 73 | --- 74 | 75 | class: center,middle 76 | 77 |

Introduction

78 | 79 | --- 80 | 81 | # 12 Factor App? 82 | 83 | > Guidelines for building scalable **SaaS** (software-as-a-service) apps. 84 | 85 | - **Raises awareness** of some systemic problems in modern app development 86 | - Provides a **shared vocabulary** for discussing those problems 87 | - Offers a set of **conceptual solutions** 88 | 89 | --- 90 | 91 | # Why is it important? 92 | 93 | - **Declarative** formats for setup automation 94 | - **Minimize divergence** between prod/dev 95 | - **Maximum portability** between execution environments 96 | - Deployment on modern **cloud platforms** 97 | - Enables **continuous deployment** 98 | - **Scale** easily 99 | 100 | --- 101 | 102 | # History 103 | 104 | - Manifesto written around **2012** 105 | - By **Adam Wiggins** 106 | - at **Heroku** (Early cloud PaaS) 107 | - Website: 12factor.net 108 | 109 | --- 110 | 111 | # For Who? 112 | 113 | - Any **developer** building applications which run as a **service** 114 | - **Ops engineers** who deploy or manage such applications 115 | 116 | --- 117 | class: center,middle 118 | 119 | # And Docker! 120 | 121 | Docker 122 | 123 | Docker helps you with 12 factor app a lot! 124 | 125 | --- 126 | 127 | class:center,middle 128 | 129 |

The Factors

130 | 131 | --- 132 | 133 | layout: true 134 | 135 | ## The Factors 136 | 137 | --- 138 | 139 | | | | 140 | |----------------------------|----------------------------------------------------| 141 | | **1. Codebase** | One codebase, many deploys | 142 | | **2. Dependencies** | Explicitly declare and isolate | 143 | | **3. Config** | Store in the environment | 144 | | **4. Backing Services** | Treat as attached resources | 145 | | **5. Build, Release, Run** | Strictly separate build & run stages | 146 | | **6. Processes** | Execute the app as one or more stateless processes | 147 | 148 | --- 149 | 150 | | | | 151 | |-------------------------|----------------------------------------------------------------------| 152 | | **7. Port Binding** | Export services via port binding | 153 | | **8. Concurrency** | Scale out via the process model | 154 | | **9. Disposability** | Maximize robustness
with fast startup and graceful shutdown | 155 | | **10. Dev/Prod Parity** | Keep development, staging, and production
as similar as possible | 156 | | **11. Logs** | Treat logs as event streams | 157 | | **12. Admin Processes** | Run admin/management tasks as one-off processes | 158 | 159 | --- 160 | layout: false 161 | 162 | ## 1. Codebase 163 | 164 | > One codebase (repo) tracked in revision control, many deploys 165 | 166 | Codebase Deploys 167 | 168 | - Single app per repo (1-to-1) 169 | - Multiple repos 170 | - not an app 171 | - a distributed system 172 | 173 | 174 | --- 175 | 176 | ## 2. Dependencies 177 | 178 | > Explicitly declare and isolate dependencies 179 | 180 | - Never rely on implicit existence of system-wide packages 181 | - ... or system tools (e.g. curl, ImageMagick) 182 | - Supports reproducible builds 183 | 184 |

185 | 186 | - Declare dependencies in a **manifest** 187 | - `pip`, `requirements.txt`, `pyproject.toml` 188 | - Use a dependency **isolation** tool 189 | - `virtualenv` 190 | 191 |

192 | 193 | **HIGH IMPORTANCE!** 194 | 195 | --- 196 | layout: true 197 | 198 | ## 3. Config 199 | 200 | > Store config in the environment 201 | 202 | --- 203 | 204 | Config is anything that may **vary between deploys** 205 | - Including: 206 | - Resource handles (database, cache, ...) 207 | - Credentials 208 | - Per-deploy values (e.g. canonical hostname) 209 | - Does not include internal application config that don't vary between deploys 210 | - They should be in the code 211 | 212 | --- 213 | 214 | Store config in **environment variables** 215 | - Strict separation of config from code 216 | - language-agnostic, OS-agnostic 217 | - Granular control, orthogonality 218 | - Instead of **grouping** configs into named groups (e.g. `development`, `test`, `production`) 219 | which does not scale cleanly. 220 | 221 | Tools exist that load config from `.env` files 222 | - `python-dotenv`, `phpdotenv`, `dotenv` for Node.js, ... 223 | 224 | --- 225 | layout: true 226 | 227 | ## 4. Backing Services 228 | 229 | --- 230 | 231 | > Treat backing services as attached resources 232 | 233 | |   | Local | Third-party | 234 | |-----------------------------------|----------------------|--------------------| 235 | | **Databases** | PostgreSQL, CouchDB | Amazon RDS | 236 | | **Caching systems** | Memcached, Redis | Amazon Elasticache | 237 | | **Messaging/Queueing systems** | RabbitMQ, Beanstalkd | Amazon SQS | 238 | | **SMTP services** | Postfix | Mailgun | 239 | | **Storage services** | | Amazon S3 | 240 | | ... | | | 241 | 242 | --- 243 | 244 | **No distinction between local and third party services** 245 | - Allows great flexibility 246 | - Loose coupling to the attached deploy 247 | - Resources can be _attached_ and _detached_ to deploys at will, **no code changes** 248 | - e.g. You can easily swap local PostgreSQL with another DB server of your own, or Amazon RDS. 249 | 250 | Attached Resources 251 | 252 | --- 253 | layout: true 254 | 255 | ## 5. Build, Release, Run 256 | 257 | > Strictly separate **build**, **release** and **run** stages 258 | 259 | --- 260 | 261 | - **Build** : Converts code repo into an executable bundle 262 | - **Release** : Build with deploy's current config, ready for immediate execution 263 | - **Run** : Launches a set of app's processes against a selected release 264 | 265 | Release 266 | 267 | --- 268 | 269 | - It is impossible to make changes to the code at runtime. 270 | - Releases should have unique ID. 271 | - Releases cannot be mutated. Any change must create a new release. 272 | - You can **rollback** to previous release ID. 273 | 274 | --- 275 | layout: false 276 | 277 | ## 6. Processes 278 | 279 | > Execute the app as one or more stateless _processes_ 280 | 281 | Processes should be **stateless** and **share-nothing**. 282 | - Any data that needs to persist must be stored in a stateful backing service, typically a database. 283 | 284 | Caching 285 | - The memory space of process can be used as cache **just for a single transaction**! 286 | - Use caching service (e.g. Redis) for inter-process cache. 287 | - e.g. for user session data 288 | 289 | Asset compilation 290 | - Should be in **build** stage. 291 | 292 | --- 293 | 294 | ## 7. Port binding 295 | 296 | > Export services via port binding 297 | 298 | - App **should be self-contained** and export its services 299 | - Exports services (e.g. HTTP) by binding to a port and awaiting incoming requests 300 | - A routing layer (e.g. nginx) is used to route requests from a public-facing hostname to the port-bound web processes 301 | - Typically a webserver library is added to app as a dependency. 302 | - e.g. Jetty for JVM, Thin for Ruby, Tornado/uWSGI for Python 303 | - One app can become the backing service for another app 304 | 305 | --- 306 | layout: true 307 | ## 8. Concurrency 308 | 309 | > Scale out via the process model 310 | 311 | --- 312 | 313 | Concurrency 314 | 315 | - Individual processes can handle their own internal multiplexing 316 | - via threads, async/evented, ... 317 | - **BUT**, app must be able to span multiple **processes**! 318 | - Processes are a first class citizen 319 | 320 | --- 321 | 322 | - Never self-daemonize or write PID files 323 | - Instead, use OS process manager 324 | - e.g. `systemd` 325 | - Manage output streams, Respond to crashed processes, Handle restarts and shutdowns 326 | 327 | --- 328 | layout: false 329 | 330 | ## 9. Disposability 331 | 332 | > Maximize robustness with **fast startup** and **graceful shutdown** 333 | 334 | - Processes should be **disposable**: 335 | - Start **quickly** 336 | - Shutdown **gracefully** (when receiving `SIGTERM`) 337 | - Be robust against **sudden death** 338 | - Fast startup provides more agility for the release process and scaling up 339 | 340 | --- 341 | ## 10. Dev/Prod parity 342 | 343 | > Keep development, staging, and production as similar as possible 344 | 345 | - Designed for continuous deployment (CD) 346 | - Keep the **gap** between development and production small: 347 | - **Time gap**: long time to prod **vs.** CI & deploy ASAP 348 | - **Personnel gap**: developers code, ops deploy **vs.** Devops 349 | - **Tools gap**: different stack **vs.** similar stack 350 | - Resists to use different backing services between dev and prod 351 | 352 | --- 353 | 354 | ## 11. Logs 355 | 356 | > Treat logs as event streams 357 | 358 | - App never concerns itself with **routing** or **storage** of its output stream 359 | - Event stream is written to `STDOUT` 360 | - Captured by execution environment 361 | - Use log routers (such as Logplex and Fluentd) 362 | 363 | --- 364 | 365 | ## 12. Admin Processes 366 | 367 | > Run admin/management tasks as one-off processes 368 | 369 | One-off admin tasks include: 370 | - DB migrations (`manage.py migrate`) 371 | - Console / REPL Shell (`manage.py shell`) 372 | - One-time scripts committed into repo (`scripts/fix_bad_records.py`) 373 | 374 | Admin tasks 375 | - Run as separate process 376 | - Run against the same release 377 | - Admin code must ship with app code 378 | - Same dependency isolation techniques (e.g. use the same virtualenv) 379 | 380 | --- 381 | 382 | class: center,middle 383 | 384 | # Thank You! 385 | 386 | --- 387 | 388 | layout: false 389 | ## References 390 | 391 | 392 | https://12factor.net 393 | 394 | https://dev.to/heroku/twelve-factor-apps-a-retrospective-and-look-forward-4j4f 395 | 396 | https://medium.com/hashmapinc/how-i-use-the-twelve-factor-app-methodology-for-building-saas-applications-with-java-scala-4cdb668cc908 397 | 398 | https://dev.to/simon_sugob/the-twelve-factor-appa-successful-microservices-guideline-3a1h 399 | 400 | https://www.slideshare.net/rudiyardley/the-12-factor-app?qid=d56bf5db-74b9-48ed-a1be-360771b56cdc&v=&b=&from_search=1 401 | 402 | https://www.slideshare.net/labianchin/12-factor-app?qid=d56bf5db-74b9-48ed-a1be-360771b56cdc&v=&b=&from_search=7 403 | 404 | http://pudgylogic.blogspot.com/2016/01/horizontal-vs-vertical-scaling.html 405 | 406 | --- 407 | ## References 408 | 409 | https://www.slideshare.net/HazzimAnaya/cicd-devops-101?qid=e0c5bcaa-f031-459b-8786-22316f5e6799&v=&b=&from_search=28 410 | 411 | https://www.infoworld.com/article/3271126/what-is-cicd-continuous-integration-and-continuous-delivery-explained.html 412 | 413 | https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment 414 | 415 | 416 | ## Report Issues 417 | 418 | If you found an issue or have a suggestion, feel free to contact us. 419 | 420 | Report Issues -------------------------------------------------------------------------------- /presentations/12 Factor App/images/aas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/12 Factor App/images/aas.png -------------------------------------------------------------------------------- /presentations/12 Factor App/images/attached-resources.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/12 Factor App/images/attached-resources.png -------------------------------------------------------------------------------- /presentations/12 Factor App/images/ci-cd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/12 Factor App/images/ci-cd.png -------------------------------------------------------------------------------- /presentations/12 Factor App/images/codebase-deploys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/12 Factor App/images/codebase-deploys.png -------------------------------------------------------------------------------- /presentations/12 Factor App/images/docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/12 Factor App/images/docker.png -------------------------------------------------------------------------------- /presentations/12 Factor App/images/horizontal-vs-vertical-scaling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/12 Factor App/images/horizontal-vs-vertical-scaling.png -------------------------------------------------------------------------------- /presentations/12 Factor App/images/process-types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/12 Factor App/images/process-types.png -------------------------------------------------------------------------------- /presentations/12 Factor App/images/release.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/12 Factor App/images/release.png -------------------------------------------------------------------------------- /presentations/12 Factor App/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The Twelve Factor App 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 41 | 42 | -------------------------------------------------------------------------------- /presentations/12 Factor App/static/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); 2 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); 3 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,900); 4 | 5 | body { 6 | font-family: 'Lato', sans-serif; 7 | color: #eee; 8 | } 9 | 10 | strong, b { 11 | color: #FFF; 12 | font-weight: 900; 13 | } 14 | 15 | .remark-slide-content { 16 | background: #444 !important; 17 | } 18 | 19 | h1, h2, h3 { 20 | font-family: 'Yanone Kaffeesatz', sans-serif; 21 | font-weight: normal; 22 | } 23 | 24 | h3 { 25 | font-size: 32px !important; 26 | } 27 | 28 | h1 > code, h2 > code, h3 > code { 29 | font-size: .8em; 30 | } 31 | 32 | h2 { 33 | font-size: 42px !important; 34 | } 35 | 36 | p, ul, ol { 37 | line-height: 1.5em; 38 | } 39 | 40 | li { 41 | margin: .5em 0; 42 | } 43 | 44 | code { 45 | font-family: 'Ubuntu Mono', monospace; 46 | } 47 | 48 | .remark-inline-code { 49 | background-color: rgba(255,255,255,0.12); 50 | border-radius: .2em; 51 | padding: 0 .3em .1em; 52 | } 53 | 54 | pre code { 55 | color: #333; 56 | background: #f6f6f6; 57 | border: 1px solid #ddd; 58 | border-radius: .4em; 59 | display: block; 60 | padding: .5em; 61 | } 62 | 63 | .hljs-github .hljs { 64 | background: #f6f6f6 !important; 65 | border: 1px solid #ddd; 66 | border-radius: .4em; 67 | } 68 | 69 | pre { 70 | border-radius: .4em; 71 | line-height: 1.1em; 72 | overflow-x: auto; 73 | } 74 | 75 | table th { 76 | text-align: initial; 77 | border-bottom: 1px solid #aaa; 78 | } 79 | 80 | table td:empty, table th:empty { 81 | visibility: hidden; 82 | } 83 | 84 | table tbody td, table thead th { 85 | padding: .4em; 86 | line-height: 1.5em; 87 | } 88 | 89 | .remark-slide-content a { 90 | color: skyblue; 91 | text-decoration: none; 92 | } 93 | 94 | .remark-slide-content img { 95 | margin: auto; 96 | background:white; 97 | } 98 | 99 | blockquote { 100 | margin: 1em 0; 101 | } 102 | 103 | blockquote > p { 104 | padding: 1em; 105 | background: rgba(255,255,255,0.1); 106 | } -------------------------------------------------------------------------------- /presentations/Anti-patterns/anti-patterns.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Anti-patterns/anti-patterns.pdf -------------------------------------------------------------------------------- /presentations/Async-Programming/content.md: -------------------------------------------------------------------------------- 1 | class: center, middle 2 | 3 |

Async Programming

4 | ## Peyman Najafi 5 | ##

Quera

6 | October 2020 7 | 8 | --- 9 | class: middle 10 | 11 | - ### Occurrence of events independent of the main program flow. 12 | - ### Without the program blocking to wait for results. 13 | - ### Asynchronous input/output: lets programs issue commands to storage or network devices that service these requests while the processor continues executing the program 14 | 15 | --- 16 | class: middle 17 | 18 | - ### Subroutines (methods, functions) that return to their caller an object: 19 | - Future: read-only placeholder view of a variable 20 | - Promise: writable, single assignment container which sets the value of the future 21 | - #### The future is the value, the promise is the function that sets the value 22 | - #### Setting the value of a future is also called resolving, fulfilling, or binding it. 23 | 24 | --- 25 | class: middle 26 | 27 | ### Examples of asynchrony 28 | 29 | - #### Ajax (short for "asynchronous JavaScript and XML) 30 | - #### AMD (Asynchronous method dispatch): data communication method for the server side to handle a large number of long lasting client requests 31 | 32 | --- 33 | class: middle 34 | 35 | ### Scenarios for Async 36 | 37 | - #### 1. I/O operations: 38 | - making a network call, talking to a database, reading a file, printing a document 39 | 40 | - #### 2. multiple operations in parallel: 41 | - database call, web service call 42 | 43 | 44 | --- 45 | class: middle 46 | 47 | - #### 3. Long-running event-driven requests 48 | - Message-based application servers (messages queue) 49 | solid oop 54 | 55 | --- 56 | class: 57 | 58 | # When to Use (and Not to Use) Asynchronous Programming 59 | 60 | - preloading required data when the app first begins 61 | 62 | - asynchronously updating records that are dependent or depended upon 63 | 64 | - single database server without connection pooling (all requests hit the same database using a long running connection) 65 | 66 | - run simple or short running operations 67 | 68 | - one resource used by different elements or single thread is responsible for a resource or functionality 69 | (conflicts in proper sequence) 70 | 71 | - forced into asynchronous programming even though you don’t want it! 72 | 73 | [//]: # (You may be forced into asynchronous programming even though you don’t want it. Example: I programmed an app that queries Google Fusion Tables on program load. However, App Inventor 2 continues executing other blocks even though results of the Fusion Table queries have not returned. Because of this, you had better not make these subsequent code blocks dependent upon query results or you will get errors. This is one case where a programmer uses asynchronous programming when they really shouldn’t.) 74 | 75 | 76 | - make loops asynchronous to avoid blocking the event loop 77 | 78 | --- 79 | class: 80 | 81 | # When to Use (and Not to Use) Asynchronous Programming 82 | 83 | - large number of iterations or complex operations 84 | 85 | - nested anonymous callback functions (AJAX request that depends on an earlier AJAX request) 86 | 87 | - any kind of graphical UI 88 | 89 | - continue with other work that doesn’t depend on the slow or delayed resource 90 | 91 | - requests data from multiple different servers 92 | 93 | - pass SQL write queries to another thread 94 | 95 | [//]: # ( bad!) 96 | [//]: # ( good!) 97 | 98 | --- 99 | class: middle 100 | 101 | # Javascript: Promises 102 | 103 | ```javascript 104 | fetch('products.json').then(function(response) { 105 | 106 | return response.json(); 107 | 108 | }).then(function(json) { 109 | 110 | console.log('Fetch result: ', json); 111 | 112 | }).catch(function(err) { 113 | 114 | console.log('Fetch problem: ' + err.message); 115 | 116 | }); 117 | ``` 118 | 119 | --- 120 | class: middle 121 | 122 | # Event queue 123 | 124 | ```javascript 125 | console.log('Starting'); 126 | let image; 127 | 128 | fetch('coffee.jpg').then((response) => { 129 | console.log('It worked :)') 130 | return response.blob(); 131 | }).then((myBlob) => { 132 | let objectURL = URL.createObjectURL(myBlob); 133 | image = document.createElement('img'); 134 | image.src = objectURL; 135 | document.body.appendChild(image); 136 | }).catch((error) => { 137 | console.log('fetch problem: ' + error.message); 138 | }); 139 | 140 | console.log('All done!'); 141 | ``` 142 | 143 | ```text 144 | Starting 145 | All done! 146 | It worked :) 147 | ``` 148 | 149 | 150 | --- 151 | class: 152 | 153 | # Synchronous queue in Python 154 | 155 | ```python 156 | import queue 157 | 158 | def task(name, work_queue): 159 | if work_queue.empty(): 160 | print(f"Task {name} nothing to do") 161 | else: 162 | while not work_queue.empty(): 163 | count = work_queue.get() 164 | total = 0 165 | print(f"Task {name} running") 166 | for x in range(count): 167 | total += 1 168 | print(f"Task {name} total: {total}") 169 | 170 | work_queue = queue.Queue() 171 | for work in [15, 10, 5, 2]: 172 | work_queue.put(work) 173 | 174 | tasks = [(task, "One", work_queue), (task, "Two", work_queue)] 175 | for t, n, q in tasks: 176 | t(n, q) 177 | 178 | 179 | ``` 180 | 181 | --- 182 | class: middle 183 | 184 | #### > Output: 185 | ```text 186 | Task One running 187 | Task One total: 15 188 | Task One running 189 | Task One total: 10 190 | Task One running 191 | Task One total: 5 192 | Task One running 193 | Task One total: 2 194 | Task Two nothing to do 195 | ``` 196 | 197 | --- 198 | 199 | # Simple Cooperative Concurrency in Python 200 | 201 | ```python 202 | def task(name, queue): 203 | while not queue.empty(): 204 | count = queue.get() 205 | total = 0 206 | print(f"Task {name} running") 207 | for x in range(count): 208 | total += 1 209 | yield 210 | print(f"Task {name} total: {total}") 211 | ``` 212 | 213 | --- 214 | class: middle 215 | 216 | ```python 217 | import queue 218 | 219 | work_queue = queue.Queue() 220 | 221 | for work in [15, 10, 5, 2]: 222 | work_queue.put(work) 223 | 224 | tasks = [task("One", work_queue), task("Two", work_queue)] 225 | 226 | done = False 227 | while not done: 228 | for t in tasks: 229 | try: 230 | next(t) 231 | except StopIteration: 232 | tasks.remove(t) 233 | if len(tasks) == 0: 234 | done = True 235 | ``` 236 | 237 | --- 238 | class: middle 239 | 240 | #### > Output: 241 | 242 | ```text 243 | Task One running 244 | Task Two running 245 | Task Two total: 10 246 | Task Two running 247 | Task One total: 15 248 | Task One running 249 | Task Two total: 5 250 | Task One total: 2 251 | ``` 252 | 253 | --- 254 | class: middle 255 | 256 | # Async IO in Python 257 | 258 | - Asynchronous IO (async IO): a language-agnostic paradigm that has implementations across a host of programming languages 259 | - `asyncio`: the Python package that provides a foundation and API for running and managing coroutines 260 | - introduced in Python 3.4 261 | - `async/await`: two new Python keywords that are used to define coroutines 262 | 263 | --- 264 | class: middle 265 | 266 | # `async` 267 | - `async def` 268 | - a native coroutine or an asynchronous generator 269 | - `async with` 270 | - `async for` 271 | 272 | --- 273 | class: middle 274 | 275 | # `await` 276 | - passes function control back to the event loop 277 | 278 | ```python 279 | async def g(): 280 | # Pause here and come back to g() when f() is ready 281 | r = await f() 282 | return r 283 | ``` 284 | 285 | --- 286 | class: middle 287 | 288 | ```python 289 | async def f(x): 290 | y = await z(x) # OK - `await` and `return` allowed in coroutines 291 | return y 292 | 293 | async def g(x): 294 | yield x # OK - this is an async generator 295 | 296 | async def m(x): 297 | yield from gen(x) # No - SyntaxError 298 | 299 | def m(x): 300 | y = await z(x) # Still no - SyntaxError (no `async def` here) 301 | return y 302 | ``` 303 | --- 304 | class: middle 305 | 306 | #### `asyncio.sleep`, `asyncio.gather`, `asyncio.run` 307 | ```python 308 | # countasync.py 309 | 310 | import asyncio 311 | 312 | async def count(): 313 | print("One") 314 | await asyncio.sleep(1) 315 | print("Two") 316 | 317 | async def main(): 318 | await asyncio.gather(count(), count(), count()) 319 | 320 | if __name__ == "__main__": 321 | import time 322 | s = time.perf_counter() 323 | asyncio.run(main()) 324 | elapsed = time.perf_counter() - s 325 | print(f"{__file__} executed in {elapsed:0.2f} seconds.") 326 | ``` 327 | 328 | ```text 329 | One 330 | One 331 | One 332 | Two 333 | Two 334 | Two 335 | countasync.py executed in 1.01 seconds. 336 | ``` 337 | 338 | --- 339 | class: middle 340 | 341 | ```python 342 | # countsync.py 343 | 344 | import time 345 | 346 | def count(): 347 | print("One") 348 | time.sleep(1) 349 | print("Two") 350 | 351 | def main(): 352 | for _ in range(3): 353 | count() 354 | 355 | if __name__ == "__main__": 356 | s = time.perf_counter() 357 | main() 358 | elapsed = time.perf_counter() - s 359 | print(f"{__file__} executed in {elapsed:0.2f} seconds.") 360 | ``` 361 | 362 | ```text 363 | One 364 | Two 365 | One 366 | Two 367 | One 368 | Two 369 | countsync.py executed in 3.01 seconds. 370 | ``` 371 | 372 | --- 373 | class: middle 374 | 375 | # generator-based coroutine 376 | 377 | ```python 378 | import asyncio 379 | 380 | @asyncio.coroutine 381 | def py34_coro(): 382 | """Generator-based coroutine, older syntax""" 383 | yield from stuff() 384 | 385 | async def py35_coro(): 386 | """Native coroutine, modern syntax""" 387 | await stuff() 388 | ``` 389 | 390 | --- 391 | 392 | - 3.3: The `yield from` expression allows for generator delegation. 393 | 394 | - 3.4: `asyncio` was introduced in the Python standard library with provisional API status. 395 | 396 | - 3.5: `async` and `await` became a part of the Python grammar, used to signify and wait on coroutines. They were not yet reserved keywords. (You could still define functions or variables named async and await.) 397 | 398 | - 3.6: `Asynchronous generators` and `asynchronous comprehensions` were introduced. The API of asyncio was declared stable rather than provisional. 399 | 400 | - 3.7: `async and await` became reserved keywords. 401 | - They are intended to replace the `asyncio.coroutine()` decorator. 402 | - `asyncio.run()` was introduced to the asyncio package, among a bunch of other features. 403 | 404 | --- 405 | class: center, middle 406 | 407 | # Thank You! 408 | 409 | --- 410 | layout: false 411 | 412 | ## References 413 | 414 | - https://www.codemag.com/Article/0102091/Handling-long-Web-Requests-with-Asynchronous-Request-Processing 415 | - https://stackify.com/when-to-use-asynchronous-programming/amp/ 416 | - https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Asynchronous/Introducing 417 | - https://realpython.com/python-async-features/ 418 | - https://realpython.com/async-io-python/ 419 | 420 |
421 | ## Report Issues 422 | 423 | If you found an issue or have a suggestion, feel free to contact us. 424 | 425 | Report Issues -------------------------------------------------------------------------------- /presentations/Async-Programming/images/long-web-request-async.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Async-Programming/images/long-web-request-async.gif -------------------------------------------------------------------------------- /presentations/Async-Programming/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Async Programming 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /presentations/Async-Programming/static/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); 2 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); 3 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,900); 4 | 5 | body { 6 | font-family: 'Lato', sans-serif; 7 | color: #eee; 8 | } 9 | 10 | strong, b { 11 | color: #FFF; 12 | font-weight: 900; 13 | } 14 | 15 | .remark-slide-content { 16 | background: #444 !important; 17 | } 18 | 19 | h1, h2, h3 { 20 | font-family: 'Yanone Kaffeesatz', sans-serif; 21 | font-weight: normal; 22 | } 23 | 24 | h3 { 25 | font-size: 32px !important; 26 | } 27 | 28 | h1 > code, h2 > code, h3 > code { 29 | font-size: .8em; 30 | } 31 | 32 | h2 { 33 | font-size: 42px !important; 34 | } 35 | 36 | p, ul, ol { 37 | line-height: 1.5em; 38 | } 39 | 40 | li { 41 | margin: .5em 0; 42 | } 43 | 44 | code { 45 | font-family: 'Ubuntu Mono', monospace; 46 | } 47 | 48 | .remark-inline-code { 49 | background-color: rgba(255,255,255,0.12); 50 | border-radius: .2em; 51 | padding: 0 .3em .1em; 52 | } 53 | 54 | pre code { 55 | color: #333; 56 | background: #f6f6f6; 57 | border: 1px solid #ddd; 58 | border-radius: .4em; 59 | display: block; 60 | padding: .5em; 61 | } 62 | 63 | .hljs-github .hljs { 64 | background: #f6f6f6 !important; 65 | border: 1px solid #ddd; 66 | border-radius: .4em; 67 | } 68 | 69 | pre { 70 | border-radius: .4em; 71 | line-height: 1.1em; 72 | overflow-x: auto; 73 | } 74 | 75 | table th { 76 | text-align: initial; 77 | border-bottom: 1px solid #aaa; 78 | } 79 | 80 | table td:empty, table th:empty { 81 | visibility: hidden; 82 | } 83 | 84 | table tbody td, table thead th { 85 | padding: .4em; 86 | line-height: 1.5em; 87 | } 88 | 89 | .remark-slide-content a { 90 | color: skyblue; 91 | text-decoration: none; 92 | } 93 | 94 | .remark-slide-content img { 95 | margin: auto; 96 | background:white; 97 | } 98 | 99 | blockquote { 100 | margin: 1em 0; 101 | } 102 | 103 | blockquote > p { 104 | padding: 1em; 105 | background: rgba(255,255,255,0.1); 106 | } 107 | 108 | .item-title { 109 | font-size: 1.4em; 110 | color: white; 111 | } 112 | 113 | u { 114 | text-decoration: underline; 115 | } -------------------------------------------------------------------------------- /presentations/Container Orchestration/Container Orchestration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Container Orchestration/Container Orchestration.pdf -------------------------------------------------------------------------------- /presentations/DBMS/quera.L&D.DBMSs.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/DBMS/quera.L&D.DBMSs.pdf -------------------------------------------------------------------------------- /presentations/Dependency Injection/Dependency Injection.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Dependency Injection/Dependency Injection.pdf -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/.gitignore: -------------------------------------------------------------------------------- 1 | /venv/ 2 | /db.sqlite3 3 | /react_app/node_modules/ 4 | /react_app/.eslintcache 5 | /react_app/package-lock.json 6 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/GraphQL/graphql_project/blog/__init__.py -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Category, Post 3 | 4 | admin.site.register([Post, Category]) 5 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class BlogConfig(AppConfig): 5 | name = 'blog' 6 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.5 on 2021-01-05 09:29 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='Category', 16 | fields=[ 17 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 18 | ('name', models.CharField(max_length=100)), 19 | ], 20 | ), 21 | migrations.CreateModel( 22 | name='Post', 23 | fields=[ 24 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 25 | ('name', models.CharField(max_length=100)), 26 | ('content', models.TextField()), 27 | ('categories', models.ManyToManyField(to='blog.Category')), 28 | ], 29 | ), 30 | ] 31 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/migrations/0002_auto_20210105_0935.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.1.5 on 2021-01-05 09:35 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('blog', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='post', 15 | name='content', 16 | field=models.TextField(blank=True, null=True), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/GraphQL/graphql_project/blog/migrations/__init__.py -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | class Category(models.Model): 5 | name = models.CharField(max_length=100) 6 | 7 | def related_posts(self): 8 | return self.post_set.all() 9 | 10 | def __str__(self): 11 | return self.name 12 | 13 | 14 | class Post(models.Model): 15 | name = models.CharField(max_length=100) 16 | content = models.TextField(blank=True, null=True) 17 | categories = models.ManyToManyField(Category) 18 | 19 | def __str__(self): 20 | return self.name 21 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/schema.py: -------------------------------------------------------------------------------- 1 | import graphene 2 | from graphene_django import DjangoObjectType 3 | 4 | from .models import Post, Category 5 | 6 | 7 | class PostType(DjangoObjectType): 8 | class Meta: 9 | model = Post 10 | fields = ["id", "name", "content", "categories"] 11 | 12 | 13 | class CategoryType(DjangoObjectType): 14 | class Meta: 15 | model = Category 16 | fields = ["id", "name", "post_set"] 17 | 18 | 19 | class BlogQuery(graphene.ObjectType): 20 | all_categories = graphene.List(CategoryType) 21 | all_posts = graphene.List(PostType) 22 | category_by_name = graphene.List(CategoryType, name=graphene.String(required=True)) 23 | post_by_id = graphene.Field(PostType, id=graphene.Int(required=True)) 24 | posts_by_category_id = graphene.List(PostType, id=graphene.Int(required=True)) 25 | 26 | def resolve_all_categories(self, info): 27 | return Category.objects.all() 28 | 29 | def resolve_all_posts(self, info): 30 | return Post.objects.select_related("categories").all() 31 | 32 | def resolve_category_by_name(self, info, name): 33 | try: 34 | return Category.objects.filter(name__contains=name) 35 | except Category.DoesNotExist: 36 | return None 37 | 38 | def resolve_post_by_id(self, info, id): 39 | try: 40 | return Post.objects.get(id=id) 41 | except Post.DoesNotExist: 42 | return None 43 | 44 | def resolve_posts_by_category_id(self, info, id): 45 | try: 46 | return Post.objects.filter(categories=id) 47 | except Post.DoesNotExist: 48 | return None 49 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/urls.py: -------------------------------------------------------------------------------- 1 | from django.urls import path 2 | 3 | urlpatterns = [] 4 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/blog/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/data.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "model": "blog.category", 4 | "pk": 1, 5 | "fields": { 6 | "name": "RPC" 7 | } 8 | }, 9 | { 10 | "model": "blog.category", 11 | "pk": 2, 12 | "fields": { 13 | "name": "GraphQL" 14 | } 15 | }, 16 | { 17 | "model": "blog.category", 18 | "pk": 3, 19 | "fields": { 20 | "name": "REST" 21 | } 22 | }, 23 | { 24 | "model": "blog.post", 25 | "pk": 1, 26 | "fields": { 27 | "name": "What is GraphQL?", 28 | "content": "", 29 | "categories": [ 30 | 2 31 | ] 32 | } 33 | }, 34 | { 35 | "model": "blog.post", 36 | "pk": 3, 37 | "fields": { 38 | "name": "Queries and Mutations", 39 | "content": null, 40 | "categories": [ 41 | 2 42 | ] 43 | } 44 | }, 45 | { 46 | "model": "blog.post", 47 | "pk": 4, 48 | "fields": { 49 | "name": "Schemas and Types", 50 | "content": null, 51 | "categories": [ 52 | 2 53 | ] 54 | } 55 | }, 56 | { 57 | "model": "blog.post", 58 | "pk": 5, 59 | "fields": { 60 | "name": "Validation", 61 | "content": null, 62 | "categories": [ 63 | 2 64 | ] 65 | } 66 | }, 67 | { 68 | "model": "blog.post", 69 | "pk": 6, 70 | "fields": { 71 | "name": "Execution", 72 | "content": null, 73 | "categories": [ 74 | 2 75 | ] 76 | } 77 | }, 78 | { 79 | "model": "blog.post", 80 | "pk": 7, 81 | "fields": { 82 | "name": "Friendship with Rest and RPC or Enemy?", 83 | "content": null, 84 | "categories": [ 85 | 2 86 | ] 87 | } 88 | }, 89 | { 90 | "model": "blog.post", 91 | "pk": 8, 92 | "fields": { 93 | "name": "GraphQL with Django and React", 94 | "content": null, 95 | "categories": [ 96 | 2 97 | ] 98 | } 99 | }, 100 | { 101 | "model": "blog.post", 102 | "pk": 9, 103 | "fields": { 104 | "name": "Why not to use RPC?", 105 | "content": "", 106 | "categories": [ 107 | 1 108 | ] 109 | } 110 | }, 111 | { 112 | "model": "blog.post", 113 | "pk": 10, 114 | "fields": { 115 | "name": "RPC is not good", 116 | "content": "", 117 | "categories": [ 118 | 1 119 | ] 120 | } 121 | }, 122 | { 123 | "model": "blog.post", 124 | "pk": 11, 125 | "fields": { 126 | "name": "Why we should hate RPC", 127 | "content": "", 128 | "categories": [ 129 | 1 130 | ] 131 | } 132 | } 133 | ] -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/graphql_project/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/GraphQL/graphql_project/graphql_project/__init__.py -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/graphql_project/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for graphql_project project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphql_project.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/graphql_project/schema.py: -------------------------------------------------------------------------------- 1 | import graphene 2 | 3 | from blog.schema import BlogQuery 4 | 5 | schema = graphene.Schema(query=BlogQuery) 6 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/graphql_project/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for graphql_project project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.1.5. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.1/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | # Quick-start development settings - unsuitable for production 19 | # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ 20 | 21 | # SECURITY WARNING: keep the secret key used in production secret! 22 | SECRET_KEY = '2syfxe@@z%=z57&xius2v#%cvd)4txx-*71vnvw679xp^iq238' 23 | 24 | # SECURITY WARNING: don't run with debug turned on in production! 25 | DEBUG = True 26 | 27 | ALLOWED_HOSTS = ["*"] 28 | 29 | # Application definition 30 | 31 | INSTALLED_APPS = [ 32 | 'django.contrib.admin', 33 | 'django.contrib.auth', 34 | 'django.contrib.contenttypes', 35 | 'django.contrib.sessions', 36 | 'django.contrib.messages', 37 | 'django.contrib.staticfiles', 38 | 'corsheaders', 39 | "graphene_django", 40 | 41 | 'blog', 42 | ] 43 | 44 | MIDDLEWARE = [ 45 | 'django.middleware.security.SecurityMiddleware', 46 | 'django.contrib.sessions.middleware.SessionMiddleware', 47 | 'corsheaders.middleware.CorsMiddleware', 48 | 'django.middleware.common.CommonMiddleware', 49 | 'django.middleware.csrf.CsrfViewMiddleware', 50 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 51 | 'django.contrib.messages.middleware.MessageMiddleware', 52 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 53 | ] 54 | 55 | ROOT_URLCONF = 'graphql_project.urls' 56 | 57 | TEMPLATES = [ 58 | { 59 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 60 | 'DIRS': [BASE_DIR / 'templates'] 61 | , 62 | 'APP_DIRS': True, 63 | 'OPTIONS': { 64 | 'context_processors': [ 65 | 'django.template.context_processors.debug', 66 | 'django.template.context_processors.request', 67 | 'django.contrib.auth.context_processors.auth', 68 | 'django.contrib.messages.context_processors.messages', 69 | ], 70 | }, 71 | }, 72 | ] 73 | 74 | WSGI_APPLICATION = 'graphql_project.wsgi.application' 75 | 76 | # Database 77 | # https://docs.djangoproject.com/en/3.1/ref/settings/#databases 78 | 79 | DATABASES = { 80 | 'default': { 81 | 'ENGINE': 'django.db.backends.sqlite3', 82 | 'NAME': BASE_DIR / 'db.sqlite3', 83 | } 84 | } 85 | 86 | # Password validation 87 | # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators 88 | 89 | AUTH_PASSWORD_VALIDATORS = [ 90 | { 91 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 92 | }, 93 | { 94 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 95 | }, 96 | { 97 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 98 | }, 99 | { 100 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 101 | }, 102 | ] 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/3.1/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | # Static files (CSS, JavaScript, Images) 118 | # https://docs.djangoproject.com/en/3.1/howto/static-files/ 119 | 120 | STATIC_URL = '/static/' 121 | 122 | GRAPHENE = { 123 | "SCHEMA": "graphql_project.schema.schema" 124 | } 125 | 126 | CORS_ORIGIN_ALLOW_ALL = True # If this is used then `CORS_ORIGIN_WHITELIST` will not have any effect 127 | CORS_ALLOW_CREDENTIALS = True 128 | CORS_ORIGIN_WHITELIST = [ 129 | 'http://localhost:3000', 130 | ] # If this is used, then not need to use `CORS_ORIGIN_ALLOW_ALL = True` 131 | CORS_ORIGIN_REGEX_WHITELIST = [ 132 | 'http://localhost:3000', 133 | ] 134 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/graphql_project/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path, include 3 | from django.views.decorators.csrf import csrf_exempt 4 | from graphene_django.views import GraphQLView 5 | 6 | urlpatterns = [ 7 | path('admin/', admin.site.urls), 8 | path('', include("blog.urls")), 9 | path("graphql", csrf_exempt(GraphQLView.as_view(graphiql=True))) 10 | ] 11 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/graphql_project/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for graphql_project project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphql_project.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'graphql_project.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/.graphqlconfig: -------------------------------------------------------------------------------- 1 | { 2 | "name": "My Coll GraphQL Schema", 3 | "schemaPath": "schema.graphql", 4 | "extensions": { 5 | "endpoints": { 6 | "Default GraphQL Endpoint": { 7 | "url": "http://localhost:8000/graphql", 8 | "headers": { 9 | "user-agent": "JS GraphQL" 10 | }, 11 | "introspect": true 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react_app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@apollo/client": "^3.3.6", 7 | "@testing-library/jest-dom": "^5.11.8", 8 | "@testing-library/react": "^11.2.2", 9 | "@testing-library/user-event": "^12.6.0", 10 | "@types/jest": "^26.0.19", 11 | "@types/node": "^12.19.12", 12 | "@types/react": "^16.14.2", 13 | "@types/react-dom": "^16.9.10", 14 | "graphql": "^15.4.0", 15 | "react": "^17.0.1", 16 | "react-dom": "^17.0.1", 17 | "react-scripts": "4.0.1", 18 | "typescript": "^4.1.3", 19 | "web-vitals": "^0.2.4" 20 | }, 21 | "scripts": { 22 | "start": "react-scripts start", 23 | "build": "react-scripts build", 24 | "test": "react-scripts test", 25 | "eject": "react-scripts eject" 26 | }, 27 | "eslintConfig": { 28 | "extends": [ 29 | "react-app", 30 | "react-app/jest" 31 | ] 32 | }, 33 | "browserslist": { 34 | "production": [ 35 | ">0.2%", 36 | "not dead", 37 | "not op_mini all" 38 | ], 39 | "development": [ 40 | "last 1 chrome version", 41 | "last 1 firefox version", 42 | "last 1 safari version" 43 | ] 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/GraphQL/graphql_project/react_app/public/favicon.ico -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/GraphQL/graphql_project/react_app/public/logo192.png -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/GraphQL/graphql_project/react_app/public/logo512.png -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/schema.graphql: -------------------------------------------------------------------------------- 1 | # This file was generated based on ".graphqlconfig". Do not edit manually. 2 | 3 | schema { 4 | query: BlogQuery 5 | } 6 | 7 | type BlogQuery { 8 | allCategories: [CategoryType] 9 | allPosts: [PostType] 10 | categoryByName(name: String!): [CategoryType] 11 | postById(id: Int!): PostType 12 | postsByCategoryId(id: Int!): [PostType] 13 | } 14 | 15 | type CategoryType { 16 | id: ID! 17 | name: String! 18 | postSet: [PostType!]! 19 | } 20 | 21 | type PostType { 22 | categories: [CategoryType!]! 23 | content: String 24 | id: ID! 25 | name: String! 26 | } 27 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/App.css: -------------------------------------------------------------------------------- 1 | @import url('https://fonts.googleapis.com/css2?family=Hanalei+Fill&display=swap'); 2 | @import url('https://fonts.googleapis.com/css2?family=Hanalei+Fill&family=Staatliches&display=swap'); 3 | 4 | * { 5 | margin: 0; 6 | padding: 0; 7 | box-sizing: border-box !important; 8 | } 9 | 10 | .App { 11 | height: 100vh; 12 | width: 100%; 13 | display: grid; 14 | grid-template-rows: auto; 15 | grid-template-columns: 20% auto; 16 | grid-template-areas: "categories posts"; 17 | } 18 | 19 | #category_container { 20 | grid-area: categories; 21 | background-color: #f5cac3; 22 | display: flex; 23 | flex-direction: column; 24 | align-items: center; 25 | padding: 1rem 1rem; 26 | } 27 | 28 | #input_field { 29 | width: 100%; 30 | font-family: 'Staatliches', cursive; 31 | font-size: 2rem; 32 | padding: 10px; 33 | margin: 2rem 0; 34 | } 35 | 36 | .items { 37 | display: flex; 38 | flex-direction: column; 39 | width: 100%; 40 | } 41 | 42 | .category { 43 | padding: 1.5rem .5rem; 44 | /*border: 1px #ead5d1 dotted;*/ 45 | } 46 | 47 | .no_results { 48 | text-align: center; 49 | font-weight: 200; 50 | color: white; 51 | font-family: 'Staatliches', cursive; 52 | } 53 | 54 | .category.active { 55 | background-color: #ead5d1; 56 | } 57 | 58 | 59 | .category:hover { 60 | background-color: #ead5d1; 61 | cursor: pointer; 62 | } 63 | 64 | #post_container { 65 | grid-area: posts; 66 | background-color: #f7ede2; 67 | display: flex; 68 | flex-direction: column; 69 | padding: 10rem; 70 | } 71 | 72 | h1, h2, h3, h4, h5, h6 { 73 | font-family: 'Hanalei Fill', cursive; 74 | } 75 | 76 | .loading { 77 | position: absolute; 78 | height: 100vh; 79 | width: 100vw; 80 | display: flex; 81 | justify-content: center; 82 | align-items: center; 83 | } 84 | 85 | .no_category { 86 | height: 100%; 87 | display: flex; 88 | justify-content: center; 89 | align-items: center; 90 | } 91 | 92 | .no_category h1 { 93 | font-family: 'Staatliches', cursive; 94 | opacity: .4; 95 | } -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect} from 'react'; 2 | import './App.css'; 3 | import CategoryContainer from "./Components/CategoryContainer"; 4 | import PostContainer from "./Components/PostContainer"; 5 | import {gql, useQuery} from "@apollo/client"; 6 | import {useCategory} from "./context"; 7 | import {setCategories, setLoadingOn} from "./actions"; 8 | import Loading from "./Components/Loading"; 9 | 10 | function App() { 11 | const {state, dispatch} = useCategory()!; 12 | const {data} = useQuery(gql` 13 | { 14 | allCategories { 15 | id 16 | name 17 | } 18 | } 19 | `) 20 | 21 | useEffect(() => { 22 | dispatch(setLoadingOn()) 23 | }, []) 24 | 25 | useEffect(() => { 26 | if (data) { 27 | dispatch(setCategories(data.allCategories)) 28 | } 29 | }, [data]) 30 | 31 | return state.loading 32 | ? 33 | : ( 34 |
35 | 36 | 37 |
38 | ); 39 | } 40 | 41 | export default App; 42 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/Components/Category.tsx: -------------------------------------------------------------------------------- 1 | import React, {useEffect} from "react"; 2 | import {CategoryType} from "../types"; 3 | import {gql, useLazyQuery} from "@apollo/client"; 4 | import {useCategory} from "../context"; 5 | import {setPosts} from "../actions"; 6 | 7 | const Category: React.FC = ({id, name}) => { 8 | const {state, dispatch} = useCategory()!; 9 | const [refetch, {data, called}] = useLazyQuery(gql` 10 | query ($id: Int!) { 11 | posts: postsByCategoryId(id: $id) { 12 | id 13 | name 14 | } 15 | } 16 | `, { 17 | fetchPolicy: "no-cache" 18 | }) 19 | 20 | useEffect(() => { 21 | if (data) { 22 | dispatch(setPosts(id, data.posts)) 23 | } 24 | }, [data]) 25 | 26 | const handleClick = () => { 27 | refetch( 28 | { 29 | variables: { 30 | id 31 | }, 32 | } 33 | ) 34 | } 35 | console.log(called) 36 | return
37 |

{name}

38 |
39 | } 40 | 41 | 42 | export default Category -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/Components/CategoryContainer.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import InputField from "./InputField"; 3 | import Category from "./Category"; 4 | import {useCategory} from "../context"; 5 | 6 | 7 | const CategoryContainer: React.FC = () => { 8 | const {state: {categories}} = useCategory()!; 9 | 10 | return
11 |

Categories

12 | 13 |
14 | { 15 | categories?.map(category => ) 16 | ??

No Results :(

17 | } 18 |
19 |
20 | } 21 | 22 | export default CategoryContainer -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/Components/InputField.tsx: -------------------------------------------------------------------------------- 1 | import React, {ChangeEvent, useEffect} from 'react'; 2 | import {gql, useLazyQuery} from "@apollo/client"; 3 | import {useCategory} from "../context"; 4 | import {setCategories} from "../actions"; 5 | 6 | const InputField: React.FC = () => { 7 | const {dispatch} = useCategory()!; 8 | 9 | const [reFetch, {data}] = useLazyQuery(gql` 10 | query ($name: String!){ 11 | categories: categoryByName(name: $name) { 12 | id 13 | name 14 | } 15 | } 16 | `) 17 | 18 | useEffect(() => { 19 | if (data) 20 | dispatch(setCategories(data.categories)) 21 | }, [data]) 22 | 23 | const handleChange = (e: ChangeEvent) => { 24 | reFetch({ 25 | variables: { 26 | name: e.target.value 27 | } 28 | }) 29 | } 30 | 31 | return 32 | } 33 | 34 | export default InputField -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/Components/Loading.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | const Loading: React.FC = () => { 4 | return
5 |

Loading, Please Wait :)

6 |
7 | } 8 | 9 | export default Loading -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/Components/Post.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {PostType} from "../types"; 3 | 4 | const styles = { 5 | root: { 6 | marginBottom: "1rem", 7 | }, 8 | header: { 9 | fontFamily: "Staatliches, cursive", 10 | fontWeight: 200, 11 | cursor: "Pointer" 12 | } 13 | } 14 | 15 | const Post: React.FC = ({id, name, content}) => { 16 | return
17 |

{name}

18 |
19 | {content} 20 |
21 |
22 | } 23 | 24 | export default Post -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/Components/PostContainer.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Post from "./Post"; 3 | import {useCategory} from "../context"; 4 | 5 | const PostContainer: React.FC = () => { 6 | const {state: {posts}} = useCategory()!; 7 | return
8 | { 9 | posts?.map((post) => ) 10 | ??
11 |

Select a Category

12 |
13 | } 14 |
15 | } 16 | 17 | export default PostContainer -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/actions.ts: -------------------------------------------------------------------------------- 1 | import { 2 | CategoryActions, 3 | CategoryType, 4 | PostType, 5 | SET_CATEGORIES, 6 | SET_CATEGORY_POSTS, 7 | SET_FAILED, 8 | SET_LOADING_ON 9 | } from "./types"; 10 | 11 | export const setLoadingOn = (): CategoryActions => { 12 | return { 13 | type: SET_LOADING_ON 14 | } 15 | } 16 | 17 | export const setSomethingWentWrong = (): CategoryActions => { 18 | return { 19 | type: SET_FAILED 20 | } 21 | } 22 | 23 | export const setCategories = (categories: CategoryType[]): CategoryActions => { 24 | return ({ 25 | type: SET_CATEGORIES, 26 | payload: { 27 | categories, 28 | loading: false, 29 | failed: false 30 | } 31 | }) 32 | } 33 | 34 | export const setPosts = (id: number, posts: PostType[]): CategoryActions => { 35 | return { 36 | type: SET_CATEGORY_POSTS, 37 | payload: { 38 | activeCategoryId: id, 39 | posts, 40 | loading: false, 41 | failed: false 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/context.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import reducer, {defaultState, IInitialState} from "./reducer"; 3 | import {CategoryActions} from "./types"; 4 | 5 | interface ContextType { 6 | state: IInitialState, 7 | dispatch: React.Dispatch 8 | } 9 | 10 | const CategoryContext = React.createContext(undefined) 11 | 12 | const CategoryProvider: React.FC = ({children}) => { 13 | const [state, dispatch] = React.useReducer(reducer, defaultState) 14 | 15 | return 16 | {children} 17 | 18 | } 19 | 20 | const useCategory = () => React.useContext(CategoryContext) 21 | 22 | export {useCategory, CategoryProvider} -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import {ApolloClient, ApolloProvider, InMemoryCache} from "@apollo/client"; 5 | import {CategoryProvider} from "./context"; 6 | 7 | const client = new ApolloClient({ 8 | uri: "http://127.0.0.1:8000/graphql", 9 | cache: new InMemoryCache() 10 | }) 11 | 12 | ReactDOM.render( 13 | 14 | 15 | 16 | 17 | 18 | 19 | , 20 | document.getElementById('root') 21 | ); 22 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/queries.ts: -------------------------------------------------------------------------------- 1 | import {gql} from "@apollo/client"; 2 | 3 | export const GET_ALL_CATEGORIES = gql` 4 | query { 5 | allCategories { 6 | id 7 | name 8 | } 9 | } 10 | ` 11 | 12 | export const FILTER_CATEGORIES = gql` 13 | query ($name: String!){ 14 | categories: categoryByName(name: $name) { 15 | id 16 | name 17 | } 18 | } 19 | ` 20 | 21 | export const GET_POSTS_BY_CATEGORY = gql` 22 | query ($name: String!){ 23 | category: categoryByName(name: $name) { 24 | postSet { 25 | id 26 | name 27 | } 28 | } 29 | } 30 | ` -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/reducer.ts: -------------------------------------------------------------------------------- 1 | import {CategoryActions, CategoryType, PostType, SET_CATEGORIES, SET_CATEGORY_POSTS} from "./types"; 2 | 3 | export interface IInitialState { 4 | categories?: CategoryType[], 5 | posts?: PostType[], 6 | activeCategoryId?: number, 7 | loading: boolean, 8 | failed: boolean 9 | } 10 | 11 | export const defaultState: IInitialState = { 12 | loading: false, 13 | failed: false, 14 | activeCategoryId: -1 15 | } 16 | 17 | 18 | const reducer = (state: IInitialState = defaultState, action: CategoryActions) => { 19 | switch (action.type) { 20 | case SET_CATEGORIES: 21 | return {...state, ...action.payload} 22 | case SET_CATEGORY_POSTS: 23 | return {...state, ...action.payload} 24 | default: 25 | return state 26 | } 27 | } 28 | 29 | 30 | export default reducer -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/src/types.ts: -------------------------------------------------------------------------------- 1 | export interface PostType { 2 | id: number, 3 | name: string, 4 | content: string 5 | } 6 | 7 | export interface CategoryType { 8 | id: number, 9 | name: string, 10 | postSet?: PostsType 11 | } 12 | 13 | export interface PostsType { 14 | posts: PostType[] 15 | } 16 | 17 | export const SET_LOADING_ON = "SET_LOADING_ON" 18 | 19 | export interface setLoading { 20 | type: typeof SET_LOADING_ON 21 | } 22 | 23 | export const SET_FAILED = "SET_FAILED" 24 | 25 | export interface setFailed { 26 | type: typeof SET_FAILED 27 | } 28 | 29 | 30 | export const SET_CATEGORIES = "SET_CATEGORIES" 31 | 32 | export interface setCategoriesType { 33 | type: typeof SET_CATEGORIES, 34 | payload: { 35 | categories: CategoryType[], 36 | loading: boolean, 37 | failed: boolean 38 | } 39 | } 40 | 41 | export const SET_CATEGORY_POSTS = "SET_CATEGORY_POSTS" 42 | 43 | interface setCategoryPosts { 44 | type: typeof SET_CATEGORY_POSTS, 45 | payload: { 46 | activeCategoryId: number, 47 | posts: PostType[], 48 | loading: boolean, 49 | failed: boolean, 50 | 51 | } 52 | } 53 | 54 | 55 | export type CategoryActions = setCategoriesType | setCategoryPosts | setLoading | setFailed -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/react_app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/readme.md: -------------------------------------------------------------------------------- 1 | # GraphQL using Django and React 2 | 3 | 1. Create new Virtual Env and install requirements 4 | 2. cd to react_app folder and `npm i` it 5 | 3. migrate 6 | 4. load data.json fixtures using `python manage.py loaddata data.json --app blog` 7 | 5. run both django and react, enjoy :) 8 | -------------------------------------------------------------------------------- /presentations/GraphQL/graphql_project/requirements.txt: -------------------------------------------------------------------------------- 1 | aniso8601==7.0.0 2 | asgiref==3.3.1 3 | Django==3.1.5 4 | django-cors-headers==3.6.0 5 | graphene==2.1.8 6 | graphene-django==2.15.0 7 | graphql-core==2.3.2 8 | graphql-relay==2.0.1 9 | promise==2.3 10 | pytz==2020.5 11 | Rx==1.6.1 12 | singledispatch==3.4.0.3 13 | six==1.15.0 14 | sqlparse==0.4.1 15 | text-unidecode==1.3 16 | -------------------------------------------------------------------------------- /presentations/Introduction_to_Prometheus/intro_to_Prometheus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Introduction_to_Prometheus/intro_to_Prometheus.pdf -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/content.md: -------------------------------------------------------------------------------- 1 | class: center, middle 2 | 3 |

Measuring
Test Effectiveness

4 | 5 | ### Mohammad Javad Naderi 6 | 7 | January 2021 8 | 9 | --- 10 | layout: true 11 | ## What Will We Cover? 12 | 13 | --- 14 | 15 | -- 16 | 17 | - Introduction to software testing 18 | - Why software testing is important? 19 | -- 20 | 21 | - What is an **effective** test suite? 22 | -- 23 | 24 | - Coverage 25 | -- 26 | 27 | - Mutation Testing 28 | 29 | --- 30 | layout: false 31 | background-image: url(images/dark-knight.jpg) 32 | ## Why Do We Fall? 33 | 34 | --- 35 | background-image: url(images/first-bug.jpg) 36 | 37 |








38 |

Here begins the battle.

39 | 40 | 41 | --- 42 | background-image: url(images/knight-bg-2.jpg) 43 | ## Losing $460M in 45 Minutes 44 | 45 | -- 46 | 47 | - August 1st, 2012 48 | 49 | -- 50 | - **Knight Capital** deployed a new software update. 51 | 52 | -- 53 | - At 09:00AM, the New York Stock Exchange opened for trading. 54 | 55 | -- 56 | - 45 minutes later, Knight Capital’s servers had executed 4 million trades. 57 | 58 | -- 59 | - Company lost **$460M**. 60 | - Agreed to be acquired by Getco LLC in December 2012. 61 | 62 | -- 63 | 64 | What happened? 65 | 66 | - **Dead Code:** "Power Peg" was still present on servers despite not being used. 67 | - **Flag Repurpose:** New code repurposed a flag that was formerly used to activate Power Peg. 68 | 69 | --- 70 | background-image: url(images/ariane-5-bg.jpg) 71 | ## The Ariane 5 Disaster 72 | 73 | -- 74 | - June 4th, 1996 75 | 76 | -- 77 | - First test flight failed with the rocket self-destructing 37 seconds after launch. 78 | 79 | -- 80 | - About **$370M** lost. 81 | 82 | -- 83 | - Exception-handling bug: 84 | - forced self-destruct after 64-bit to 16-bit conversion 85 | 86 | --- 87 | layout: true 88 | background-image: url(images/therac-25-2.jpg) 89 | ## Deadly Race Condition in Therac-25 90 | 91 | --- 92 | 93 | -- 94 | - Therac-25 was a radiation therapy machine produced in 1982. 95 | 96 | -- 97 | - Six patients were given massive overdoses of radiation. 98 | - In three cases, the injured patients later died as a result of the overdose. 99 | 100 | --- 101 | background-image: "" 102 | 103 | ![Therac-25-Explained](images/therac-25.png) 104 | 105 | --- 106 | layout: false 107 | background-image: url(images/mars-bg.jpg) 108 | ## Mars Climate Orbiter Failure 109 | 110 | 111 | -- 112 | 113 | - September 23, 1999 114 | 115 | -- 116 | - The Mars Climate Orbiter burned up in the Martian atmosphere. 117 | 118 | -- 119 | - About **$235M** lost. 120 | 121 | -- 122 | 123 | **What happened?** 124 | 125 | -- 126 | - A software supplied by Lockheed Martin produced results in a **US customary unit**, 127 | - while a second system, supplied by NASA, expected those results to be in **SI units**. 128 | - The trajectory calculation software then used some results – expected to 129 | be in newton seconds (incorrect by a factor of 4.45) – to update the predicted position of the spacecraft. 130 | 131 | --- 132 | layout: false 133 | background-image: url(images/bugs-everywhere.jpg) 134 | 135 | -- 136 | background-image: "" 137 | 138 | ## Solution 139 | 140 | -- 141 | - **Formal Methods** 142 | - Mathematically rigorous techniques 143 | - Specification languages based on math (instead of natural language). e.g. **Z Notation** 144 | - You can **prove** that a program conforms to its specification. 145 | - Very useful for safety-critical systems. 146 | 147 | -- 148 | - **Software Testing** 149 | - Executing a program or application with the intent of finding software bugs 150 | 151 | --- 152 | 153 | ## Questions 154 | 155 | -- 156 | - We write tests to detect software faults as much as possible. 157 | - In order to detect many faults, many good test cases are needed. 158 | 159 | 160 | -- 161 | But 162 | 163 | -- 164 | - Who validates our tests? 165 | - How much testing is enough (effective)? 166 | 167 | -- 168 | 169 | > We need a criteria to distinguish between *good* and *bad* test suite. 170 | 171 | --- 172 | 173 | ## Test Effectiveness Criteria 174 | 175 | - Code Coverage 176 | - Mutation Testing 177 | 178 | --- 179 | 180 | ## Code Coverage 181 | 182 | -- 183 | - **Most common** method of measuring test quality. 184 | 185 | -- 186 | - Calculates how much of code is covered by the test suite. 187 | - Reported as percentage (%) 188 | 189 | -- 190 | - Lots of tools 191 | 192 | --- 193 | 194 | ## Types of Coverage 195 | 196 | There are many types of coverage based on what you want to cover. 197 | 198 | -- 199 | - **Line Coverage**: has each line of code been executed? 200 | - most common 201 | 202 | -- 203 | - **Statement Coverage**: has each statement in the program been executed? 204 | 205 | -- 206 | - **Function Coverage**: has each function (or subroutine) in the program been called? 207 | 208 | -- 209 | - **Branch Coverage**: has each branch been executed? 210 | 211 | -- 212 | - **Graph-based**: cover the graph in some way 213 | 214 | -- 215 | - ... 216 | 217 | --- 218 | 219 | ## Graph-based Coverage Criteria 220 | 221 | Before analyzing a source code, we need to convert it to a graph. 222 | 223 | -- 224 | - AST (Abstract Syntax Tree) 225 | - CFG (Control Flow Graph) 226 | 227 | -- 228 | 229 | **CFG** is simpler than AST and helps measuring code coverage. 230 | 231 | -- 232 | - Models all executions of a program by describing control structures. 233 | - A directed graph where 234 | - Each **node** represents a basic block (sequence of statements with no jump or jump target) 235 | - **Edges** represent control flow 236 | - Essential to many compiler optimizations and static-analysis tools. 237 | 238 | --- 239 | 240 | ## Control Flow Graph Example 241 | 242 | ![CFG](images/cfg.png) 243 | 244 | --- 245 | 246 | ## Coverages Based on CFG 247 | 248 | - Node Coverage 249 | - Edge Coverage 250 | - Edge-Pair Coverage 251 | - Simple Path Coverage 252 | - Prime Path Coverage 253 | - Subsumes node, edge, edge-pair coverage. 254 | 255 | --- 256 | ## Mutation Testing 257 | 258 | ![XMen-1](images/xmen-1.png) 259 | ![XMen-2](images/xmen-2.png) 260 | 261 | --- 262 | ## Mutation Testing 263 | 264 | - **Fault**-based technique 265 | - Automatically seed well-defined small faults 266 | - Imitate programmer's mistakes (real faults) 267 | 268 | -- 269 | - History can be traced back to 1971 in a student paper by Richard J. **Lipton**. 270 | 271 | -- 272 | - The birth of the field: paper published by **DeMillo** et al in 1978: 273 | - "Hints on test data selection: Help for the practicing programmer" 274 | 275 | -- 276 | ![Lipton-Demillo](images/lipton-demillo.png) 277 | 278 | -- 279 | - Based on two hypotheses: 280 | - **Competent Programmer Hypothesis (CPH)** 281 | - **Coupling Effect** 282 | 283 | --- 284 | 285 |
286 | 287 | ![Demillo](images/demillo.png) 288 | 289 | --- 290 | 291 |

 

292 | 293 | -- 294 | 295 | > **Competent Programmer Hypothesis** 296 | > 297 | > Programmers are competent, 298 | > which implies that they tend to develop programs **close to the correct version**. 299 | > (have merely a few simple faults which can be corrected by a few small syntactical changes) 300 | 301 |

 

302 | 303 | -- 304 | 305 | > **Coupling Effect** 306 | > 307 | > Test data that distinguishes all programs differing from a correct one by only **simple errors** 308 | > is so sensitive that it also implicitly distinguishes more **complex errors**. 309 | 310 | -- 311 | 312 | A. J. Offutt supported the validity of coupling effect through empirical investigation [1992]. 313 | 314 | --- 315 | 316 | ## How Does It Work? 317 | 318 | -- 319 | - Run the test suite on the program 320 | 321 | -- 322 | - Generate **mutants** using **mutation operators** 323 | 324 | -- 325 | - Find and remove **invalid** and **equivalent** mutants. 326 | 327 | -- 328 | - Run the test suite on remaining mutants. 329 | 330 | -- 331 | - Find mutants which made tests fail (**were killed**) 332 | 333 | -- 334 | - Calculate **mutation score**: 335 | 336 | -- 337 | 338 | $$MutationScore = \frac{\text{Killed Mutants}}{\text{All Mutants}}$$ 339 | 340 | --- 341 | 342 | ## Generic Mutation Operators 343 | 344 | ![Generic Mutators](images/generic-mutators.png) 345 | 346 | --- 347 | 348 | ## Code Coverage vs. Mutation Testing 349 | 350 | Studies report that: 351 | 352 | -- 353 | - **Coverage** 354 | - Not strongly correlated with effectiveness. 355 | 356 | -- 357 | - **Mutation** 358 | - Writing test suite with 95% mutation score is difficult, but that test suite will be effective at finding faults. 359 | [Offutt, 1992] 360 | - Mutants, using carefully selected operators and after removing equivalent mutants, 361 | can provide a good indication of the fault detection ability of a test suite. [Andrews et al, 2005] 362 | 363 | --- 364 | 365 | ## Mutation Testing Problems 366 | 367 | -- 368 | - **Cost** 369 | - All tests must be run against all mutants. 370 | - When you have a large test suite, it takes a huge amount of time. 371 | - **Solution:** Select a subset of mutation operators that is as effective as whole set. 372 | 373 | -- 374 | - **Equivalent Mutants** 375 | - Undecidable problem! 376 | - Needs human intervention 377 | - 45% of alive mutants are equivalent 378 | - Checking each mutant takes about 15 minutes. 379 | - **Workaround:** 380 | Guided mutation generation process towards parts of code that are more likely to influence the output. 381 | (reduces the likelihood of generating equivalent mutants) 382 | 383 | 384 | --- 385 | 386 | ## Tools 387 | 388 | - Stryker (JavaScript, TypeScript, C#, Scala) 389 | - Infection (PHP) 390 | - Hambug (PHP) 391 | - Pitest (Java) 392 | - mutmut (Python) 393 | - Cosmic Ray (Python) 394 | - Mutant (Ruby) 395 | - Muter (Swift) 396 | - Mull (C, C++) 397 | - go-mutesting (Go) 398 | 399 | --- 400 | background-image: url(images/stryker-bg.png) 401 | 402 | ## Stryker 403 | 404 | -- 405 | - Open source mutation testing tool for JS, TS, C#, Scala 406 | 407 | -- 408 | - Written in TypeScript 409 | 410 | -- 411 | - Internally: 412 | - Uses babel to generate AST from code 413 | - Applies mutation operators (mutators) to AST 414 | - Converts AST back to code 415 | 416 | -- 417 | - Supports ES6+ and JSX 418 | 419 | -- 420 | - Complete flow: 421 | - generating mutants, running tests, killing mutants, reporting 422 | 423 | -- 424 | - Generic mutators built-in. 425 | 426 | -- 427 | - Supports popular test runners: Jest, Jasmine, Karma, Mocha 428 | 429 | --- 430 | 431 |
432 |
433 |

434 | Demo Time! 435 |

436 |

Demo project is located in demo-js folder.

437 |
438 | 439 | --- 440 | layout:true 441 | ## Bonus: Mutation Operators for React 442 | 443 | --- 444 | 445 | -- 446 | - I designed 6 mutation operators for react, 447 | - and implemented them in Stryker. 448 | 449 | -- 450 | - Currently for class-based components but can be adopted to function-based. 451 | 452 | -- 453 | - Purpose: replace generic operators in react apps 454 | - Decrease number of mutants 455 | - Take react and JSX specific features into account 456 | 457 | -- 458 | - Tested on 14 open-source react projects (from 12806 crawled projects) 459 | - Projects used react features heavily and contained adequate test suite. 460 | 461 | -- 462 | - **Result:** 85% less mutants generated, mutation score was proportional to previous score 463 | 464 | --- 465 | 466 | ![React-Instantsearch](images/react-instantsearch.png) 467 | 468 | --- 469 | layout: false 470 | background-image: url(images/any-questions.jpg) 471 | --- 472 | ## References 473 | 474 |
475 | 476 | - https://labs.blogs.com/its_alive_in_the_lab/2017/01/the-original-computer-bug.html 477 | - https://mag.quera.ir/worstbugs-knight-j0owwibf4doq 478 | - https://mag.quera.ir/the-ariane-5-disaster-oxgmwgsiv6mq 479 | - https://mag.quera.ir/race-condition-therac-25-iroksmaisgit 480 | - https://mag.quera.ir/bug-day-mars-climate-orbiter-aiz47q8nj17f 481 | - Mohammad Javad Naderi. "Generating Mutants for User Interface Testing in Web-Based Applications" Master Thesis, 2019. 482 | - https://stryker-mutator.io/ 483 | 484 | If you found an issue or have a suggestion, feel free to contact us. 485 | 486 | Report Issues 487 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-react" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | .eslintcache 26 | 27 | # stryker temp files 28 | .stryker-tmp 29 | 30 | # stryker report 31 | /reports 32 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-js", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/react": "^11.2.3", 7 | "@testing-library/user-event": "^12.6.2", 8 | "react": "^17.0.1", 9 | "react-dom": "^17.0.1", 10 | "react-scripts": "4.0.1" 11 | }, 12 | "scripts": { 13 | "start": "react-scripts start", 14 | "build": "react-scripts build", 15 | "test": "react-scripts test", 16 | "eject": "react-scripts eject" 17 | }, 18 | "eslintConfig": { 19 | "extends": [ 20 | "react-app", 21 | "react-app/jest" 22 | ] 23 | }, 24 | "browserslist": { 25 | "production": [ 26 | ">0.2%", 27 | "not dead", 28 | "not op_mini all" 29 | ], 30 | "development": [ 31 | "last 1 chrome version", 32 | "last 1 firefox version", 33 | "last 1 safari version" 34 | ] 35 | }, 36 | "devDependencies": { 37 | "@stryker-mutator/core": "^4.4.1", 38 | "@stryker-mutator/html-reporter": "^3.1.0", 39 | "@stryker-mutator/javascript-mutator": "^4.0.0", 40 | "@stryker-mutator/jest-runner": "^4.4.1", 41 | "@testing-library/jest-dom": "^5.11.9" 42 | }, 43 | "jest": { 44 | "collectCoverageFrom": [ 45 | "src/**/App.js" 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/demo-js/public/favicon.ico -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/demo-js/public/logo192.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/demo-js/public/logo512.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | font-size: 2em; 4 | } 5 | 6 | input { 7 | font-size: 1em; 8 | margin: 0 1em; 9 | } 10 | 11 | span { 12 | font-size: 1.2em; 13 | font-weight: bold; 14 | color: limegreen; 15 | } 16 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/src/App.js: -------------------------------------------------------------------------------- 1 | import {useState} from "react"; 2 | import "./App.css"; 3 | 4 | function countFactors(number) { 5 | let cnt = 0; 6 | for (let i = 1; i*i <= number; i++) 7 | if (number % i === 0) 8 | cnt += 1; 9 | return number === 1 ? 1 : cnt + 1; 10 | } 11 | 12 | function isPrime(number) { 13 | return countFactors(number) === 2; 14 | } 15 | 16 | function countPrimes(max) { 17 | let cnt = 0; 18 | for (let i = 1; i <= max; i++) { 19 | if (isPrime(i)) 20 | cnt++; 21 | } 22 | return cnt; 23 | } 24 | 25 | function App() { 26 | const [input, setInput] = useState(2); 27 | return ( 28 |
29 |

30 | 31 | setInput(e.target.value)}/> 32 |

33 | Number of primes less than or equal to {input} is: {countPrimes(input)} 34 |

35 |
36 | ); 37 | } 38 | 39 | export default App; 40 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen, fireEvent } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('checks prime numbers', () => { 5 | render(); 6 | const inputElement = screen.getByLabelText("Input"); 7 | const resultSpan = screen.getByTestId("result"); 8 | 9 | fireEvent.change(inputElement, {target: {value: "2"}}) 10 | expect(resultSpan).toHaveTextContent("1"); 11 | 12 | fireEvent.change(inputElement, {target: {value: "6"}}) 13 | expect(resultSpan).toHaveTextContent("3"); 14 | 15 | // Uncomment following lines to increase mutation score 16 | 17 | // fireEvent.change(inputElement, {target: {value: "6"}}) 18 | // expect(resultSpan).toHaveTextContent(/^3$/); 19 | 20 | // fireEvent.change(inputElement, {target: {value: "20"}}) 21 | // expect(resultSpan).toHaveTextContent("8"); 22 | 23 | }); 24 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById('root') 11 | ); 12 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/demo-js/stryker.conf.js: -------------------------------------------------------------------------------- 1 | module.exports = function (config) { 2 | config.set({ 3 | // "$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json", 4 | mutate: [ 5 | "src/**/*.js?(x)", 6 | "!src/**/*@(.test|.spec|Spec).js?(x)", 7 | "!src/index.js", 8 | ], 9 | mutator: "javascript", 10 | testRunner: "jest", 11 | reporters: [ 12 | "progress", 13 | "clear-text", 14 | "html" 15 | ], 16 | coverageAnalysis: "off", 17 | jest: { 18 | projectType: "create-react-app" 19 | } 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/X-X-Everywhere.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/X-X-Everywhere.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/any-questions.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/any-questions.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/ariane-5-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/ariane-5-bg.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/ariane-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/ariane-5.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/bugs-everywhere.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/bugs-everywhere.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/cfg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/cfg.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/cfg.xml: -------------------------------------------------------------------------------- 1 | 7Vpbj+I2FP41kdpKIF9y4xGYmVbqtmo7qtp59BATshNimpgZ2F9fO7HJnWU3MAnsDhoRHx9fz+X7bGLg+Xr3c0w2q9+YR0MDAW9n4DsDIQgQFF9Sss8kFp5kAj8OPKWUCx6DT1S3VNJt4NGkpMgZC3mwKQsXLIrogpdkJI7ZW1ltycLyqBvi05rgcUHCuvSfwOOrTOpaIJf/QgN/pUeGQNWsiVZWgmRFPPZWEOF7A89jxnj2tN7NaSg3T+9L1u6hpfYwsZhG/JQGfz38OXp4in5fef6vfwfrLZvffxopYyR8rxdMPbF+VWQxXzGfRSS8z6WzmG0jj8pegSjlOh8Y2wghFMKPlPO9MibZciZEK74OVS3dBfxf2XxsqdJToeZup3pOC3tdiHi8LzSSxadiXd4sLel2SxZxNRHoinLCY/ZyMKUwwizbAbns1o1VooRt4wU9spvaQUnsU35EDx/ML+KGsjUVMxbtYhoSHryW50GUA/sHvdzG4kGZ+QtMjqzh2BwctXlInmk4I4sXPx1+zkIWpxPGcCo/jeYsGtxKNUjMpzITCMkiJEkSLLT4IQgP84s8rRSxiGYSVQ8u4CUdrK+a/sECMTICKtViczK2XBdhC01MCB0360ClXZ2EdH+Zi6ouKg51mNPX+5ia/SsJt2o9BrJDrsxTcj77vy3TFaMkNdxUKEB3s0u3XdeLJ19+Z56iehOTyzrM6uqOHYYCKKQ131YBp48bklrmTWBV2T0/nyaWwhe0ByoPUYukMae7415Rt7a2mjaMhkdVfMuxxlaiVQFmTNDuHp2Sg4bdfpIDNE6Fg3dN6/jEtG72mdZhPeZ2hvQum6yls6t4AftGA3+QqbZsFBIGfiRzptgvKrx+Jh09EMxoqirWgedl9qcibslz2p80zkamlXR91syw7irmstsz++fiSpE8NVROrYpGPeLWrVE4AmMbg3LGVEbvmJUhGjuTUr8jt9wHWy4TepEkrJcwBKC/AXJ3ahaQWv2lAdyAvNcOihD1jYoNm/g9kr46kswTI8nuFU+vJnsO0nZWr7Yza1lQDi6fZAE0k9x35EBWHxyo5dYh50DY0RunuQo6CwlC7tjC5Y71QJdnQXVX0IdHL3jtdBLV/SQbEnXqiCjfRGD5g+Dsc7lPPxYGEOvOxiiPK8TpEsrSwaxqf1hVdg6Rhw/y5au6NvJiVsnLpE5eIGxgL9al2AsyrwXJDuwFlrhLTmWGwF6sqzgHWK1pr/MN3HNMycvN3MBZlXhFbt+HjQHdz9/AYcM+MVydXgmr3UxYq5d3vRPXXi7vWs4SOXFFE2CfhanCKk2tBPnlaCq8ml9iBxm9bp/RWw/e64NBPLEGBoPOtQREC2sdEgg6J4ZR1xcT0qbTOCb7goJClNaka7pOyfVMs/IiS0XfmoBO+hDZFe/MZnzefO7WkoIAQB5EovQtXj610Kscw13TtivgexZIH6ExsEHhD1UxvtLl5TDeacCJwV7ayKefxD+69fsaswx8uAH4XOsdge+Q1L8DX3fgc4cMfLjykpZpHwcyG4JO+vrasU0fO/CY/mWAso6Tg0uKO6N+kw1vPC1iPLS0iBoc5TK7al9uV0Elgp36rprnOWWJYv5ueRas+Rv6+P5/ -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/dark-knight-lighter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/dark-knight-lighter.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/dark-knight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/dark-knight.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/demillo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/demillo.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/demillo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/demillo.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/first-bug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/first-bug.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/generic-mutators.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/generic-mutators.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/generic-mutators.txt: -------------------------------------------------------------------------------- 1 | Binary Operators 2 | ================================== { ...block... } => {} 3 | a + b <=> a - b if (...) => if (true) 4 | a * b <=> a / b if (...) => if (false) 5 | a == b <=> a != b for (...;...;...) => for(...;true/false;...) 6 | a || b <=> a && b do { ...} while(...) => do{...} while(false) 7 | a % b <=> a * b while(...) do { ...} => while(false) do { ...} 8 | a < b, a > b <=> a <= b, a >= b conditions(a || b, ...) => true/false 9 | true <=> false 10 | Unary Operators 11 | ========================= 12 | -a <=> +a [a, b, c] => [] 13 | !a => a "non-empty string" <=> "" 14 | ++a <=> --a {"a": 1, "b": 2} => {} 15 | a++ <=> a-- 16 | ~a => a 17 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/knight-bg-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/knight-bg-2.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/knight-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/knight-bg.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/knight-capital.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/knight-capital.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/lipton-demillo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/lipton-demillo.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/lipton.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/lipton.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/mars-bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/mars-bg.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/react-instantsearch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/react-instantsearch.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/stryker-bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/stryker-bg.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/therac-25-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/therac-25-2.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/therac-25.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/therac-25.jpg -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/therac-25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/therac-25.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/xmen-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/xmen-1.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/images/xmen-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Measuring-Test-Effectiveness/images/xmen-2.png -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Measuring Test Effectiveness 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 44 | 45 | -------------------------------------------------------------------------------- /presentations/Measuring-Test-Effectiveness/static/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Dosis); 2 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); 3 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,900); 4 | 5 | body { 6 | font-family: 'Lato', sans-serif; 7 | color: #eee; 8 | } 9 | 10 | .remark-slide-content { 11 | background-color: #111 !important; 12 | background-position: center; 13 | background-repeat: no-repeat; 14 | background-size: cover; 15 | font-size: 24px; 16 | } 17 | 18 | h1, h2, h3 { 19 | font-family: 'Dosis', sans-serif; 20 | font-weight: normal; 21 | } 22 | 23 | h1 > code, h2 > code, h3 > code { 24 | font-size: .8em; 25 | } 26 | 27 | h2 { 28 | /* font-size: 42px !important;*/ 29 | color: rgb(255, 217, 102); 30 | } 31 | 32 | p { 33 | line-height: 1.5em; 34 | } 35 | 36 | ul, ol { 37 | line-height: 1.8em; 38 | } 39 | 40 | code { 41 | font-family: 'Ubuntu Mono', monospace; 42 | } 43 | 44 | strong, b { 45 | color: rgb(255, 217, 102); 46 | font-weight: 900; 47 | } 48 | 49 | .remark-inline-code { 50 | background-color: rgba(255,255,255,0.12); 51 | border-radius: .2em; 52 | padding: 0 .3em .1em; 53 | } 54 | 55 | pre code { 56 | color: #333; 57 | background: #f6f6f6; 58 | border: 1px solid #ddd; 59 | border-radius: .4em; 60 | display: block; 61 | padding: .5em; 62 | } 63 | 64 | .hljs-github .hljs { 65 | background: #f6f6f6 !important; 66 | border: 1px solid #ddd; 67 | border-radius: .4em; 68 | } 69 | 70 | pre { 71 | border-radius: .4em; 72 | line-height: 1.1em; 73 | overflow-x: auto; 74 | } 75 | 76 | table { 77 | border: solid 1px #DDEEEE; 78 | border-collapse: collapse; 79 | border-spacing: 0; 80 | font-size: 15px; 81 | } 82 | 83 | table thead th { 84 | background-color: #DDEFEF; 85 | border: solid 1px #DDEEEE; 86 | color: #336B6B; 87 | padding: 10px; 88 | text-align: left; 89 | text-shadow: 1px 1px 1px #fff; 90 | } 91 | 92 | table tbody td { 93 | border: solid 1px #DDEEEE; 94 | color: #333; 95 | padding: 10px; 96 | text-shadow: 1px 1px 1px #fff; 97 | } 98 | 99 | .remark-slide-content a { 100 | color: skyblue; 101 | text-decoration: none; 102 | } 103 | 104 | .remark-slide-content img { 105 | display: block; 106 | max-width: 100%; 107 | max-height: 450px; 108 | margin: auto; 109 | } 110 | 111 | blockquote { 112 | /*display: flex;*/ 113 | margin: 0 0 1em 0; 114 | padding: 1px 1em; 115 | background: rgba(255,255,255,0.1); 116 | } 117 | 118 | blockquote > p { 119 | /*padding: 1em;*/ 120 | /*margin: 0;*/ 121 | /*background: rgba(255,255,255,0.1);*/ 122 | } 123 | 124 | img[alt="XMen-1"] { 125 | position: absolute; 126 | width: 55%; 127 | top: 3em; 128 | right: 3em; 129 | } 130 | img[alt="XMen-2"] { 131 | position: absolute; 132 | width: 55%; 133 | bottom: 2em; 134 | left: 3em; 135 | } 136 | 137 | img[alt="Lipton-Demillo"] { 138 | position: absolute; 139 | top: 4em; 140 | right: 4em; 141 | } 142 | 143 | img[alt="Generic Mutators"] { 144 | position: relative; 145 | top: -1em; 146 | max-height: unset!important; 147 | height: 500px!important; 148 | } 149 | 150 | #before-references + ul li { 151 | line-height: 1.3; 152 | } 153 | -------------------------------------------------------------------------------- /presentations/New Python Features/content.md: -------------------------------------------------------------------------------- 1 | class: center, middle 2 | 3 | ![Python](images/python-logo.svg) 4 | 5 | # New Python Features 6 | 7 | ### Mohammad Javad Naderi 8 | 9 |
10 | 11 | Quera 12 | 13 | October 2019 14 | 15 | 16 | 17 | --- 18 | 19 | layout: true 20 | ## `dict` Preserves Order (3.7) 21 | 22 | 23 | --- 24 | 25 | From Python **3.6**, `dict` objects keep insertion order. 26 | In Python **3.6**, this was not part of the language (was an implementation detail). 27 | 28 | In Python **3.7**, the insertion-order preservation nature of `dict` objects has been 29 | declared to be an **official** part of the Python language spec. 30 | 31 | 32 | 33 | --- 34 | 35 | layout: true 36 | ## f-string (3.6) 37 | 38 | 39 | --- 40 | 41 | Formatted string literal 42 | 43 | ```python 44 | name = "Fred" 45 | print(f"He said his name is {name}.") 46 | 47 | width = 10 48 | precision = 4 49 | value = decimal.Decimal("12.34567") 50 | print(f"result: {value:{width}.{precision}}") # nested fields 51 | ``` 52 | 53 | ``` 54 | He said his name is Fred. 55 | result: 12.35 56 | ``` 57 | 58 | --- 59 | 60 | New `=` specifier in Python **3.8** for debugging: 61 | 62 | ```python 63 | user = 'mjnaderi' 64 | member_since = date(1975, 7, 31) 65 | print(f'{user=} {member_since=}') 66 | ``` 67 | 68 | ``` 69 | user='mjnaderi' member_since=datetime.date(1975, 7, 31) 70 | ``` 71 | 72 | ```python 73 | from math import sin, radians 74 | theta = 30 75 | print(f'{theta=} {sin(radians(theta))=:.3f}') 76 | ``` 77 | 78 | ``` 79 | theta=30 sin(radians(theta))=0.500 80 | ``` 81 | 82 | 83 | 84 | --- 85 | 86 | layout: true 87 | ## Walrus Operator `:=` (3.8) 88 | 89 | 90 | --- 91 | 92 | ![Walrus](images/walrus.jpg) 93 | 94 | - Assignment Expression 95 | - Assigns values to variables as part of a larger expression. 96 | - Walrus: گراز دریایی 97 | 98 | --- 99 | 100 | Print Fibonacci numbers less than 1000 101 | 102 | ```python 103 | i = 1 104 | while True: 105 | f = fib(i) 106 | if f > 1000: 107 | break 108 | print(f) 109 | i += 1 110 | ######################################### 111 | i = 1 112 | f = fib(i) 113 | while f < 1000: 114 | print(f) 115 | i += 1 116 | f = fib(i) 117 | ######################################### 118 | i = 0 119 | while (f := fib(i := i + 1)) < 1000: 120 | print(f) 121 | ``` 122 | 123 | --- 124 | 125 | ```python 126 | fp = open('some/file.txt') 127 | while True: 128 | line = fp.readline() 129 | if not line: 130 | break 131 | process(line) 132 | ############################### 133 | fp = open('some/file.txt') 134 | while line := fp.readline(): 135 | process(line) 136 | ``` 137 | 138 | Examples from Python docs: 139 | 140 | ```python 141 | discount = 0.0 142 | if m := re.search(r'(\d+)% discount', advertisement): 143 | discount = float(m.group(1)) / 100.0 144 | ``` 145 | 146 | ```python 147 | [clean_name.title() for name in names 148 | if (clean_name := normalize('NFC', name)) in allowed_names] 149 | ``` 150 | 151 | 152 | 153 | --- 154 | 155 | layout: true 156 | ## Positional-only Parameters `/` (3.8) 157 | 158 | 159 | --- 160 | 161 | Indicate that some function parameters must be specified positionally and cannot be used as keyword arguments 162 | 163 | ```python 164 | def f(a, b, /, c, d, *, e, f): 165 | print(a, b, c, d, e, f) 166 | ``` 167 | 168 | - `a`, `b`: positional-only 169 | - `c`, `d`: can be positional or keyword 170 | - `e`, `f`: keyword-only 171 | 172 | ```python 173 | f(10, 20, 30, d=40, e=50, f=60) # Valid 174 | f(10, b=20, c=30, d=40, e=50, f=60) # Invalid 175 | f(10, 20, 30, 40, 50, f=60) # Invalid 176 | ``` 177 | 178 | --- 179 | 180 | **Use Cases:** 181 | 182 | - Emulate behaviors of existing C functions. 183 | 184 | ```python 185 | def pow(base, exp, mod=None, /): # pow doesn't accept keyword arguments 186 | # ... 187 | ``` 188 | 189 | - Ensure readability of function calls by disallowing kwargs (`len`) 190 | 191 | ```python 192 | def len(obj, /): 193 | # ... 194 | 195 | len(obj="Hello") # Invalid. The "obj" keyword argument impairs readability 196 | ``` 197 | 198 | - Change parameter name without the risk of breaking client code 199 | 200 | ```python 201 | def quantiles(dist, /, *, n=4, method='exclusive') 202 | # ... 203 | ``` 204 | 205 | You can rename `dist` parameter at any time with confident. 206 | 207 | --- 208 | 209 | **Note:** The name of positional-only parameters remain available for use in kwargs 210 | 211 | ```python 212 | class Counter(dict): 213 | def __init__(self, iterable=None, /, **kwargs): 214 | # Note "iterable" is a possible keyword argument 215 | ``` 216 | 217 | 218 | 219 | --- 220 | 221 | layout: true 222 | ## Built-in `breakpoint()` (3.7) 223 | 224 | 225 | --- 226 | 227 | This function drops you into the debugger (pdb) at the call site. 228 | You can continue execution using `continue` command in pdb. 229 | 230 | This does not really add any new functionality to Python, but it makes 231 | using debuggers more flexible and intuitive. 232 | 233 | `breakpoint()` and `continue` are our new friends now! 234 | 235 | --- 236 | 237 | layout: true 238 | ## Module `__getattr__` and `__dir__` (3.7) 239 | 240 | 241 | --- 242 | 243 | Python 3.7 allows defining `__getattr__()` on modules and will call it whenever a module 244 | attribute is otherwise not found. Defining `__dir__()` on modules is now also allowed. 245 | 246 | A typical example of where this may be useful is module attribute deprecation and lazy loading. 247 | 248 | 249 | 250 | --- 251 | 252 | layout: true 253 | ## `_` in Numeric Literals (3.6) 254 | 255 | 256 | --- 257 | 258 | ```python 259 | close_for = close_for * 60 * 1000 260 | 261 | close_for *= 60_000 262 | ``` 263 | 264 | ```python 265 | >>> t = datetime.now().timestamp() 266 | 267 | >>> print(f'{t:_}') 268 | 1_572_030_255.246196 269 | 270 | >>> print(f'{t=:_}') 271 | t=1_572_030_255.246196 272 | ``` 273 | 274 | 275 | 276 | --- 277 | 278 | layout: true 279 | ## Profile as Context Manager (3.8) 280 | 281 | 282 | --- 283 | 284 | ```python 285 | import cProfile 286 | 287 | def fib(n): 288 | if n in [1, 2]: 289 | return n 290 | return fib(n-1) + fib(n-2) 291 | 292 | with cProfile.Profile() as profiler: 293 | print(fib(20)) 294 | 295 | profiler.print_stats() 296 | ``` 297 | 298 | ``` 299 | 10946 300 | 13532 function calls (4 primitive calls) in 0.021 seconds 301 | 302 | Ordered by: standard name 303 | 304 | ncalls tottime percall cumtime percall filename:lineno(function) 305 | 13529/1 0.021 0.000 0.021 0.021 :1(fib) 306 | 1 0.000 0.000 0.000 0.000 cProfile.py:133(__exit__) 307 | 1 0.000 0.000 0.000 0.000 {built-in method builtins.print} 308 | 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} 309 | ``` 310 | 311 | 312 | 313 | --- 314 | 315 | layout: true 316 | ## `functools.lru_cache` as a Straight Decorator (3.8) 317 | 318 | 319 | --- 320 | 321 | `functools.lru_cache()` can now be used as a straight decorator rather than 322 | as a function returning a decorator. Default maxsize is 128. 323 | 324 | ```python 325 | @lru_cache 326 | def f(x): 327 | ... 328 | 329 | @lru_cache(maxsize=256) 330 | def f(x): 331 | ... 332 | ``` 333 | 334 | ```python 335 | @lru_cache 336 | def fib(n): 337 | # ... 338 | ``` 339 | 340 | ``` 341 | 10946 342 | 23 function calls (4 primitive calls) in 0.000 seconds 343 | 344 | Ordered by: standard name 345 | 346 | ncalls tottime percall cumtime percall filename:lineno(function) 347 | 20/1 0.000 0.000 0.000 0.000 :1(fib) 348 | 1 0.000 0.000 0.000 0.000 cProfile.py:133(__exit__) 349 | 1 0.000 0.000 0.000 0.000 {built-in method builtins.print} 350 | 1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects} 351 | ``` 352 | 353 | 354 | 355 | --- 356 | 357 | layout: true 358 | ## Data Class (3.7) 359 | 360 | 361 | --- 362 | 363 | The constructor and other magic methods, such as `__repr__()`, `__eq__()`, and `__hash__()` are generated automatically. 364 | 365 | ```python 366 | @dataclass 367 | class Point: 368 | x: float 369 | y: float 370 | z: float = 0.0 371 | 372 | p = Point(1.5, 2.5) 373 | print(p) # produces "Point(x=1.5, y=2.5, z=0.0)" 374 | ``` 375 | 376 | 377 | 378 | --- 379 | 380 | layout: true 381 | ## `typing` module: Support for type hints (3.5) 382 | 383 | 384 | --- 385 | 386 | ```python 387 | def greeting(name: str) -> str: 388 | return 'Hello ' + name 389 | ``` 390 | 391 | We need another presentation for `typing` module. I show you some of the latest features in 3.7 and 3.8. 392 | 393 | In Python 3.7, as a result of *PEP 560 work*, the import time of `typing` has been reduced by a factor of 7, 394 | and many typing operations are faster. 395 | 396 | --- 397 | 398 | **typing.TypedDict** (3.8) 399 | 400 | ```python 401 | class Location(TypedDict, total=False): 402 | lat_long: tuple 403 | grid_square: str 404 | xy_coordinate: tuple 405 | ``` 406 | 407 | **typing.Literal** (3.8) 408 | 409 | ```python 410 | def get_status(port: int) -> Literal['connected', 'disconnected']: 411 | ... 412 | ``` 413 | 414 | --- 415 | 416 | **typing.Final** (3.8) 417 | 418 | Indicate to type checkers that a name cannot be re-assigned or overridden in a subclass. 419 | 420 | ```python 421 | MAX_SIZE: Final = 9000 422 | MAX_SIZE += 1 # Error reported by type checker 423 | 424 | class Connection: 425 | TIMEOUT: Final[int] = 10 426 | 427 | class FastConnector(Connection): 428 | TIMEOUT = 1 # Error reported by type checker 429 | ``` 430 | 431 | 432 | 433 | --- 434 | 435 | layout: true 436 | ## New Time Functions With Nanosecond Resolution (3.7) 437 | 438 | 439 | --- 440 | 441 | The new functions return the number of nanoseconds as an integer value. 442 | 443 | - `time.clock_gettime_ns()` 444 | - `time.clock_settime_ns()` 445 | - `time.monotonic_ns()` 446 | - `time.perf_counter_ns()` 447 | - `time.process_time_ns()` 448 | - `time.time_ns()` 449 | 450 | 451 | 452 | --- 453 | 454 | layout: true 455 | ## `secrets` Module (3.6) 456 | 457 | 458 | --- 459 | 460 | Provides an obvious way to reliably generate **cryptographically strong** pseudo-random values 461 | suitable for managing secrets, such as account authentication, tokens, and similar. 462 | 463 | `random` module is not appropriate in these situations. 464 | 465 | ```python 466 | >>> import secrets 467 | 468 | >>> secrets.token_bytes(16) 469 | b'\xebr\x17D*t\xae\xd4\xe3S\xb6\xe2\xebP1\x8b' 470 | 471 | >>> secrets.token_hex(16) 472 | 'f9bf78b9a18ce6d46a0cd2b0b86df9da' 473 | ``` 474 | 475 | 476 | 477 | --- 478 | 479 | layout: true 480 | ## Others 481 | 482 | 483 | --- 484 | 485 | | Feature | Details / Sample | Python Version | 486 | | -------------------------------------------| ------------------------------------------------------------ | ---- | 487 | | `functools.cached_property` decorator | Like django's `cached_property` | 3.8 | 488 | | New module `multiprocessing.shared_memory` | For the allocation and management of shared memory to be accessed by one or more processes. | 3.8 | 489 | | `pprint.pp()` | Like `pprint.pprint` but dict keys are not sorted (prints with the order of insertion) | 3.8 | 490 | | `math.dist((7, 1), (2, 5))` | Distance between points | 3.8 | 491 | | `math.prod(iterable, *, start = 1)` | Like `sum`, but calculates product of items | 3.8 | 492 | | `math.comb(10, 3)` | $C(10, 3)$, $10\choose 3$ | 3.8 | 493 | | `math.perm(10, 3)` | $P(10, 3)$ | 3.8 | 494 | | `statistics.fmean([3.5, 4, 5.25])` | float mean, faster than `statistics.mean` | 3.8 | 495 | 496 | --- 497 | 498 | | Feature | Details / Sample | Python Version | 499 | | -------------------------------------------------------- | ------------------------------------------------------------ | ---- | 500 | | `statistics.geometric_mean()` | $\sqrt[n]{a_1 a_2 \ldots a_n}$ | 3.8 | 501 | | `statistics.multimode('aabbbbccddddeeffffgg')` | `['b', 'd', 'f']`
Return a list of the most frequently occurring values in the order they were first encountered in the *data*. | 3.8 | 502 | | `statistics.quantiles(data, *, n=4, method='exclusive')` | Divide *data* into *n* continuous intervals with equal probability. Returns a list of `n - 1` cut points separating the intervals. | 3.8 | 503 | | Class `statistics.NormalDist` | A tool for creating and manipulating normal distributions | 3.8 | 504 | | Functions can have more than 255 arguments. | | 3.7 | 505 | | Local Time Disambiguation | `t.fold` in [0, 1] | 3.7 | 506 | | **kwargs and attributes of classes (in `__dict__`) preserve order | | 3.7 | 507 | 508 | 509 | 510 | --- 511 | 512 | layout: false 513 | ## References 514 | 515 | 516 | https://docs.python.org/3/whatsnew/3.6.html 517 | 518 | https://docs.python.org/3/whatsnew/3.7.html 519 | 520 | https://docs.python.org/3/whatsnew/3.8.html 521 | 522 | ## Report Issues 523 | 524 | If you found an issue or have a suggestion, feel free to contact us. 525 | 526 | Report Issues -------------------------------------------------------------------------------- /presentations/New Python Features/images/python-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 22 | 23 | 25 | image/svg+xml 26 | 28 | 29 | 30 | 31 | 46 | 48 | 50 | 54 | 58 | 59 | 61 | 65 | 69 | 70 | 72 | 76 | 80 | 81 | 83 | 87 | 91 | 92 | 94 | 98 | 102 | 103 | 105 | 109 | 113 | 114 | 123 | 132 | 141 | 150 | 159 | 168 | 177 | 186 | 196 | 205 | 214 | 224 | 225 | 227 | 231 | 235 | 239 | 243 | 247 | 251 | 255 | 259 | 263 | 268 | 269 | 270 | -------------------------------------------------------------------------------- /presentations/New Python Features/images/walrus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/New Python Features/images/walrus.jpg -------------------------------------------------------------------------------- /presentations/New Python Features/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | New Python Features 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 41 | 42 | -------------------------------------------------------------------------------- /presentations/New Python Features/static/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); 2 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); 3 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700); 4 | 5 | body { 6 | font-family: 'Lato', sans-serif; 7 | } 8 | 9 | h1, h2, h3 { 10 | font-family: 'Yanone Kaffeesatz', sans-serif; 11 | font-weight: normal; 12 | } 13 | 14 | h1 > code, h2 > code, h3 > code { 15 | font-size: .8em; 16 | } 17 | 18 | h2 { 19 | font-size: 42px !important; 20 | } 21 | 22 | p, ul, ol { 23 | line-height: 1.5em; 24 | } 25 | 26 | code { 27 | font-family: 'Ubuntu Mono', monospace; 28 | } 29 | 30 | .remark-inline-code { 31 | background-color: #f0f0f0; 32 | border-radius: .2em; 33 | padding: 0 .3em .1em; 34 | } 35 | 36 | pre code { 37 | color: #333; 38 | background: #f6f6f6; 39 | border: 1px solid #ddd; 40 | border-radius: .4em; 41 | display: block; 42 | padding: .5em; 43 | } 44 | 45 | .hljs-github .hljs { 46 | background: #f6f6f6 !important; 47 | border: 1px solid #ddd; 48 | border-radius: .4em; 49 | } 50 | 51 | pre { 52 | border-radius: .4em; 53 | line-height: 1.1em; 54 | overflow-x: auto; 55 | } 56 | 57 | table { 58 | border: solid 1px #DDEEEE; 59 | border-collapse: collapse; 60 | border-spacing: 0; 61 | font-size: 15px; 62 | } 63 | 64 | table thead th { 65 | background-color: #DDEFEF; 66 | border: solid 1px #DDEEEE; 67 | color: #336B6B; 68 | padding: 10px; 69 | text-align: left; 70 | text-shadow: 1px 1px 1px #fff; 71 | } 72 | 73 | table tbody td { 74 | border: solid 1px #DDEEEE; 75 | color: #333; 76 | padding: 10px; 77 | text-shadow: 1px 1px 1px #fff; 78 | } -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/demo/db.sqlite3 -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/demo/demo/__init__.py -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demo/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for demo project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.1.3. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.1/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 't+lnvyd!1dapqpp)02-x1c=_w-d-@uxirohk723k=mph6fml&p' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'demoapp' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'demo.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'demo.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/3.1/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.sqlite3', 80 | 'NAME': BASE_DIR / 'db.sqlite3', 81 | } 82 | } 83 | 84 | 85 | # Password validation 86 | # https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators 87 | 88 | AUTH_PASSWORD_VALIDATORS = [ 89 | { 90 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 91 | }, 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 100 | }, 101 | ] 102 | 103 | 104 | # Internationalization 105 | # https://docs.djangoproject.com/en/3.1/topics/i18n/ 106 | 107 | LANGUAGE_CODE = 'en-us' 108 | 109 | TIME_ZONE = 'UTC' 110 | 111 | USE_I18N = True 112 | 113 | USE_L10N = True 114 | 115 | USE_TZ = True 116 | 117 | 118 | # Static files (CSS, JavaScript, Images) 119 | # https://docs.djangoproject.com/en/3.1/howto/static-files/ 120 | 121 | STATIC_URL = '/static/' 122 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demo/urls.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from django.urls import path 3 | from demoapp import views 4 | 5 | urlpatterns = [ 6 | path("admin/", admin.site.urls), 7 | path("", views.index, name="index"), 8 | path("injection", views.injection, name="injection"), 9 | path("xss", views.xss, name="xss"), 10 | ] 11 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demo/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for demo project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demoapp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/demo/demoapp/__init__.py -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demoapp/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class DemoappConfig(AppConfig): 5 | name = 'demoapp' 6 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demoapp/templates/demoapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Demos

4 | 12 | 13 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demoapp/templates/demoapp/injection.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

SQL Injection Demo

4 |

5 | Enter demo as username and 6 | ' OR '1' = '1 as password. 7 |

8 |
9 | {% csrf_token %} 10 | 11 | 12 | 13 |
14 | {% if authenticated %} 15 |

Correct Password

16 | {% endif %} 17 | Back to Index 18 | 19 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/demoapp/views.py: -------------------------------------------------------------------------------- 1 | from django.contrib.auth.models import User 2 | from django.http import HttpResponse 3 | from django.shortcuts import render 4 | from django.urls import reverse 5 | 6 | 7 | def index(request): 8 | return render(request, "demoapp/index.html") 9 | 10 | 11 | def injection(request): 12 | # Use this as password: ' OR '1' = '1 13 | authenticated = False 14 | if request.method == "POST": 15 | username = request.POST.get("username") 16 | password = request.POST.get("password") 17 | user = User.objects.raw(f""" 18 | SELECT * FROM auth_user 19 | WHERE username = '{username}' AND password = '{password}' 20 | """) 21 | # Yeah, I know password is not stored as plaintext and we should compare the hash. 22 | # But, this is just a demo! :) 23 | if user: 24 | authenticated = True 25 | return render(request, "demoapp/injection.html", { 26 | "authenticated": authenticated 27 | }) 28 | 29 | 30 | def xss(request): 31 | # Try this: 32 | # ?cc="/>XSS Demo 37 |

38 | Everything you put in "cc" parameter in URL, 39 | will be set as the "value" of following input without any escaping. 40 |

41 |

42 | 43 |

44 | Back to Index 45 | """ 46 | ) 47 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/demo/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'demo.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/OWASP-mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/OWASP-mark.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/any-questions.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/any-questions.jpg -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/attack-knowledge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/attack-knowledge.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/cia-triad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/cia-triad.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-1-overall-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-1-overall-1.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-2-data-breach-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-2-data-breach-1.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-3-crime-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-3-crime-1.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-4-compliance-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-4-compliance-1.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-5-costs-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/cybersecurity-statistics-2020-5-costs-1.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/heartbleed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/heartbleed.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/mitm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/mitm.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/owasp-2013-2017.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/owasp-2013-2017.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/owasp-risk-factors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/owasp-risk-factors.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/owasp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/owasp.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/privilege-escalation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/privilege-escalation.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/security-risk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/security-risk.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/sql-injection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/sql-injection.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/vulnerability.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/vulnerability.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/images/xkcd-heartbleed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/OWASP-Top-Ten/images/xkcd-heartbleed.png -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | OWASP Top Ten 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 29 | 30 | -------------------------------------------------------------------------------- /presentations/OWASP-Top-Ten/static/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Dosis); 2 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); 3 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,900); 4 | 5 | body { 6 | font-family: 'Lato', sans-serif; 7 | color: #f3f3f3; 8 | } 9 | 10 | .remark-slide-content { 11 | background-color: #222 !important; 12 | background-position: center; 13 | background-repeat: no-repeat; 14 | background-size: cover; 15 | font-size: 24px; 16 | } 17 | 18 | h1, h2, h3 { 19 | font-family: 'Dosis', sans-serif; 20 | font-weight: normal; 21 | } 22 | 23 | h1 > code, h2 > code, h3 > code { 24 | font-size: .8em; 25 | } 26 | 27 | h2 { 28 | /* font-size: 42px !important;*/ 29 | color: rgb(255, 217, 102); 30 | } 31 | 32 | p { 33 | line-height: 1.5em; 34 | } 35 | 36 | ul, ol { 37 | line-height: 1.8em; 38 | } 39 | 40 | code { 41 | font-family: 'Ubuntu Mono', monospace; 42 | } 43 | 44 | strong, b { 45 | color: rgb(255, 217, 102); 46 | font-weight: 900; 47 | } 48 | 49 | .remark-inline-code { 50 | background-color: rgba(255,255,255,0.12); 51 | border-radius: .2em; 52 | padding: 0 .3em .1em; 53 | } 54 | 55 | pre code { 56 | color: #333; 57 | background: #f6f6f6; 58 | border: 1px solid #ddd; 59 | border-radius: .4em; 60 | display: block; 61 | padding: .5em; 62 | } 63 | 64 | .hljs-github .hljs { 65 | background: #f6f6f6 !important; 66 | border: 1px solid #ddd; 67 | border-radius: .4em; 68 | } 69 | 70 | pre { 71 | border-radius: .4em; 72 | line-height: 1.1em; 73 | overflow-x: auto; 74 | } 75 | 76 | table { 77 | border: solid 1px #DDEEEE; 78 | border-collapse: collapse; 79 | border-spacing: 0; 80 | font-size: 15px; 81 | } 82 | 83 | table thead th { 84 | background-color: #DDEFEF; 85 | border: solid 1px #DDEEEE; 86 | color: #336B6B; 87 | padding: 10px; 88 | text-align: left; 89 | text-shadow: 1px 1px 1px #fff; 90 | } 91 | 92 | table tbody td { 93 | border: solid 1px #DDEEEE; 94 | color: #333; 95 | padding: 10px; 96 | text-shadow: 1px 1px 1px #fff; 97 | } 98 | 99 | .remark-slide-content a { 100 | color: skyblue; 101 | text-decoration: none; 102 | } 103 | 104 | .remark-slide-content img { 105 | display: block; 106 | max-width: 100%; 107 | max-height: 450px; 108 | margin: auto; 109 | } 110 | 111 | blockquote { 112 | display: flex; 113 | margin: 0 0 1em 0; 114 | } 115 | 116 | blockquote > p { 117 | padding: 1em; 118 | margin: 0; 119 | background: rgba(255,255,255,0.1); 120 | } 121 | 122 | 123 | img[alt="OWASP"] { 124 | height: 150px; 125 | filter: invert(); 126 | } 127 | 128 | img[alt="CIA"] { 129 | height: 400px; 130 | } 131 | 132 | img[alt="SQL-Injection"] { 133 | height: 140px; 134 | } 135 | 136 | img[alt="OWASP-Top-Ten"] { 137 | float: right; 138 | } 139 | 140 | img[alt="MITM"] { 141 | /*float: right;*/ 142 | height: 160px; 143 | } 144 | img[alt="Privilege-Escalation"] { 145 | /*float: right;*/ 146 | height: 200px; 147 | } 148 | img[alt="Heartbleed"] { 149 | float: right; 150 | height: 200px; 151 | } 152 | #before-references + ul li { 153 | line-height: 1.3; 154 | } 155 | 156 | /*img[alt="Vulnerability"] {*/ 157 | /* float: right;*/ 158 | /* height: 170px;*/ 159 | /*}*/ 160 | -------------------------------------------------------------------------------- /presentations/RegEx/Quera.L&D.RegEx.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/RegEx/Quera.L&D.RegEx.pdf -------------------------------------------------------------------------------- /presentations/Reinforcement learning/intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Reinforcement learning/intro.pdf -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_1_srp_fun.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_1_srp_fun.jpg -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_2_ocp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_2_ocp.jpg -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_2_ocp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_2_ocp.png -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_2_ocp_full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_2_ocp_full.png -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_2_ocp_fun.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_2_ocp_fun.jpeg -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_3_lsp_fun.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_3_lsp_fun.jpg -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_4_isp_fun.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_4_isp_fun.jpeg -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_5_dip_fun.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_5_dip_fun.jpeg -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_domino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_domino.png -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_graphical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_graphical.png -------------------------------------------------------------------------------- /presentations/SOLID-principles/images/solid_oop_fun.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/SOLID-principles/images/solid_oop_fun.jpg -------------------------------------------------------------------------------- /presentations/SOLID-principles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SOLID principles 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /presentations/SOLID-principles/static/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz); 2 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); 3 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,900); 4 | 5 | body { 6 | font-family: 'Lato', sans-serif; 7 | color: #eee; 8 | } 9 | 10 | strong, b { 11 | color: #FFF; 12 | font-weight: 900; 13 | } 14 | 15 | .remark-slide-content { 16 | background: #444 !important; 17 | } 18 | 19 | h1, h2, h3 { 20 | font-family: 'Yanone Kaffeesatz', sans-serif; 21 | font-weight: normal; 22 | } 23 | 24 | h3 { 25 | font-size: 32px !important; 26 | } 27 | 28 | h1 > code, h2 > code, h3 > code { 29 | font-size: .8em; 30 | } 31 | 32 | h2 { 33 | font-size: 42px !important; 34 | } 35 | 36 | p, ul, ol { 37 | line-height: 1.5em; 38 | } 39 | 40 | li { 41 | margin: .5em 0; 42 | } 43 | 44 | code { 45 | font-family: 'Ubuntu Mono', monospace; 46 | } 47 | 48 | .remark-inline-code { 49 | background-color: rgba(255,255,255,0.12); 50 | border-radius: .2em; 51 | padding: 0 .3em .1em; 52 | } 53 | 54 | pre code { 55 | color: #333; 56 | background: #f6f6f6; 57 | border: 1px solid #ddd; 58 | border-radius: .4em; 59 | display: block; 60 | padding: .5em; 61 | } 62 | 63 | .hljs-github .hljs { 64 | background: #f6f6f6 !important; 65 | border: 1px solid #ddd; 66 | border-radius: .4em; 67 | } 68 | 69 | pre { 70 | border-radius: .4em; 71 | line-height: 1.1em; 72 | overflow-x: auto; 73 | } 74 | 75 | table th { 76 | text-align: initial; 77 | border-bottom: 1px solid #aaa; 78 | } 79 | 80 | table td:empty, table th:empty { 81 | visibility: hidden; 82 | } 83 | 84 | table tbody td, table thead th { 85 | padding: .4em; 86 | line-height: 1.5em; 87 | } 88 | 89 | .remark-slide-content a { 90 | color: skyblue; 91 | text-decoration: none; 92 | } 93 | 94 | .remark-slide-content img { 95 | margin: auto; 96 | background:white; 97 | } 98 | 99 | blockquote { 100 | margin: 1em 0; 101 | } 102 | 103 | blockquote > p { 104 | padding: 1em; 105 | background: rgba(255,255,255,0.1); 106 | } 107 | 108 | .item-title { 109 | font-size: 1.4em; 110 | color: white; 111 | } 112 | 113 | u { 114 | text-decoration: underline; 115 | } -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/content.md: -------------------------------------------------------------------------------- 1 | class: center, middle 2 | 3 |

Introduction to the
Theory of Computation

4 | 5 | Part One 6 | 7 | ### Mohammad Javad Naderi 8 | 9 | July 2021 10 | 11 | --- 12 | layout: true 13 | ## What Will We Cover? 14 | 15 | --- 16 | 17 | - A Brief Intro 18 | - Enumerability 19 | - Diagonalization 20 | - Turing Computability 21 | 22 | --- 23 | layout: false 24 | background-image: url(images/bg/abacus.jpg) 25 | ## What Are We Talking About? 26 | 27 | --- 28 | 29 | ## Related Stuff 30 | 31 | - **Automata** Theory (Automata is the plural form for **Automaton**) 32 | - e.g. DFA, NFA, Buchi, ... 33 | - finite/infinite input 34 | - finite/infinite states 35 | - **Computational Complexity** Theory 36 | - $O(\lg n)$, $O(n \lg n)$, $O(n^2)$, ... 37 | - P, NP 38 | - **Language** Theory 39 | - Grammars, Compilers, NLP, RegExp, ... 40 | - **Logic** 41 | - First-order logic, Higher-order logic, ... 42 | 43 | --- 44 | layout: false 45 | background-image: url(images/bg/dominos.jpg) 46 | ## Enumerability 47 | 48 | --- 49 | 50 | ## Enumerability 51 | 52 | - Our ultimate goal will be to present some celebrated theorems about **inherent limits** on 53 | what can be **computed** and on what can be **proved**. 54 | - What is computability? What is provability? 55 | - Computations involve positive integers 1, 2, 3, ... 56 | - Proofs consist of sequences of symbols from the usual alphabet A, B, C, ... or some other. 57 | - It is important to understand the relationship between **positive integers** 58 | and **sequences of symbols**. 59 | 60 | 61 | --- 62 | 63 | ## Enumerable (Countable) Set 64 | 65 | > A set whose members can be enumerated: arranged in a single list 66 | 67 | - Set $P$ of positive integers: $1, 2, 3, 4, ...$ 68 | - Set $N$ of natural numbers: $0, 1, 2, 3, ...$ 69 | - Set $P^{-}$ of negative integers: $-1, -2, -3, -4, ...$ 70 | - Empty set $\emptyset$ is regarded as enumerable. 71 | - This is not acceptable: $1, 3, 5, 7, ..., 2, 4, 6, 8, ...$ 72 | - Redundancy is OK: $1, 1, 2, 2, 3, 3, ...$ 73 | - Gaps are OK: $1, -, 3, -, 5, -, ...$ 74 | - Each list: function $f$ with positive integers as arguments and set members as values 75 | - total or partial 76 | 77 | --- 78 | 79 | ## Sets of Pairs 80 | 81 | Zig-zag move in a table: 82 | 83 | ![Figure-1](images/figures/fig1.png) 84 | 85 | Imagine a hotel with an enumerable infinity of rooms... 86 | 87 | $(1, 1), (2, 1), (1, 2), (3, 1), (1, 3), (2, 2), (1, 4), (4, 1), (1, 5), (2, 3), ...$ 88 | 89 | --- 90 | 91 | ## Examples of Enumerable Sets 92 | 93 | - The set of positive rational numbers 94 | - The set of rational numbers 95 | - The set of ordered triples of positive integers 96 | - The set of ordered k-tuples of positive integers, for any fixed k 97 | - The set of finite sequences of positive integers less than 10 98 | - The set of finite sequences of positive integers less than b, for any fixed b 99 | - The set of finite sequences of positive integers 100 | - The set of finite sets of positive integers 101 | - Any subset of an enumerable set 102 | - The union of any two enumerable sets 103 | - The set of finite strings from a finite or enumerable alphabet of symbols 104 | 105 | --- 106 | layout: false 107 | background-image: url(images/bg/kent-tupas-u7SCebzS57Q-unsplash.jpg) 108 | ## Diagonalization 109 | 110 | --- 111 | 112 | ## Diagonalization 113 | 114 | > Not every set is enumerable! 115 | 116 | **Cantor's Theorem:** The set of all sets of positive integers ($P^{*}$) is not enumerable. 117 | 118 | **Proof summary:** 119 | 120 | From any list $L$ of sets of positive integers, we discover a set $\Delta(L)$ 121 | of positive integers which is not a member of $L$. 122 | 123 | --- 124 | 125 | ## Proof of Cantor's Theorem 126 | 127 | - We argue by *reductio ad absurdum*. 128 | 129 | ![Figure-2](images/figures/fig2.png) 130 | 131 | $$1-s_1(1), 1-s_2(2), 1-s_3(3), 1-s_4(4), ...$$ 132 | 133 | --- 134 | 135 | ## Imagine a Superhuman Enumerator... 136 | 137 | - **Zeus** can enumerate any enumerable set in only 1 second! 138 | - How? 139 | 140 | ![Figure-3](images/figures/fig3.png) 141 | - Zeus even can enumerate an infinite sequence of infinite lists in 1 second! 142 | - But, Cantor proved that there are sets which even Zeus cannot enumerate. 143 | - No matter how fast he works, or how long. Even, infinitely long... 144 | 145 | --- 146 | 147 | ## Once We Have One, We Get Others 148 | 149 | The set of real numbers is not enumerable. 150 | 151 | - Consider only numbers between 0 and 1. 152 | - And consider only numbers with 0 and 1 digits in their decimal notation. 153 | ``` 154 | 0.1 1 155 | 0.01 2 156 | 0.11 1, 2 157 | 0.001 3 158 | 0.101 1, 3 159 | ... 160 | 0.010101... 2, 4, 6, ... 161 | 0.111111... 1, 2, 3, ... 162 | ``` 163 | - If this set of real numbers is enumerable, $P^*$ is enumerable too. 164 | 165 | --- 166 | layout: false 167 | background-image: url(images/bg/imitation-game.jpg) 168 | ## Turing Computability 169 | 170 | --- 171 | 172 | ## Computation 173 | 174 | - Zeus can write the whole table of values of a function on positive integers. 175 | - Humans can't do this. Resources are limited. 176 | - Fortunately, there is no need to do this. 177 | - We need values one at a time. 178 | - Given $n$, we need the value of $f(n)$. 179 | - We need a list of instructions to compute the value of $f(n)$. 180 | 181 | --- 182 | 183 | ## Effectively Computable Functions 184 | 185 | > A function is **effectively computable** if there are definite, explicit rules by following which 186 | one could in principle compute its value for any given arguments. 187 | 188 | - In practice, a human or machine **can't** compute the value of $f(n)$ for **any** given $n$. 189 | - In theory, it can be done in a **finite** amount of time, but... 190 | - This finite amount of time can be longer than your life. 191 | - Eventually you’d be trying to write on molecules, on atoms, on electrons. 192 | - But let's **ignore** these practical limitations 193 | - and work with an **idealized** notion of computability. 194 | - In next talk, we will prove that certain functions are **not computable**, 195 | - even if we overcome all practical limitations. 196 | 197 | --- 198 | 199 | ## Introducing Turing-computable Functions 200 | 201 | - Effective computability is an intuitive notion. 202 | - We need a formalism. 203 | - Introduce **Turing-computable** functions. 204 | 205 | --- 206 | 207 | ## Is Turing-computable == effectively computable ? 208 | 209 | - One side is obvious from definition of Turing machine. 210 | - Every Turing-computable function is effectively computable. 211 | - The converse is known as **Turing's Thesis**. 212 | - Not obvious 213 | - Can't be proved rigorously. (Because the notion of effective computability is intuitive) 214 | - There is an enormous amount of evidence... 215 | 216 | --- 217 | 218 | ## Numeral System in Turing Machines 219 | 220 | - We need a **numeral system** for representing arguments and values. 221 | - Computations can be harder with some notations (e.g. Roman numerals) 222 | - Every numeral system can be used, 223 | - as long as **translation** between the systems can be carried out according to explicit rules. 224 | - For purposes of framing a rigorously defined notion of computability, 225 | - it is convenient to use **monadic** or tally notation. 226 | 227 | $$1, 11, 111, 1111, ...$$ 228 | 229 | --- 230 | 231 | ## Turing Machine 232 | 233 | - Computation takes place on a **tape**, unending in both directions. 234 | - Each square is blank ($S_0$ or $0$), or has a stroke ($S_1$ or $1$). 235 | - Has one of a finite number of **internal states**. 236 | - Has a program. At each stage according to the current state and scanned symbol: 237 | - Acts on tape + Internal state changes 238 | - Possible actions in each stage: 239 | - Erase, Print, Move left, Move right, Halt 240 | 241 | ![Figure-4](images/figures/fig4.png) 242 | 243 | --- 244 | 245 | ## A Turing Machine Program 246 | 247 | ![Figure-5](images/figures/fig5.png) 248 | 249 | Prints three strokes and halts. 250 | 251 | - [Gist](https://gist.github.com/mjnaderi/f6ef957e4ef3a44fc42ec2dc5a061c36) 252 | - **[Demo!](https://turingmachine.io/?import-gist=f6ef957e4ef3a44fc42ec2dc5a061c36)** 253 | 254 | --- 255 | 256 | ## Example: Determining Parity 257 | 258 | ![Figure-7](images/figures/fig7.png) 259 | 260 | - [Gist](https://gist.github.com/mjnaderi/776a71ddb8a4d3ded2ab397957515c89) 261 | - **[Demo!](https://turingmachine.io/?import-gist=776a71ddb8a4d3ded2ab397957515c89)** 262 | 263 | --- 264 | 265 | ## Example: Multiplication by 2 266 | 267 | ![Figure-6](images/figures/fig6.png) 268 | 269 | - [Gist](https://gist.github.com/mjnaderi/c2537d940134be328170f50249526fc8) 270 | - **[Demo!](https://turingmachine.io/?import-gist=c2537d940134be328170f50249526fc8)** 271 | 272 | --- 273 | 274 | ## Example: Sum of Two Positive Integers 275 | 276 | - [Gist](https://gist.github.com/mjnaderi/63cf060a4ed7273f995c2379c697ec9a) 277 | - **[Demo!](https://turingmachine.io/?import-gist=63cf060a4ed7273f995c2379c697ec9a)** 278 | 279 | --- 280 | 281 | ## Example: Product of Two Positive Integers 282 | 283 | ![Figure-10](images/figures/fig10.png) 284 | 285 | - Uses **leapfrog routine**. 286 | 287 | ``` 288 | 111_1111 289 | _11_____1111 290 | __1_________1111 291 | ____111111111111 292 | ``` 293 | 294 | - Leapfrog: 295 | 296 | ``` 297 | 1111 298 | _111_1 299 | __11_11 300 | ___1_111 301 | ____1111 302 | 303 | ``` 304 | 305 | --- 306 | 307 | ## Problems 308 | 309 | 1. Consider a tape containing a block of $n$ strokes, followed by a space, followed 310 | by a block of $m$ strokes, followed by a space, followed by a block of $k$ strokes, 311 | and otherwise blank. Design a Turing machine that when started on the leftmost 312 | stroke will eventually halt, having neither printed nor erased anything ... 313 | - (a) ... on the leftmost stroke of the second block. 314 | - (b) ... on the leftmost stroke of the third block. 315 | 2. Continuing the preceding problem, design a Turing machine that when started 316 | on the leftmost stroke will eventually halt, having neither printed nor erased 317 | anything ... 318 | - (a) ... on the rightmost stroke of the second block. 319 | - (b) ... on the rightmost stroke of the third block. 320 | 321 | --- 322 | layout: false 323 | background-image: url(images/any-questions.jpg) 324 | --- 325 | ## References 326 | 327 |
328 | 329 | ![Book-Cover](images/book-cover.png) 330 | 331 | - Boolos, George S., John P. Burgess, and Richard C. Jeffrey. Computability and logic. Cambridge university press, 2007. 332 | 333 | If you found an issue or have a suggestion, feel free to contact us. 334 | 335 | Report Issues 336 | -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/any-questions.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/any-questions.jpg -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/bg/abacus.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/bg/abacus.jpg -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/bg/dominos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/bg/dominos.jpg -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/bg/imitation-game.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/bg/imitation-game.jpg -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/bg/kent-tupas-u7SCebzS57Q-unsplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/bg/kent-tupas-u7SCebzS57Q-unsplash.jpg -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/book-cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/book-cover.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/figures/fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/figures/fig1.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/figures/fig10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/figures/fig10.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/figures/fig2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/figures/fig2.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/figures/fig3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/figures/fig3.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/figures/fig4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/figures/fig4.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/figures/fig5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/figures/fig5.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/figures/fig6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/figures/fig6.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/images/figures/fig7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/Theory-of-Computation-1/images/figures/fig7.png -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Introduction to the Theory of Computation - Part One 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /presentations/Theory-of-Computation-1/static/style.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Dosis); 2 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic); 3 | @import url(https://fonts.googleapis.com/css?family=Lato:400,700,900); 4 | 5 | body { 6 | font-family: 'Lato', sans-serif; 7 | color: #eee; 8 | } 9 | 10 | .remark-slide-content { 11 | background-color: #111 !important; 12 | background-position: center; 13 | background-repeat: no-repeat; 14 | background-size: cover; 15 | font-size: 24px; 16 | } 17 | 18 | h1, h2, h3 { 19 | font-family: 'Dosis', sans-serif; 20 | font-weight: normal; 21 | } 22 | 23 | h1 > code, h2 > code, h3 > code { 24 | font-size: .8em; 25 | } 26 | 27 | h2 { 28 | /* font-size: 42px !important;*/ 29 | color: rgb(255, 217, 102); 30 | } 31 | 32 | p { 33 | line-height: 1.5em; 34 | } 35 | 36 | ul, ol { 37 | line-height: 1.8em; 38 | } 39 | 40 | code { 41 | font-family: 'Ubuntu Mono', monospace; 42 | } 43 | 44 | strong, b { 45 | color: rgb(255, 217, 102); 46 | font-weight: 900; 47 | } 48 | 49 | .remark-inline-code { 50 | background-color: rgba(255,255,255,0.12); 51 | border-radius: .2em; 52 | padding: 0 .3em .1em; 53 | } 54 | 55 | pre code { 56 | color: #333; 57 | background: #f6f6f6; 58 | border: 1px solid #ddd; 59 | border-radius: .4em; 60 | display: block; 61 | padding: .5em; 62 | } 63 | 64 | .hljs-github .hljs { 65 | background: #f6f6f6 !important; 66 | border: 1px solid #ddd; 67 | border-radius: .4em; 68 | } 69 | 70 | pre { 71 | border-radius: .4em; 72 | line-height: 1.1em; 73 | overflow-x: auto; 74 | } 75 | 76 | table { 77 | border: solid 1px #DDEEEE; 78 | border-collapse: collapse; 79 | border-spacing: 0; 80 | font-size: 15px; 81 | } 82 | 83 | table thead th { 84 | background-color: #DDEFEF; 85 | border: solid 1px #DDEEEE; 86 | color: #336B6B; 87 | padding: 10px; 88 | text-align: left; 89 | text-shadow: 1px 1px 1px #fff; 90 | } 91 | 92 | table tbody td { 93 | border: solid 1px #DDEEEE; 94 | color: #333; 95 | padding: 10px; 96 | text-shadow: 1px 1px 1px #fff; 97 | } 98 | 99 | .remark-slide-content a { 100 | color: skyblue; 101 | text-decoration: none; 102 | } 103 | 104 | .remark-slide-content img { 105 | display: block; 106 | max-width: 100%; 107 | max-height: 450px; 108 | margin: auto; 109 | } 110 | 111 | blockquote { 112 | margin: 0 0 1em 0; 113 | padding: 1px 1em; 114 | background: rgba(255,255,255,0.1); 115 | } 116 | 117 | img[alt="Figure-1"] { 118 | width: 300px; 119 | } 120 | img[alt="Figure-2"] { 121 | height: 300px; 122 | } 123 | img[alt="Figure-3"] { 124 | height: 200px; 125 | } 126 | img[alt="Figure-4"] { 127 | height: 140px; 128 | } 129 | img[alt="Figure-10"] { 130 | float: right; 131 | margin-left: 1em; 132 | } 133 | img[alt="Book-Cover"] { 134 | float: right; 135 | } 136 | #before-references + ul li { 137 | line-height: 1.3; 138 | } 139 | -------------------------------------------------------------------------------- /presentations/gRPC/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quera | gRPC Presentation 5 | 6 | 7 |
8 | 9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /presentations/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QueraTeam/talks/2cfc4da33ab22302579cd4587de2a81c8fe2bd0c/presentations/static/favicon.ico --------------------------------------------------------------------------------