Skip to content

Commit e5352b2

Browse files
committed
change md refs
1 parent 619f90c commit e5352b2

File tree

5 files changed

+233
-1
lines changed

5 files changed

+233
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cells": [],
3+
"metadata": {},
4+
"nbformat": 4,
5+
"nbformat_minor": 5
6+
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# GitHub Copilot CLI Installation Script
5+
# Usage: curl -fsSL https://gh.io/copilot-install | bash
6+
# or: wget -qO- https://gh.io/copilot-install | bash
7+
# Use | sudo bash to run as root and install to /usr/local/bin
8+
# Export PREFIX to install to $PREFIX/bin/ directory (default: /usr/local for
9+
# root, $HOME/.local for non-root), e.g., export PREFIX=$HOME/custom to install
10+
# to $HOME/custom/bin
11+
12+
echo "Installing GitHub Copilot CLI..."
13+
14+
# Detect platform
15+
case "$(uname -s || echo "")" in
16+
Darwin*) PLATFORM="darwin" ;;
17+
Linux*) PLATFORM="linux" ;;
18+
*)
19+
if command -v winget >/dev/null 2>&1; then
20+
echo "Windows detected. Installing via winget..."
21+
winget install GitHub.Copilot
22+
exit $?
23+
else
24+
echo "Error: Windows detected but winget not found. Please see https://gh.io/install-copilot-readme" >&2
25+
exit 1
26+
fi
27+
;;
28+
esac
29+
30+
# Detect architecture
31+
case "$(uname -m)" in
32+
x86_64|amd64) ARCH="x64" ;;
33+
aarch64|arm64) ARCH="arm64" ;;
34+
*) echo "Error: Unsupported architecture $(uname -m)" >&2 ; exit 1 ;;
35+
esac
36+
37+
# Determine download URL based on VERSION
38+
if [ -n "$VERSION" ]; then
39+
# Prefix version with 'v' if not already present
40+
case "$VERSION" in
41+
v*) ;;
42+
*) VERSION="v$VERSION" ;;
43+
esac
44+
DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/download/${VERSION}/copilot-${PLATFORM}-${ARCH}.tar.gz"
45+
CHECKSUMS_URL="https://github.com/github/copilot-cli/releases/download/${VERSION}/SHA256SUMS.txt"
46+
else
47+
DOWNLOAD_URL="https://github.com/github/copilot-cli/releases/latest/download/copilot-${PLATFORM}-${ARCH}.tar.gz"
48+
CHECKSUMS_URL="https://github.com/github/copilot-cli/releases/latest/download/SHA256SUMS.txt"
49+
fi
50+
echo "Downloading from: $DOWNLOAD_URL"
51+
52+
# Download and extract with error handling
53+
TMP_DIR="$(mktemp -d)"
54+
TMP_TARBALL="$TMP_DIR/copilot-${PLATFORM}-${ARCH}.tar.gz"
55+
if command -v curl >/dev/null 2>&1; then
56+
curl -fsSL "$DOWNLOAD_URL" -o "$TMP_TARBALL"
57+
elif command -v wget >/dev/null 2>&1; then
58+
wget -qO "$TMP_TARBALL" "$DOWNLOAD_URL"
59+
else
60+
echo "Error: Neither curl nor wget found. Please install one of them."
61+
rm -rf "$TMP_DIR"
62+
exit 1
63+
fi
64+
65+
# Attempt to download checksums file and validate
66+
TMP_CHECKSUMS="$TMP_DIR/SHA256SUMS.txt"
67+
CHECKSUMS_AVAILABLE=false
68+
if command -v curl >/dev/null 2>&1; then
69+
curl -fsSL "$CHECKSUMS_URL" -o "$TMP_CHECKSUMS" 2>/dev/null && CHECKSUMS_AVAILABLE=true
70+
elif command -v wget >/dev/null 2>&1; then
71+
wget -qO "$TMP_CHECKSUMS" "$CHECKSUMS_URL" 2>/dev/null && CHECKSUMS_AVAILABLE=true
72+
fi
73+
74+
if [ "$CHECKSUMS_AVAILABLE" = true ]; then
75+
if command -v sha256sum >/dev/null 2>&1; then
76+
if (cd "$TMP_DIR" && sha256sum -c --ignore-missing SHA256SUMS.txt >/dev/null 2>&1); then
77+
echo "✓ Checksum validated"
78+
else
79+
echo "Error: Checksum validation failed." >&2
80+
rm -rf "$TMP_DIR"
81+
exit 1
82+
fi
83+
elif command -v shasum >/dev/null 2>&1; then
84+
if (cd "$TMP_DIR" && shasum -a 256 -c --ignore-missing SHA256SUMS.txt >/dev/null 2>&1); then
85+
echo "✓ Checksum validated"
86+
else
87+
echo "Error: Checksum validation failed." >&2
88+
rm -rf "$TMP_DIR"
89+
exit 1
90+
fi
91+
else
92+
echo "Warning: No sha256sum or shasum found, skipping checksum validation."
93+
fi
94+
fi
95+
96+
# Check that the file is a valid tarball
97+
if ! tar -tzf "$TMP_TARBALL" >/dev/null 2>&1; then
98+
echo "Error: Downloaded file is not a valid tarball or is corrupted." >&2
99+
rm -rf "$TMP_DIR"
100+
exit 1
101+
fi
102+
103+
# Check if running as root, fallback to non-root
104+
if [ "$(id -u 2>/dev/null || echo 1)" -eq 0 ]; then
105+
PREFIX="${PREFIX:-/usr/local}"
106+
else
107+
PREFIX="${PREFIX:-$HOME/.local}"
108+
fi
109+
INSTALL_DIR="$PREFIX/bin"
110+
if ! mkdir -p "$INSTALL_DIR"; then
111+
echo "Error: Could not create directory $INSTALL_DIR. You may not have write permissions." >&2
112+
echo "Try running this script with sudo or set PREFIX to a directory you own (e.g., export PREFIX=\$HOME/.local)." >&2
113+
exit 1
114+
fi
115+
116+
# Install binary
117+
if [ -f "$INSTALL_DIR/copilot" ]; then
118+
echo "Notice: Replacing copilot binary found at $INSTALL_DIR/copilot."
119+
fi
120+
tar -xz -C "$INSTALL_DIR" -f "$TMP_TARBALL"
121+
chmod +x "$INSTALL_DIR/copilot"
122+
echo "✓ GitHub Copilot CLI installed to $INSTALL_DIR/copilot"
123+
rm -rf "$TMP_DIR"
124+
125+
# Check if install directory is in PATH
126+
case ":$PATH:" in
127+
*":$INSTALL_DIR:"*) ;;
128+
*)
129+
echo ""
130+
echo "Warning: $INSTALL_DIR is not in your PATH"
131+
echo "Add it to your PATH by adding this line to your shell profile:"
132+
echo " export PATH=\"\$PATH:$INSTALL_DIR\""
133+
;;
134+
esac
135+
136+
echo ""
137+
echo "Installation complete! Run 'copilot help' to get started."

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ We're still early in our journey, but with your feedback, we're rapidly iteratin
3333
- **Node.js** v22 or higher
3434
- **npm** v10 or higher
3535
- (On Windows) **PowerShell** v6 or higher
36-
- An **active Copilot subscription**. See [Copilot plans](https://github.com/features/copilot/plans?ref_cta=Copilot+plans+signup&ref_loc=install-copilot-cli&ref_page=docs).
36+
- An **active Copilot subscription**. See [Copilot plans](https://github.com/features/copilot/plans?ref_cta=Copilot+plans+signu6p&ref_loc=install-copilot-cli&ref_page=docs).
3737

3838
If you have access to GitHub Copilot via your organization or enterprise, you cannot use GitHub Copilot CLI if your organization owner or enterprise administrator has disabled it in the organization or enterprise settings. See [Managing policies and features for GitHub Copilot in your organization](http://docs.github.com/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-github-copilot-features-in-your-organization/managing-policies-for-copilot-in-your-organization) for more information.
3939

Untitled.ipynb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "de9faa9c",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": []
10+
}
11+
],
12+
"metadata": {
13+
"kernelspec": {
14+
"display_name": "Python 3",
15+
"language": "python",
16+
"name": "python3"
17+
},
18+
"language_info": {
19+
"name": "python",
20+
"version": "3.12.1"
21+
}
22+
},
23+
"nbformat": 4,
24+
"nbformat_minor": 5
25+
}

