bomonike

More than automcomplete on steroids - AI tools that provide helps you write code and other tricks.

US (English)   Norsk (Norwegian)   Español (Spanish)   Français (French)   Deutsch (German)   Italiano   Português   Estonian   اَلْعَرَبِيَّةُ (Egypt Arabic)   Napali   中文 (简体) Chinese (Simplified)   日本語 Japanese   한국어 Korean

Overview

copilots.png This is a hands-on tutorial (with commentary) on how to use AI tools that helps you create programs (write code) and other tricks.

NOTE: Content here are my personal opinions, and not intended to represent any employer (past or present). “PROTIP:” here highlight information I haven’t seen elsewhere on the internet because it is hard-won, little-know but significant facts based on my personal research and experience.

What is a Copilot?

On an airplane, a “co-pilot” (aka first officer) takes over when the captain goes to the bathroom or becomes incapacitated.

But in the world of software development, a “co-pilot” is a collaborator who works like a pair programming session when two people are working on the same code at the same time.

Big tech companies have been working to create AI capabilities: Microsoft, Google, OpenAI, Anthropic, and others.

Keyboard Shortcuts

VIDEO:

CoPilots leverage the context of you’re typing to provide suggestions that help you write code faster.

Keys to Efficient Usage

Most AI tools only give suggestions when there is no meaningful text after the cursor on the current line (ignoring single closing braces or colons).

PROTIP: To avoid suggestions, type a period and cursor left to type in front of it.

That’s unless you’re using Codeium, which has a “FIM” (Fill In Middle) feature.

REMEMBER: With Copilot: Reject with the left-arrow key. Accept suggestions by pressing the Tab key.

More frequent use of the left-arrow and Esc keys made keyboard automation more worthwhile.

PROTIP: It’s difficult to reach the arrow key, so I remapped the Caps Lock key to it.

PROTIP: Even better, I mappped my 3-key foot pedal to left-arrow on the left and Tab on the right.

Feature Examples

A. Word Completion: As you type a word the AI recognizes, the AI suggests that word. Press Tab to accept the suggestion.

ai-word-completion.png

B. Code Completion: As you type code to call a known function name it recognizes, the AI generates code for that function.

This helps you avoid manually searching through public repositories for examples.

C. Generate Code: Under a function def, type a docstring in natural language (English) description of what that function does, and the AI generates the code described.

ai-gen-from-desc.png

D. Autofill Repetitive Code: Type a few examples of the pattern. The AI adds other items following the pattern seen.

Autofill Repetitive Code

E. Run Tests:

ai-run-tests.png

F. Create an Application. See the PowerToys project. LogRocket uses Node.js app using React.js to generate a simple quote-generating app.

F. Translation: Translate one language to others (Duolingo uses GPT-3 to correct grammar)

G. Boilerplate Code: Generate RegEx code when presented with data

H. Explain code: Highlight code and it responds with questions about it

I. Convert descriptions of colors into hex codes

J. Create Alt Text for image.

Cursor AI Code Editor

For $20/month, $40/mo for OpenAI zero-data retention https://www.cursor.com/pricing from https://deepgram.com/ai-apps/cursor Cursor is a AI-first code editor designed for pair-programming. It provides features like chat, code generation, editing assistance, and debugging support. With the ability to understand your codebase, Cursor offers real-time suggestions and can generate code snippets based on your instructions. It integrates with popular code editors and is compatible with vscode extensions.

Review

AWS CodeWhisperer

Amazon Q (for JetBrains, Visual Studio (VS) Code, Visual Studio, macOS Command Line) is a chatbot developed by Amazon for enterprise use. Based on both Amazon Titan and GPT generative artificial intelligence, it was announced on November 28, 2023. It is able to help troubleshoot issues in cloud apps or group chats, or summarize documents. As of November 2023, it costs $20 per month.

Microsoft/GitHub Copilot

github_copilot_badge.png GitHub Copilot uses “generative AI” into an editor extension that suggests code in real-time. See my explanation of Generative AI at https://wilsonmar.github.io/genai

Microsoft funded OpenAI to create GPT-3, a language model used to generate complex text from complex queries. OpenAI’s Codex translates natural language into programming code. GPT-3 (Generative Pre-trained Transformer 3&4) uses large models created using Deep Learning techniques to produce human-link text.

https://blogs.microsoft.com/blog/2023/03/16/introducing-microsoft-365-copilot-your-copilot-for-work/

GitHub Copilot uses the OpenAI (foundational) Codex to suggest code and entire functions in real-time.[1]

