├── .devcontainer ├── devcontainer.json └── scripts │ ├── init.sh │ └── startup.sh ├── README.md ├── chat ├── WORKSHOP.md ├── sherlock │ ├── Dockerfile │ ├── README.md │ └── app │ │ ├── __init__.py │ │ ├── db.json │ │ ├── rengine.py │ │ ├── requirements.txt │ │ ├── run.py │ │ └── templates │ │ └── index.html └── solution-sherlock.tar.xz ├── cli └── WORKSHOP.md ├── copilot ├── WORKSHOP.md └── solution-copilot.tar.xz └── docs ├── assets ├── elections.png ├── gh-copilot-labs.png ├── github.jpg ├── screens-lab.png └── screens-presentation.png ├── links.md ├── notes.md ├── slides.pdf ├── slieds.pdf └── timing.md /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Copilot Chat", 3 | "image": "mcr.microsoft.com/devcontainers/base:ubuntu", 4 | "hostRequirements": { 5 | "cpus": 2, 6 | "memory": "4gb", 7 | "storage": "32gb" 8 | }, 9 | "features": { 10 | "ghcr.io/devcontainers-contrib/features/black:2": {"version": "latest"}, 11 | "ghcr.io/devcontainers-contrib/features/pylint:2": {"version": "latest"}, 12 | "ghcr.io/devcontainers/features/docker-in-docker:2": {"version": "latest"}, 13 | "ghcr.io/devcontainers/features/node:1": {"version": "latest"}, 14 | "ghcr.io/devcontainers/features/python:1": {"version": "latest"} 15 | }, 16 | "customizations": { 17 | "codespaces": { 18 | "openFiles": [ 19 | "README.md" 20 | ] 21 | }, 22 | "vscode": { 23 | "extensions": [ 24 | "DavidAnson.vscode-markdownlint", 25 | "GitHub.copilot-chat", 26 | "GitHub.copilot", 27 | "ms-python.python" 28 | ] 29 | } 30 | }, 31 | "postCreateCommand": ".devcontainer/scripts/init.sh", 32 | "postStartCommand": ".devcontainer/scripts/startup.sh" 33 | } 34 | -------------------------------------------------------------------------------- /.devcontainer/scripts/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -Eeuo pipefail 4 | 5 | # Add the GitHub CLI package repository to the system's list of APT sources. 6 | type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) 7 | curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ 8 | && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ 9 | && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null 10 | 11 | # Install packages 12 | sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ 13 | bash-completion \ 14 | gh \ 15 | git \ 16 | tig \ 17 | pcregrep \ 18 | tmux 19 | 20 | # Install gh extension Copilot CLI 21 | # This will work in GH's codespace but not in the local machine. 22 | # In the local machine, install manually! 23 | if [[ -v GITHUB_TOKEN ]]; then 24 | gh extension install github/gh-copilot 25 | gh extension upgrade gh-copilot 26 | fi 27 | -------------------------------------------------------------------------------- /.devcontainer/scripts/startup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -Eeuo pipefail 4 | 5 | # autocomplete 6 | source /usr/share/bash-completion/completions/git 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Workshop Github Copilot Chat 2 | 3 | ![github](/docs/assets/github.jpg) 4 | 5 | ## Installation Local 6 | 7 | 1. GitHub Copilot is not free. It costs [$10](https://github.com/features/copilot/plans#pricing) per month for individuals. 8 | 1. DISCONNECT VPN - GitHub Copilot doesn't work with VPN. 9 | 10 | ```shell 11 | git clone https://github.com/ldynia/workshop-github-copilot-chat.git 12 | code workshop-github-copilot-chat/ 13 | 14 | # Rebuild Container 15 | Ctrl + K Ctrl + O 16 | ``` 17 | 18 | ## Github Copilot X 19 | 20 | 1. [Copilot](./copilot/WORKSHOP.md) 21 | 1. [Copilot Chat](./chat/WORKSHOP.md) 22 | 1. [Copilot CLI](./cli/WORKSHOP.md) 23 | 1. [~~Copilot Labs~~](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-labs) 24 | 25 | ## Copilot Shortcuts Linux 26 | 27 | | Shortcut | Description | 28 | | -------- | ----------- | 29 | | `tab` | Accept suggestion | 30 | | `alt+enter` | Show 10 suggestions | 31 | | `alt+/` | Show suggestions | 32 | | `alt+[` | Show previous suggestions | 33 | | `alt+]` | Show next suggestions | 34 | | `ctrl+alt+i`, `ctrl+shift+c` | Chat | 35 | | `ctrl+i` | Chat inline | 36 | | `ctrl+l` | Clear the session | 37 | | `ctrl+enter` | Insert into code | 38 | | `ctrl+alt+enter` | Insert into terminal | 39 | 40 | ## Links 41 | 42 | ### 2024 43 | - https://code.visualstudio.com/docs/editor/github-copilot#_chat-view 44 | - https://docs.github.com/en/copilot/configuring-github-copilot/configuring-github-copilot-in-your-environment?tool=vscode 45 | - https://docs.github.com/en/copilot/using-github-copilot/getting-started-with-github-copilot?tool=vscode 46 | - https://www.youtube.com/watch?v=SZVCJRUADc4 47 | - https://resources.github.com/learn/pathways/?utm_source=learning-pathways&utm_medium=Resources&utm_campaign=copilot-banner 48 | - https://resources.github.com/learn/pathways/copilot/essentials/essentials-of-github-copilot/?utm_campaign=copilot-banner&utm_medium=Resources&utm_source=learning-pathways 49 | - https://learn.microsoft.com/en-us/legal/cognitive-services/openai/customer-copyright-commitment 50 | - https://github.com/features/copilot/getting-started 51 | 52 | ### 2025 53 | 54 | - https://github.blog/news-insights/product-news/bringing-developer-choice-to-copilot/ 55 | - TODO: https://github.com/marketplace?type=apps&copilot_app=true 56 | - TODO: https://docs.github.com/en/copilot/using-github-copilot/code-review/using-copilot-code-review?tool=vscode 57 | - TODO: https://docs.github.com/en/copilot/building-copilot-extensions/about-building-copilot-extensions 58 | - TODO: https://github.com/github-copilot/workspace_waitlist_signup 59 | - TODO: https://github.blog/changelog/2024-10-29-refine-and-validate-code-review-suggestions-with-copilot-workspace-public-preview/ 60 | - TODO: https://github.blog/changelog/2024-10-29-multi-file-editing-code-review-custom-instructions-and-more-for-github-copilot-in-vs-code-october-release-v0-22/ 61 | - TODO: https://githubnext.com/projects/github-spark 62 | - TODO: https://githubnext.com/projects/learning-sandbox/ 63 | 64 | ## Setup Local 65 | 66 | ```shell 67 | { 68 | rm -rf ~/copilot_chat; 69 | mkdir -p ~/copilot_chat/solution/copilot ~/copilot_chat/solution/sherlock ~/copilot_chat/solution/cli; 70 | cd ~/copilot_chat/; 71 | git clone https://github.com/ldynia/workshop-github-copilot-chat.git; 72 | tar -vxf workshop-github-copilot-chat/chat/solution-sherlock.tar.xz --directory solution/sherlock; 73 | tar -vxf workshop-github-copilot-chat/copilot/solution-copilot.tar.xz --directory solution/copilot; 74 | find ~/copilot_chat/workshop-github-copilot-chat/ -type f -name "*.tar.xz" -exec rm -f {} \; 75 | mv ~/copilot_chat/workshop-github-copilot-chat/chat/WORKSHOP.md ~/copilot_chat/solution/sherlock; 76 | mv workshop-github-copilot-chat/cli/ ~/copilot_chat/solution/; 77 | mv ~/copilot_chat/workshop-github-copilot-chat/copilot/WORKSHOP.md ~/copilot_chat/solution/copilot; 78 | rm -rf ~/copilot_chat/workshop-github-copilot-chat/README.md; 79 | rm -rf ~/copilot_chat/workshop-github-copilot-chat/docs; 80 | touch workshop-github-copilot-chat/copilot/app.js; 81 | touch workshop-github-copilot-chat/copilot/bitcoin.py; 82 | touch workshop-github-copilot-chat/copilot/fibonacci-v1.py; 83 | touch workshop-github-copilot-chat/copilot/regex.py; 84 | touch workshop-github-copilot-chat/copilot/questions.py; 85 | code ~/copilot_chat/solution/; 86 | code ~/copilot_chat/workshop-github-copilot-chat/; 87 | } 88 | ``` 89 | ## Setup Codespaces 90 | 91 | ```shell 92 | { 93 | rm -rf chat/solution-sherlock.tar.xz; 94 | rm -rf copilot/solution-copilot.tar.xz; 95 | rm -rf docs/; 96 | } 97 | ``` 98 | -------------------------------------------------------------------------------- /chat/WORKSHOP.md: -------------------------------------------------------------------------------- 1 | # Copilot Chat 2 | 3 | Remember to **DISCONNECT VPN**. 4 | 5 | * [GitHub Copilot Pricing](https://github.com/features/copilot/plans) 6 | * [GitHub Copilot Docs](https://docs.github.com/en/copilot/using-github-copilot) 7 | * [GitHub Copilot Prompts](https://docs.github.com/en/copilot/using-github-copilot/example-use-cases/example-prompts-for-copilot-chat) 8 | 9 | ## Agents, Commands and LLMs 10 | 11 | **Objectives:** Explain the core concepts of GitHub Copilot. 12 | 13 | An agent is a specialized chat participant that can assist in specific areas. See [extensions](https://github.com/marketplace?type=apps&copilot_app=true) 14 | 15 | * `@workspace` - Ask about your workspace 16 | * `/explain` - Explain how the selected code works 17 | * `/tests`- Generate unit tests for the selected code 18 | * `/fix`- Propose a fix for the problems in the selected code 19 | * `/new`- Scaffold code for a new workspace 20 | * `/newNotebook` - Create a new Jupyter Notebook 21 | * `@vscode` - Ask about VS Code 22 | * `/search` - Generate query parameters for workspace search 23 | * `/api` - Ask about VS Code extension development 24 | * `@terminal` - Ask how to do something in the terminal 25 | * `/help` - General help about GitHub Copilot. 26 | * `/clear` - Clear the session. 27 | 28 | Chat variables include specific context in your prompt. 29 | 30 | * `#file` - Include specific file. 31 | * `#editor` - Include visible source code. 32 | * `#selection` - The current selection in the active editor. 33 | * `#terminalLastCommand` - The active terminal's last run command 34 | * `#terminalSelection` - The current selection in the terminal. 35 | * `#codebase` - Searches through the codebase and pulls out relevant information for the query. 36 | 37 | [LLMs:](https://github.blog/news-insights/product-news/bringing-developer-choice-to-copilot/) 38 | 39 | Explore [models](https://github.com/marketplace/models) 40 | 41 | * [Claude 3.5 Sonnet](https://www.anthropic.com/claude/sonnet) - Antropic 42 | * [GPT 4o](https://openai.com/index/hello-gpt-4o/) - OpenAI 43 | * [o1](https://openai.com/o1/) - OpenAI 44 | * [o1-mini](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/) - OpenAI 45 | * [Gemini 1.5 Pro](https://deepmind.google/technologies/gemini/pro/) - Google 46 | 47 | # Sherlock 48 | 49 | ## How To Run The Project 50 | 51 | **Objectives:** How to start working with an unknown project 52 | 53 | Go to `cd chat/sherlock` directory and run the application. 54 | 55 | ``` 56 | @workspace What is Sherlock? 57 | @workspace How to run Sherlock locally? 58 | @workspace How to run this project with docker? 59 | ``` 60 | 61 | Visit the following URLs: Run locally 62 | 63 | - http://localhost:8080/ 64 | 65 | ## Fix Project 66 | 67 | **Objectives:** Compare GitHub Copilot and GitHub Copilot Chat. 68 | 69 | 1. In VSCode Open `OUTPUT` tab and select `GitHub Copilot Chat` option. 70 | 2. Open `chat/sherlock/app/__init__.py` file. 71 | 72 | ``` 73 | Ctrl + I 74 | # Add current directory to PYTHONPATH 75 | 76 | Ctrl + Shift + C 77 | # Add current directory to PYTHONPATH 78 | ``` 79 | 80 | ## How To Write Unit Tests 81 | 82 | **Objectives:** Write unit tests with `/tests` command. 83 | 84 | Open `chat/sherlock/app/run.py` file and select index, live, and recommended functions. 85 | 86 | ``` 87 | #selection Generate unit tests using pytest module 88 | ``` 89 | 90 | **Notes:** Create the following files and run `pytest -vs app/tests` command. 91 | 92 | - `app/tests/__init__.py` file 93 | - `app/tests/conftest.py` file 94 | - `app/tests/test_run.py` file 95 | 96 | ## Refactor `run.py` 97 | 98 | **Objectives:** Refactor application. 99 | 100 | Open `chat/sherlock/app/run.py` file. 101 | 102 | ``` 103 | # Select the whole file. Send two prompts. 104 | Does this code violate SOLID principles? 105 | Does this code violate CUPID principles? 106 | How would you improve this code? 107 | What to refactor? 108 | 109 | # Select the whole file. Send one prompt. 110 | Does this code violate SOLID principles? What to refactor? 111 | 112 | Analyze selected code for SRP violation? 113 | 114 | # Select recommended functions 115 | Refactor 116 | ``` 117 | 118 | ## Refactor `rengine.py` And Document 119 | 120 | **Objectives:** Refactor application and document methods with `/doc` command. 121 | 122 | Open `chat/sherlock/app/rengine.py` file. 123 | 124 | ``` 125 | # Select all 126 | Propose better variables name and class name 127 | 128 | # Select all 129 | Refactor selected code to a more generic implementation 130 | 131 | # Select the code in the recommend method. 132 | Comment every line in recommend method with time complexity. Estimate the total time complexity of the recommended method. 133 | 134 | # Select the method and use /doc command 135 | Add pep8 docs string 136 | 137 | # Select all 138 | Use Python annotations to document methods in selected code. 139 | ``` 140 | 141 | ## Refactor `Dockerfile` 142 | 143 | **Objectives:** Apply best practices to Dockerfile. Find the difference between GPT gpt-3.5-turbo vs gpt-4 144 | 145 | Open `chat/sherlock/Dockerfile` file. 146 | 147 | ``` 148 | # Select FROM instruction `Ctrl + I` 149 | What is the latest Python image that I can use? 150 | 151 | # Ports 152 | Expose port 153 | Expose port but use variable syntax 154 | 155 | # Rootless 156 | Make Dockerfile rootless 157 | Secure Dockerfile with nobody and nogroup user 158 | Explain user and group ID ranges in Linux. Show results as a table. 159 | 160 | # Select RUN apk add curl 161 | Remove application cache and cache dir 162 | 163 | # HEALTHCHECK 164 | Implement application HEALTHCHECK with default intervals 165 | 166 | # Add comments 167 | ``` 168 | 169 | ## Links 170 | 171 | - [Time Complexity](https://www.desmos.com/calculator/xpfyjl1lbn) 172 | - [Intro Time Complexity](https://victoria.dev/blog/a-coffee-break-introduction-to-time-complexity-of-algorithms/) 173 | - [GitHub Copilot](https://docs.github.com/en/copilot/configuring-github-copilot/configuring-github-copilot-in-your-environment?tool=vscode) 174 | - [GitHub Copilot Chat](https://learn.microsoft.com/en-us/visualstudio/ide/visual-studio-github-copilot-chat?view=vs-2022) 175 | -------------------------------------------------------------------------------- /chat/sherlock/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.9.5-alpine 2 | 3 | ARG FLASK_DEBUG=False \ 4 | WORKDIR=/usr/src/app 5 | 6 | ENV FLASK_APP=$WORKDIR/run.py \ 7 | FLASK_DEBUG=$FLASK_DEBUG \ 8 | HOST=0.0.0.0 \ 9 | PORT=8080 \ 10 | PYTHONUNBUFFERED=True 11 | 12 | WORKDIR $WORKDIR 13 | COPY app/ $WORKDIR 14 | 15 | RUN apk add curl 16 | 17 | RUN python -m pip install --upgrade pip --requirement requirements.txt 18 | 19 | CMD flask run --host=$HOST --port=$PORT 20 | -------------------------------------------------------------------------------- /chat/sherlock/README.md: -------------------------------------------------------------------------------- 1 | # Sherlock 2 | 3 | A movie recommendation engine exposed via REST API written in Flask. 4 | 5 | ## Local Installation 6 | 7 | **TIP:** Remember to fix PYTHONPATH first. 8 | 9 | ```shell 10 | pip install -r app/requirements.txt 11 | export FLASK_APP=$PWD/app/run.py 12 | flask run --host 0.0.0.0 --port 8080 --reload 13 | ``` 14 | 15 | ## Docker Installation 16 | 17 | ```shell 18 | # Building and running docker container 19 | docker build --tag flask-sherlock --build-arg FLASK_DEBUG=True . 20 | docker run --detach --name sherlock --publish 8080:8080 --rm flask-sherlock 21 | docker ps 22 | ``` 23 | 24 | ## API 25 | 26 | ```shell 27 | curl "http://localhost/" 28 | curl "http://localhost/livez" 29 | curl "http://localhost/api/v1/movies/recommend" 30 | curl "http://localhost/api/v1/movies/recommend?title=Kingpin" 31 | curl "http://localhost/api/v1/movies/recommend?title=Lost%20in%20Translation" 32 | ``` 33 | 34 | ## Testing 35 | 36 | Unit test 37 | 38 | ```shell 39 | docker exec sherlock pytest 40 | docker exec sherlock coverage run -m pytest 41 | docker exec sherlock coverage report 42 | ``` 43 | 44 | Stop container 45 | 46 | ```shell 47 | docker stop sherlock 48 | ``` 49 | -------------------------------------------------------------------------------- /chat/sherlock/app/__init__.py: -------------------------------------------------------------------------------- 1 | # Add current directory to PYTHONPATH 2 | -------------------------------------------------------------------------------- /chat/sherlock/app/db.json: -------------------------------------------------------------------------------- 1 | [{ 2 | "title": "Groundhog Day", 3 | "genre": ["comedy", "fantasy", "romance"], 4 | "year": 1993, 5 | "rating": 8.0, 6 | "directors": ["Harold Ramis"], 7 | "stars": ["Bill Murray", "Andie MacDowell", "Chris Elliott", "Punxsutawney Phil"] 8 | }, { 9 | "title": "Kingpin", 10 | "genre": ["comedy", "sport"], 11 | "year": 1996, 12 | "rating": 6.9, 13 | "directors": ["Bobby Farrelly", "Peter Farrelly"], 14 | "stars": ["Woody Harrelson", "Randy Quaid", "Bill Murray"] 15 | }, { 16 | "title": "The Bridges of Madison County", 17 | "genre": ["drama", "romance"], 18 | "year": 1995, 19 | "rating": 7.6, 20 | "directors": ["Clint Eastwood"], 21 | "stars": ["Clint Eastwood", "Meryl Streep"] 22 | }, { 23 | "title": "Good Will Hunting", 24 | "genre": ["drama", "romance"], 25 | "year": 1997, 26 | "rating": 8.3, 27 | "directors": ["Gus Van Sant"], 28 | "stars": ["Robin Williams", "Matt Damon", "Ben Affleck"] 29 | }, { 30 | "title": "The Rainmaker", 31 | "genre": ["crime", "drama", "thriller"], 32 | "year": 1997, 33 | "rating": 7.2, 34 | "directors": ["Francis Ford Coppola"], 35 | "stars": ["Matt Damon", "Danny DeVito", "Claire Danes"] 36 | }, { 37 | "title": "Ghost in the Shell", 38 | "genre": ["animation", "action", "crime"], 39 | "year": 1995, 40 | "rating": 8.0, 41 | "directors": ["Mamoru Oshii"], 42 | "stars": ["Atsuko Tanaka", "Iemasa Kayumi", "Akio Ôtsuka"] 43 | }, { 44 | "title": "Aliens", 45 | "genre": ["action", "adventure", "sci-fi"], 46 | "year": 1986, 47 | "rating": 8.3, 48 | "directors": ["James Cameron"], 49 | "stars": ["Sigourney Weaver", "Michael Biehn", "Carrie Henn"] 50 | }, { 51 | "title": "Terminator 2", 52 | "genre": ["action", "sci-fi"], 53 | "year": 1986, 54 | "rating": 8.5, 55 | "directors": ["James Cameron"], 56 | "stars": ["Arnold Schwarzenegger", "Linda Hamilton", "Edward Furlong"] 57 | }, { 58 | "title": "Lethal Weapon 2", 59 | "genre": ["action", "crime", "thriller"], 60 | "year": 1989, 61 | "rating": 7.2, 62 | "directors": ["Richard Donner"], 63 | "stars": ["Mel Gibson", "Danny Glover", "Joe Pesci"] 64 | }, { 65 | "title": "Lost in Translation", 66 | "genre": ["comedy", "drama"], 67 | "year": 3003, 68 | "rating": 7.7, 69 | "directors": ["Sofia Coppola"], 70 | "stars": ["Bill Murray", "Scarlett Johansson", "Giovanni Ribisi"] 71 | }] -------------------------------------------------------------------------------- /chat/sherlock/app/rengine.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | 4 | class Sherlock(): 5 | def __init__(self, movies, features): 6 | self.movies = movies 7 | self.title = features.get("title") 8 | self.features = ["genre", "stars"] 9 | 10 | def recommend(self): 11 | ref_movie = self.__get_movie(self.title) 12 | if not ref_movie: 13 | return self.__lucky_recommendation(self.movies) 14 | ref_movie = ref_movie[0] 15 | 16 | movies = [] 17 | for movie in self.movies: 18 | if movie["title"] != self.title: 19 | for feature in self.features: 20 | feature_match = [fm in movie[feature] for fm in ref_movie[feature]] 21 | if any(feature_match): 22 | movies.append(movie) 23 | break 24 | 25 | return sorted(movies, key=lambda movie: movie["rating"], reverse=True) 26 | 27 | def __lucky_recommendation(self, movies): 28 | return [random.choice(movies)] 29 | 30 | def __get_movie(self, title): 31 | movie = [movie for movie in self.movies if movie["title"] == title] 32 | return movie if movie else [] 33 | -------------------------------------------------------------------------------- /chat/sherlock/app/requirements.txt: -------------------------------------------------------------------------------- 1 | coverage==7.3.2 2 | Flask==3.0.0 3 | pytest==7.4.2 -------------------------------------------------------------------------------- /chat/sherlock/app/run.py: -------------------------------------------------------------------------------- 1 | import os 2 | import json 3 | from json.decoder import JSONDecodeError 4 | 5 | from flask import Flask 6 | from flask import jsonify 7 | from flask import render_template 8 | from flask import request 9 | 10 | from rengine import Sherlock 11 | 12 | 13 | app = Flask(__name__) 14 | app.json.ensure_ascii = False 15 | APP_DIR = os.path.dirname(os.path.realpath(__file__)) 16 | 17 | def read_data(source): 18 | data = [] 19 | errors = [] 20 | try: 21 | with open(source) as db: 22 | content = db.read() 23 | data = json.loads(content) 24 | except FileNotFoundError as e: 25 | errors = [f"Reading {source}, {str(e)}"] 26 | except JSONDecodeError as e: 27 | errors = [f"Reading {source}, {str(e)}"] 28 | except Exception as e: 29 | errors = [f"Reading {source}, {str(e)}"] 30 | 31 | return data, errors 32 | 33 | 34 | @app.route("/", methods=["GET"]) 35 | def index(): 36 | return render_template("index.html") 37 | 38 | 39 | @app.route("/livez", methods=["GET"]) 40 | def live(): 41 | return jsonify({"ping": "ok"}) 42 | 43 | 44 | @app.route("/api/v1/recommend/movies", methods=["GET"]) 45 | def recommend(): 46 | MOVIES, errors = read_data(f"{APP_DIR}/db.json") 47 | if errors: 48 | return jsonify({"errors": errors, "status_code": 500}), 500 49 | 50 | sherlock = Sherlock(MOVIES, request.args) 51 | recommendation = sherlock.recommend() 52 | 53 | return jsonify(recommendation) 54 | -------------------------------------------------------------------------------- /chat/sherlock/app/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Sherlock API 7 | 8 | 9 |
10 |

