Skip to content

Instantly share code, notes, and snippets.

@wongcyrus
wongcyrus / vertex-ai-langchain-with-agent.ipynb
Created June 29, 2023 06:24
Vertex AI Langchain with Agent.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wongcyrus
wongcyrus / github_classroom_assignment_collector.py
Last active November 8, 2022 09:05
Clone all GitHub Classroom Repo for an Assignment
#!/user/bin/env python
#
# This is a simple python script to clone all of the repositories for an
# assignment managed via GitHub Classroom. It has a dependency on the
# requests module, so to use it, you must:
#
# pip install requests
#
# You can run the script with the '-h' option to get info on its usage.
@wongcyrus
wongcyrus / cloud9upgradeawssamcli.sh
Last active October 31, 2022 18:39
Cloud9 upgrade to the latest AWS SAM CLI
sudo yum update -y
wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip
unzip aws-sam-cli-linux-x86_64.zip -d sam-installation
sudo ./sam-installation/install --update
sam --version
@wongcyrus
wongcyrus / cloud9openproject.sh
Created September 9, 2020 07:21
Run Open Project in AWS Cloud9
#!/bin/bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.27.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
wget https://gist.githubusercontent.com/wongcyrus/a4e726b961260395efa7811cab0b4516/raw/543fe335adaf7222f5f4fca475cf716d61b9a77b/resize.sh
chmod +x resize.sh
./resize.sh
@wongcyrus
wongcyrus / Batch imports student to Microsoft Team.ps1
Last active September 1, 2020 02:34
Batch imports student to Microsoft Team
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
set-executionpolicy remotesigned
Install-Module MicrosoftTeams
Import-Module MicrosoftTeams
Disconnect-MicrosoftTeams
$User = "t-cywong@stu.vtc.edu.hk"
$Password = ""
$ClassListFolder="C:\Users\developer\Documents\WindowsPowerShell\"
curl -s https://gist.githubusercontent.com/wongcyrus/a4e726b961260395efa7811cab0b4516/raw/6a045f51acb2338bb2149024a28621db2abfcaab/resize.sh | bash /dev/stdin 60
#Install
npm install --global prettier
npm i -g esformatter
# Open Preferences -> TypeScript Support -> Format Code on Save -> On
@wongcyrus
wongcyrus / install_sam_cli.sh
Last active November 21, 2023 18:29
Install AWS SAM CLI in Cloud9
# Change to default Python3
alias python='python3'
python --version
# Install Code Formatter for Python and you need to set AWS Cloud9「Preferences」->「Python Support」->「Custom Code Formatter」
# yapf -i "$file"
sudo pip install yapf
sudo yum -y update
sudo yum -y install aws-cli
sudo -H pip install awscli --upgrade
# Install brew and update SAM CLI to the latest version.
@wongcyrus
wongcyrus / aws_visualizer.sh
Created April 13, 2019 06:37
Setup aws-visualizer and cloudmapper in Cloud9
sudo yum install graphviz -y
sudo pip install aws-visualizer
profilename=worldskills
profileregion=us-east-1
rm -rf target/$profilename
mkdir -p target/$profilename/default
mkdir -p target/$profilename/securitygroups
mkdir -p target/$profilename/subnets
@wongcyrus
wongcyrus / cloud9-code-server
Last active September 11, 2021 12:25
Install and run Visual Studio Code (Code-Server) in AWS Cloud9
ip=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)
echo "Code Server"
echo "http://$ip:8443"
security_group=$(ec2-metadata -s | cut -d " " -f 2);
aws ec2 authorize-security-group-ingress --group-name $security_group --protocol tcp --port 8443 --cidr 0.0.0.0/0
version="1.32.0-310"
wget https://github.com/codercom/code-server/releases/download/$version/code-server-$version-linux-x64.tar.gz
tar -xvzf code-server-$version-linux-x64.tar.gz
cd code-server-$version-linux-x64
chmod +x code-server