Microsoft co-opted the word “Copilot” as a brand name for AI tools that Microsoft has embedded in its line of products:

Microsoft’s AI is eerily smart becuase it knows your user metadata from all the above apps Microsoft has been saving in its Microsoft Graph database that combines email, calendar, contacts, and files into a single GraphQL database.

WARNING: For a long time, Microsoft, Google, Facebook, etc. are always listening. It’s always watching. It’s always learning. It’s always recording. It’s always saving. It’s always sharing. It’s always spying. It’s always tracking. It’s always analyzing. It’s always predicting. It’s always profiling. It’s always targeting.

CoPilots combines:

Copilot Certification

github_copilot_badge.png The GitHub Copilot certification exam assesses your proficiency in utilizing the AI-powered code completion tool across different programming languages, certifying your ability to streamline software development processes effectively. Microsoft no longer has a waitlist for GitHub Copilot exam registration. The Copilot certification exam is available October 2024.

Copilot Training

  1. The official (detailed) documentation is at https://docs.github.com/copilot

  2. https://docs.github.com/en/copilot/quickstart

  3. https://github.com/

  4. Sign in to earn Microsoft LEARN: XP points at https://learn.microsoft.com/en-us/training/paths/copilot - “GitHub Copilot Fundamentals - Understand the AI pair programmer” 12-module 5 hr 46 min Learning Path.
    • Responsible AI with GitHub Copilot
  5. Take the 7 hr 38 min 11 (text-based) modules of the LEARN: GitHub Universe Cloud Skills Challenge

    1. Introduction to Git - 31 min
    2. How to create and modify a Git project - 31 min
    3. Collaborate with Git - 44 min
    4. Edit code through branching and merging in Git - 55 min
    5. Introduction to GitHub - 1 hr 32 min
    6. Code with GitHub Codespaces - 27 min
    7. Introduction to GitHub Copilot - 19 min
    8. Using GitHub Copilot with JavaScript - 22 min
    9. Using GitHub Copilot with Python - 22 min
    10. Challenge project - Build a minigame with GitHub Copilot and Python - 35 min
    11. Challenge project - Add image analysis and generation capabilities to your application - 1 hr 20 min
  6. $119 3.5 hour Microsoft: AI-Powered Programming Video Course published by Pearson 11/14/2023.

  7. Among GitHub learning pathways are Essentials of GitHub Copilot by Ryan Salva. It consists of “guides”:

    1. What GitHub Copilot can do for your organization - Accelerate your digital transformation while improving your organization’s code quality. With GitHub Copilot, you can attract and retain developers, boost their speed and efficiency, and make their code better and more secure.
    2. Establishing trust in using GitHub Copilot - Get answers to the most commonly asked questions and considerations raised by organizations assessing GitHub Copilot. From technical safeguards to contractual protections, we outline the approach that GitHub takes to prevent infringement risk.
    3. Understanding the GitHub Copilot data pipeline - Follow data as it goes from developer to GitHub Copilot and back again, learning how GitHub Copilot securely handles data to gather context, build prompts, filter out an assortment of unwanted results, and return high-quality code suggestions and responses.
    4. Measuring the impact of GitHub Copilot - Assess GitHub Copilot’s benefits on your business by exploring adoption and usage metrics, surveying your developers, and uncovering downstream impact.
    5. Empower developers with AI Policy and Governance - Boost productivity and empower developers to innovate faster by developing internal policies that guide acceptable use of AI tooling.
    6. Tips for a successful rollout of GitHub Copilot - Realize GitHub Copilot’s benefits quicker with developer trainings, self-service licensing, reminders, and more.
    7. GitHub Copilot seat management and provisioning - Ensure that the right users have access to GitHub Copilot while allocating seats efficiently.
    8. Understanding billing for GitHub Copilot - Find answers to common questions about GitHub Copilot’s seat-based billing model, how seats are assigned, and how the billing cycle works.
  8. https://aka.ms/GitHubCopilotAI redirects to https://github.com/microsoft/Mastering-GitHub-Copilot-for-Paired-Programming - an 8 Lesson course teaching everything you need to know about harnessing GitHub Copilot and an AI Paired Programing resource.

  9. Prompts, tips, and use cases

  10. “The Ultimate Manual”

  11. Max Rohowsky (Max on Tech) on YouTube:

Licenses

Microsoft does not offer a free trial but (unlike Azure and others) not a limited license for GitHub Copilot. Microsoft offers 3 plans at monthlies of: $10 Individual, $19 Business, and $39 Enterprise.

Business and Enterprise licenses add:

Only the Enterprise license requires GitHub Enterprise Cloud and provides:

If you have a student or educator email address, get Enterprise free:

  1. Create a GitHub account using that email address.
  2. PROTIP: To avoid confusion and errors in your browser, create a different browserprofile to access the GitHub website and education email account.
  3. Ensure the location specified
  4. Set your browser to support location discovery by websites.
  5. Apply for a free Enterprise license for that account at https://education.github.com/discount_requests/application
  6. Provide the validation information requested. Students may need to hold up to the camera their student ID or letter from the school.

  7. See GitHub Copilot in VS Code

  8. Install VSCode.
  9. Install the Copilot extension for VS Code. REMEMBER: Copilot runs as an extension within VS Code.
    1. Click the wheel icon in the lower left corner of VS Code.
    2. Type “Extensions” in the search box at the upper-left top.
    3. Search for “GitHub Copilot”.
    4. Select the “GitHub Copilot” entry from “GitHub”.
    5. Click the blue “Install” button.
    6. Notice that “GitHub Copilot Chat” is also installed automatically.
    7. Exit VS Code and re-open it.
  10. Make the Status bar appear in menu: View > Appearance.

Open AI Chat

>>>>>
ShortcutDescription
⌘IStart Inline Chat to send a chat request to Copilot directly from the editor. Use natural language or use / commands to give instructions to Copilot.
⌃⌘IOpen the Chat view and start a chat conversation with Copilot by using natural language.
⇧⌘IOpen the Copilot Edits view and start a code editing session across multiple files.
⇧⌥⌘LOpen Quick Chat and ask a quick question to Copilot.

Type @ in chat or select to view the list of chat participants, which are domain experts that can help you in a specific area. Extensions can also contribute additional participants. Example: @workspace how is auth implemented?

Cheatsheet:GitHub Copilot in VS Code

GithubNext.com

GitHubNext.com

GitHub Copilot X is Microsoft’s vision for the future of AI-powered software development adopting OpenAI’s newest GPT-4 models.

  1. This assumes you have an email and GitHub account.

    GitHub Copilot is available through GitHub personal accounts with GitHub Copilot for Individuals or through organization or enterprise accounts with GitHub Copilot for Business.

  2. Sign up for for access to Copilot for Microsoft’s various tools: VS Code, Outlook, and OneNote.

    GithubNext.com

    Developed in collaboration with OpenAI, GitHub Copilot is powered by OpenAI Codex, an AI system created by OpenAI. OpenAI Codex has broad knowledge of how people use code and is more capable than GPT-3 in code generation, in part, because it was trained on a data set that includes a larger concentration of public source code.

  3. Consider cost vs. features:

    https://docs.github.com/en/copilot/overview-of-github-copilot/about-github-copilot About GitHub Copilot for Individuals says

    • $10 per month/$100 per year for Individuals (CAUTION: includes capture of code snippets and usage Telemetry for Microsoft to sell)
    • $19 per user per month for Business (no Telemetry but adds Organization-wide policy management and HTTP proxy support via custom certificates for those with a GitHub Enterprise Cloud administrator account)

    This says “GitHub Copilot for Business automatically blocks common insecure code suggestions by targeting issues such as hard coded credentials, SQL injections, and path injections.”

    https://github.com/settings/billing

    “You are eligible to use GitHub Copilot for free.”

    PROTIP: Start with GPT-3.5 to get started, then upgrade to GPT-4 when your users and use cases are better understood.

  4. Regions: At time of writing (Aug 8, 2023) GitHub Copilot is available only in Regions listed at:
    https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/

    US East, North Central US (GPT-4 only), South Central US,
    Switzerland North (GPT-4 only), France Central, West Europe,
    Japan East (GPT-4 only), Australia East (GPT-4 only).

  5. If “GitHub Copilot for Business” is used, the Administrator establishes a policy for its use of at the enterprise-level. DOC:

    1. In the enterprise sidebar, click Policies.
    2. Under Policies, click Copilot.
    3. Under “Manage organization access to GitHub Copilot,” configure the access for your GitHub Copilot subscription.

    Assign users:

    1. Click your profile photo. Click “Your organizations”.
    2. Next to the organization, click Settings.
    3. In the “Code planning and automation,” section of the sidebar, click Copilot, and then click Access.
    4. Under “User permissions,” to enable GitHub Copilot for all users in your organization, select Allow for all members.
      <ul>Alternately, select “Selected teams/users”.</ul>

    5. In the “Confirm seat assignment” dialog, confirm that you want to enable GitHub Copilot for all current and future users in your organization, click Confirm.
    6. Save.

    7. TODO: VPN Proxy support via self-signed certificates

    Each user: Enable GitHub Copilot as VS Code extension:

