Skip to content

Instantly share code, notes, and snippets.

import boto3
import os
import boto3
from botocore.exceptions import ClientError
from os import environ
rekognition=boto3.client('rekognition')
collectionId='IveFaceCollection'
image_bucket="wecarebillstatic"
prefix = "face/"
@wongcyrus
wongcyrus / setupekstoolsandcluster.sh
Created February 21, 2019 05:54
Basic Setup for eksworkshop.com
mkdir -p ~/.kube
sudo curl --silent --location -o /usr/local/bin/kubectl "https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/kubectl"
sudo chmod +x /usr/local/bin/kubectl
go get -u -v github.com/kubernetes-sigs/aws-iam-authenticator/cmd/aws-iam-authenticator
sudo mv ~/go/bin/aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
sudo yum -y install jq
cd ~/environment
git clone https://github.com/brentley/ecsdemo-frontend.git
git clone https://github.com/brentley/ecsdemo-nodejs.git
git clone https://github.com/brentley/ecsdemo-crystal.git
@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
@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 / 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.
#Install
npm install --global prettier
npm i -g esformatter
# Open Preferences -> TypeScript Support -> Format Code on Save -> On
curl -s https://gist.githubusercontent.com/wongcyrus/a4e726b961260395efa7811cab0b4516/raw/6a045f51acb2338bb2149024a28621db2abfcaab/resize.sh | bash /dev/stdin 60
@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\"
@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 / 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