effective guacamole.api.gh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# @title AI prompt cell
2+
3+
import ipywidgets as widgets
4+
from IPython.display import display, HTML, Markdown,clear_output
5+
from google.colab import ai
6+
7+
dropdown = widgets.Dropdown(
8+
options=[],
9+
layout={'width': 'auto'}
10+
)
11+
12+
def update_model_list(new_options):
13+
dropdown.options = new_options
14+
update_model_list(ai.list_models())
15+
16+
text_input = widgets.Textarea(
17+
placeholder='Ask me anything....',
18+
layout={'width': 'auto', 'height': '100px'},
19+
)
20+
21+
button = widgets.Button(
22+
description='Submit Text',
23+
disabled=False,
24+
tooltip='Click to submit the text',
25+
icon='check'
26+
)
27+
28+
output_area = widgets.Output(
29+
layout={'width': 'auto', 'max_height': '300px','overflow_y': 'scroll'}
30+
)
31+
32+
def on_button_clicked(b):
33+
with output_area:
34+
output_area.clear_output(wait=False)
35+
accumulated_content = ""
36+
for new_chunk in ai.generate_text(prompt=text_input.value, model_name=dropdown.value, stream=True):
37+
if new_chunk is None:
38+
continue
39+
accumulated_content += new_chunk
40+
clear_output(wait=True)
41+
display(Markdown(accumulated_content))
42+
43+
button.on_click(on_button_clicked)
44+
vbox = widgets.GridBox([dropdown, text_input, button, output_area])
45+
46+
display(HTML("""
47+
<style>
48+
.widget-dropdown select {
49+
font-size: 18px;
50+
font-family: "Arial", sans-serif;
51+
}
52+
.widget-textarea textarea {
53+
font-size: 18px;
54+
font-family: "Arial", sans-serif;
55+
}
56+
</style>
57+
"""))
58+
display(vbox)
59+
}
60+
}))
61+
)
62+
)
63+
)
64+
)

0 commit comments

Comments
 (0)