Skip to content

Instantly share code, notes, and snippets.

View echang0929's full-sized avatar

Timothy Zhang echang0929

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
export AIRFLOW_PASSWORD=$(kubectl get secret $X-airflow -o jsonpath="{.data.airflow-password}" | base64 --decode)
export AIRFLOW_FERNETKEY=$(kubectl get secret $X-airflow -o jsonpath="{.data.airflow-fernetKey}" | base64 --decode)
export POSTGRESQL_PASSWORD=$(kubectl get secret $X-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode)
export REDIS_PASSWORD=$(kubectl get secret $X-redis -o jsonpath="{.data.redis-password}" | base64 --decode)
pip install cryptography
AFLOW_PASSWD="password"
AFLOW_FERNET=$(python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())")
PGRES_PASSWD="postgresql"
PGRES_PGPASS="postgresql"
REDIS_PASSWD="redis"
cat <<EOF | kubectl apply -f -
apiVersion: v1
GITHUB_USER="foo"
GITHUB_TOKN="1111111111222222222233333333334444444444"
GITHUB_REPO="https://xxx/foo/yyy.git"
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: github-secrets
type: Opaque
##############
### Prepare for env variables
export NS_NAME=spark-ext
export SA_NAME=spark
export CLN_NAME=spark-client
export POD_IMAG=gcr.io/spark-operator/spark-operator:v1beta2-1.2.3-3.1.1
export SVC_NAME=$CLN_NAME-headless
export SVC_PORT=19987
export CLS_ENDP="https://c2.us-south.containers.cloud.ibm.com:26165"
######################################
### Part I: Prepare for Network Environments and VM Instances
######################################
### 1.1 Setup AWS Network Environment
aws configure set default.region us-west-1
vid=$(aws ec2 create-vpc --cidr-block 192.168.0.0/16)
VPC_ID=$(echo $vid | jq -r '.Vpc.VpcId')
sbn=$(aws ec2 create-subnet --vpc-id $VPC_ID --cidr-block 192.168.1.0/24)
## https://leetcode.com/explore/learn/card/queue-stack/231/practical-application-queue/1374/
import queue
class Solution:
def numIslands(self, grid: list[list[str]]) -> int:
MOVEMENTS = [(-1, 0), (1, 0), (0, -1), (0, 1)]
row, col = len(grid), len(grid[0])
def avail(i: int, j: int) -> bool:
## https://leetcode.com/explore/learn/card/queue-stack/232/practical-application-stack/1380/
import queue
class Solution:
def numIslands(self, grid: list[list[str]]) -> int:
MOVEMENTS = [(-1, 0), (1, 0), (0, -1), (0, 1)]
row, col = len(grid), len(grid[0])
def avail(i: int, j: int) -> bool: