Wilson Mar bio photo

Wilson Mar

Hello!

Calendar YouTube Github

LinkedIn

Damn 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

This is a hands-on tutorial (with commentary) on how to use Microsoft’s AI tools that provides helps you 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 it?

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

But in the world of software development, a “co-pilot” is a collaborator tool that extends and automates pair programming.

  • As you type, it provides suggestions for what you might want to do next, such as providing repetitive “boilerplate” code.
  • When you type a function, it separates the different words of a concatenated function name.

Big tech companies have been working to create AI capabilities.

GitHub Copilot for Business builds the power of 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. Uses for GPT-3:

  • Duolingo uses GPT-3 to correct grammar.
  • Convert descriptions of colors into hex codes
  • Turn comments (natural language) into runnable code
  • Translate one language to others
  • Autofill repetitive code
  • Show alternatives ways to code
  • Explain code (in English)
  • Generate RegEx code when presented with data

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

Microsoft/GitHub Copilot

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:

  • Visual Studio Code (VS Code) text editor provides prompts, as “AI pair programming”
  • Outlook emails
  • Calendar entries
  • OneNote notes
  • OneDrive files
  • Powerpoint presentations
  • LinkedIn profiles, messages, recommedation, etc.
  • LinkedIn Learning course content
  • GitHub code repositories

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:

  • what it “knows” about you with
  • what it knows about programming mechanics with
  • what it knows about the “domains” manipulatable using code.

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

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

  6. 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).

  7. In VS Code, open the Extensions panel by clicking its logo.
  8. On top of “Search Extensions”, type “GitHub Copilot”.
  9. Click the “Your AI pair programmer” entry’s blue “Install” button.
  10. Notice the extension’s logo and click on a similar logo at the bottom.
  11. Click the blue “Sign in to GitHub”. Allow to Open Visual Studio Code.app
  12. In the VSCode File menu, press command+comma to open a Settings tab.
  13. 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.

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

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

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

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

  21. Troubleshooting guidance:

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

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

  • Install GitHub Copilot using GitHub Codespaces
  • Prompt GitHub Copilot for code suggestions
  • Accept code suggestions from GitHub Copilot

Security Copilot

Microsoft Security Copilot 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.

Keys to Efficient Usage

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

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.

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).