Install

Copilot is available as extensions on several IDEs:

  1. Install VSCode using my instructions at

    wilsonmar.github.io/text-editors/#VSCode

    Extensions are also available for Microsoft’s licensed Visual Studio, If you prefer vim’s keyboard (for less mouse), Neovim and the JetBrains suite of integrated development environments (IDEs).

  2. In VS Code, open the Extensions panel by clicking its logo.
  3. On top of “Search Extensions”, type “GitHub Copilot”.
  4. Click the “Your AI pair programmer” entry’s blue “Install” button.
  5. Notice the extension’s logo and click on a similar logo at the bottom.
  6. Click the blue “Sign in to GitHub”. Allow to Open Visual Studio Code.app
  7. In the VSCode File menu, press command+comma to open a Settings tab.
  8. Click “Extensions” in the menu, then scroll down to click “Copilot”.

    Copilot Voice is voice recognition software that allows you to speak code into your computer.

  9. On the right pane, “Inline Suggest: Enable” and “Show inline suggestions”.
  10. Alternately, in settings.json

        "editor.inlineSuggest.enabled": true,
    
  11. Open the VS Code Command Palette.

  12. Press Shift+Command+P (on Windows or Linux: Ctrl+Shift+P) for the Command Palette.
  13. Type “Diagnostics” to the right of the > prompt for the “Configuration” file.
  14. Scroll down:

    - Is `win-ca` installed?: false
           - Is `mac-ca` installed?: false
    
  15. ??? select GitHub Copilot: Collect Diagnostics from the list

  16. Troubleshooting guidance:

    https://docs.github.com/en/copilot/troubleshooting-github-copilot/viewing-logs-for-github-copilot-in-your-environment

Codespaces

https://github.com/skills/copilot-codespaces-vscode


Security Copilot

Microsoft Security Copilot at https://aka.ms/SecurityCopilot is an AI assistant for threat/vulnerability investigation and improving security posture.

VIDEOS: Overview, DEMO: It provides a prompt bar for English-language queries. Drop additional files to ask questions about them. Click the “Pin” icon to save a query for later. It dynamically updates. A “Prompt Book”. It can reverse-engineer a script and generates a flowchart to explain what it does. For example:
azure-sec-to-764x738.png

In a typical incident, this boost translates into gains in the quality of detection, speed of response and ability to strengthen security posture.

It makes use of a security-specific foundational LLM model trained by Microsoft, which added a learning system to create and tune new skills. It is a closed-loop learning system, which means it’s continually learning from users and giving them the opportunity to give explicit feedback with the feedback feature that is built directly into the tool. It continues to learn from interactions, adjusting its responses to create more coherent, relevant, and useful answers.

Security Copilot aims to catch what other approaches might miss. and augment an analyst’s work.

GitHub Advisory Database Security vulnerability database inclusive of CVEs and GitHub originated security advisories from the world of open source software.


Cautions

PROTIP: Write tests to ensure that you’re getting what you want.

Microsoft offers paid Business licenses which include a “Copilot” license, at $50 per user per year. Such a license enables suggestions based only on private information – to block use of public code.

https://learn.microsoft.com/en-us/training/modules/introduction-to-github-copilot/2-github-copilot-your-ai-pair-programmer

References

[1] https://learn.microsoft.com/en-us/training/modules/introduction-to-github-copilot/

https://github.com/features/copilot

https://docs.github.com/en/copilot/overview-of-github-copilot/about-github-copilot#using-github-copilot Using GitHub Copilot

Level Up with GitHub Copilot 2023-04-03 by Rizel Scarlett (@blackgirlbytes, https://github.com/galaxy-bytes).

https://www.youtube.com/watch?v=2nPoiUJpDaU GitHub Copilot in VSCode: Top 10 Features Explained by Max Rohowsky (Max on Tech)

https://www.youtube.com/watch?v=RDd71IUIgpg “CoPilot Review: My Thoughts After 6 Months” by ThePrimeagen

https://www.youtube.com/watch?v=Wap2tkgaT1Q “Why I’m no longer using Copilot” by Dreams of Code

https://www.youtube.com/watch?v=S_RorY_FRvo “GitHub Copilot just got promoted to Captain” by Fireship

Sample code:

https://github.com/alekspopovic/simple-react-timeline

https://github.com/timothywarner/copilot-ai