Sherlock API

11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
MethodEndpointResponse Content Type
GET/text/html
GET/livezapplication/json
GET/api/v1/recommend/moviesapplication/json
33 |
34 | 35 | 36 | -------------------------------------------------------------------------------- /chat/solution-sherlock.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/chat/solution-sherlock.tar.xz -------------------------------------------------------------------------------- /cli/WORKSHOP.md: -------------------------------------------------------------------------------- 1 | # Copilot CLI 2 | 3 | Remember to **DISCONNECT VPN**. 4 | 5 | ## Setup 6 | 7 | ```shell 8 | unset GITHUB_TOKEN 9 | gh auth login 10 | 11 | bash .devcontainer/scripts/init.sh 12 | 13 | gh copilot --version 14 | gh copilot 15 | ``` 16 | 17 | ## Suggest comands 18 | 19 | ```shell 20 | gh copilot suggest "grep for # in md files" 21 | @terminal grep for # in md files 22 | 23 | gh copilot suggest "remove all files with pyc and pyo extension" 24 | @terminal remove all files with pyc and pyo extension 25 | 26 | gh copilot suggest "list free memory in GiB and list file system utilization" 27 | @terminal "list free memory in GiB and list file system utilization" 28 | 29 | gh copilot suggest "make POST request with JSON body" 30 | @terminal "make POST request with JSON body" 31 | 32 | gh copilot suggest "Rename all folders in the current directory to lower case" 33 | @terminal Rename all folders in the current directory to lowercase 34 | 35 | gh copilot suggest "Install rename package in ubuntu" 36 | @terminal Install rename package in ubuntu 37 | 38 | gh copilot suggest "GET weather in CPH now" 39 | @terminal GET weather in CPH now 40 | ``` 41 | 42 | ## Explain commands 43 | 44 | ``` shell 45 | gh copilot explain 'find . -name "__pycache__" -type d -exec rm -rf {} +' 46 | @terminal explain find . -name "__pycache__" -type d -exec rm -rf {} + 47 | @workspace /explain find . -name "__pycache__" -type d -exec rm -rf {} + 48 | 49 | gh copilot explain "docker run -d --name flask-app -p 80:8080 --rm flask-mini" 50 | @terminal explain docker run -d --name flask-app -p 80:8080 --rm flask-mini 51 | @workspace /explain docker run -d --name flask-app -p 80:8080 --rm flask-mini 52 | 53 | gh copilot explain "kubectl autoscale deployment api-backend --cpu-percent 80 --min 3 --max 6" 54 | @terminal explain kubectl autoscale deployment api-backend --cpu-percent 80 --min 3 --max 6 55 | @workspace /explain kubectl autoscale deployment api-backend --cpu-percent 80 --min 3 --max 6 56 | 57 | gh copilot explain "tmux new-session \; split-window -v -p 55 \; split-window -v -p 55 \; select-pane -U\; split-window -h \; select-pane -U \;" 58 | @terminal explain tmux new-session \; split-window -v -p 55 \; split-window -v -p 55 \; select-pane -U\; split-window -h \; select-pane -U \; 59 | @workspace /explain tmux new-session \; split-window -v -p 55 \; split-window -v -p 55 \; select-pane -U\; split-window -h \; select-pane -U \; 60 | ``` 61 | 62 | ## Questions 63 | 64 | ```shell 65 | @terminal How to grep markdown code block in terminal? 66 | @terminal How to grep markdown code block in terminal using pcregrep? 67 | ``` 68 | -------------------------------------------------------------------------------- /copilot/WORKSHOP.md: -------------------------------------------------------------------------------- 1 | # Copilot 2 | 3 | Remember to **DISCONNECT VPN**. 4 | 5 | Released in October 2021, GitHub Copilot is an autocompletion tool that helps to write code faster. It translates comments into code and helps with answering questions regarding the code. The tool is an extension in major IDEs, including Visual Studio Code. 6 | 7 | ## Examples 8 | 9 | ### Bitcoin 10 | 11 | **Objectives:** Get bitcoin price in USD and show engine under the hood. 12 | 13 | In Vs Code Open `OUTPUT` tab and select `GitHub Copilot` log. 14 | 15 | `python bitcoin.py` 16 | 17 | ```python 18 | # Get bitcoin price in USD. 19 | ``` 20 | 21 | ### Awesome JavaScript 22 | 23 | `node app.js` 24 | 25 | ```javascript 26 | // Inform the user every 1 second that he is awesome. Use ES5 syntax. Run the programme five times. 27 | ``` 28 | 29 | ### Regex 30 | 31 | `python regex.py` 32 | 33 | ```python 34 | # Create a regex that validates zipcode that follows dd-ddd format where d is a digit 35 | ``` 36 | 37 | Translate this to JavaScript! 38 | 39 | ### Fibonacci 40 | 41 | `python fibonacci-v1.py` 42 | 43 | ```python 44 | # Implement Fibonacci sequence. 45 | ``` 46 | 47 | `python fibonacci-v2-self.py` 48 | 49 | Implement [Fibonacci sequence for negative numbers](https://medium.com/@westgarth.w/the-negative-fibonacci-sequence-f7139f78c2a0) by yourself! **Show solution** (`fibonacci-v2-self.py`). 50 | 51 | `python fibonacci-v2-copilot.py` 52 | 53 | ```python 54 | # Implement Fibonacci sequence for negative numbers. 55 | ``` 56 | 57 | ## Questions 58 | 59 | `questions.py` 60 | 61 | ```python 62 | # q: What does KISS stand for? 63 | # q: What does the ACID acronym stand for in programming? 64 | # q: Explain Atomicity in ACID. 65 | ``` 66 | 67 | ```python 68 | # q: Will Donald Trump win the elections? 69 | # q: Will the former president of the USA win the elections in 2024? 70 | ```` 71 | 72 |
73 | The answare 74 | 75 |
76 | -------------------------------------------------------------------------------- /copilot/solution-copilot.tar.xz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/copilot/solution-copilot.tar.xz -------------------------------------------------------------------------------- /docs/assets/elections.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/docs/assets/elections.png -------------------------------------------------------------------------------- /docs/assets/gh-copilot-labs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/docs/assets/gh-copilot-labs.png -------------------------------------------------------------------------------- /docs/assets/github.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/docs/assets/github.jpg -------------------------------------------------------------------------------- /docs/assets/screens-lab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/docs/assets/screens-lab.png -------------------------------------------------------------------------------- /docs/assets/screens-presentation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/docs/assets/screens-presentation.png -------------------------------------------------------------------------------- /docs/links.md: -------------------------------------------------------------------------------- 1 | # Links 2 | 3 | - https://github.com/features/copilot 4 | - https://githubnext.com/ 5 | - https://github.blog/2023-03-22-github-copilot-x-the-ai-powered-developer-experience/ 6 | - https://github.blog/2023-10-10-research-quantifying-github-copilots-impact-on-code-quality/ 7 | - https://docs.github.com/en/copilot/github-copilot-chat/about-github-copilot-chat#limitations-of-github-copilot-chat 8 | - https://docs.github.com/en/enterprise-cloud@latest/copilot/github-copilot-enterprise/copilot-chat-in-github/using-github-copilot-chat-in-githubcom 9 | - https://github.blog/2023-10-10-research-quantifying-github-copilots-impact-on-code-quality/ 10 | - https://github.blog/2023-11-08-universe-2023-copilot-transforms-github-into-the-ai-powered-developer-platform/ 11 | - https://stackoverflow.blog/2023/07/03/do-large-language-models-know-what-they-are-talking-about/ 12 | - https://www.linkedin.com/posts/visualnavigation_ai-llm-activity-7113854986169503744-3pGY/?trk=public_profile_like_view 13 | - https://queue.acm.org/detail.cfm?id=3582083 14 | - https://resources.github.com/learn/pathways/copilot/essentials/essentials-of-github-copilot/ 15 | - https://resources.github.com/copilot-trust-center/?utm_source=learning-pathways&utm_medium=Resources&utm_campaign=copilot-banner 16 | - https://github.blog/2022-09-07-research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/ 17 | - https://dl.acm.org/doi/10.1145/3633453 18 | - https://dl.acm.org/doi/10.1145/3510454.3522684 19 | - https://dl.acm.org/doi/pdf/10.1145/3520312.3534864 20 | - https://arxiv.org/pdf/2302.06590.pdf 21 | - https://www.youtube.com/watch?v=HcU5vGnywZM 22 | - https://analyticsindiamag.com/github-copilot-is-all-gain-no-pain-for-microsoft/ 23 | - https://arxiv.org/pdf/2306.15033.pdf 24 | - https://arxiv.org/abs/2306.15033 25 | 26 | -------------------------------------------------------------------------------- /docs/notes.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/docs/notes.md -------------------------------------------------------------------------------- /docs/slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/docs/slides.pdf -------------------------------------------------------------------------------- /docs/slieds.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ldynia/workshop-github-copilot-chat/ebcd7d0b34f2d9b653017c780f9dba530e1e5b1d/docs/slieds.pdf -------------------------------------------------------------------------------- /docs/timing.md: -------------------------------------------------------------------------------- 1 | # Timing 2 | 3 | | min | lab | segment | 4 | |---|---| ---| 5 | | 30 | presentation | 1st hour | 6 | | 10 | Setup | 1st hour | 7 | | 20 | CLI | 1nd hour | 8 | | 15 | | break | 9 | | 30 | COPILOT | 2nd hour | 10 | | 25 | CHAT - flask-init | 2nd hour | 11 | | 10 | | break | 12 | | 40 | CHAT - sherlock | 3rd hour | 13 | | 10 | LABS | 3rd hour | 14 | --------------------------------------------------------------------------------