Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# EC2 P5.48xlarge Instance based on Amazon Linux 2 PyTorch DLAMI
# set -x
# Install the dependencie
# sudo yum install -y jq curl
# Variables
REGION="<REGION>"
#!/bin/bash
# /home/ec2-user/anaconda3/envs/JupyterSystemEnv/bin/pip install -U keytar jupyter-server-proxy
echo == INSTALLING CODE-SERVER ==
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version=4.12.0
#########################################
### INTEGRATE CODE-SERVER WITH JUPYTER
#########################################
echo == UPDATING THE JUPYTER SERVER CONFIG ==
import csv
from datetime import datetime
import boto3
import json
from pkg_resources import resource_filename
def get_ec2_spot_pricing(instance_type, region_code):
client = boto3.client('ec2', region_name=region_code)
today_date = datetime.utcnow()
apiVersion: v1
kind: ConfigMap
metadata:
name: fluent-bit-config
namespace: logging
labels:
k8s-app: fluent-bit
data:
# Configuration files: server, input, filters and output
# ======================================================
#!/bin/bash
nodes=$(kubectl get nodes --no-headers |awk '{print $1}')
for n in $nodes; do
pods=$(kubectl describe node $n | grep -A100 Namespace | grep -B100 'Allocated resources' | tail -n +3 | grep -v 'Allocated' | grep -v 'monitoring\|logging\|kube-' | wc -l)
if [[ $pods -lt 1 ]]; then
echo "Node $n has $pods running"
#else
# echo "Node $n has $pods running"
docker ps -aq | xargs docker rm -f
docker system prune --all --force

Keybase proof

I hereby claim:

  • I am omerh on github.
  • I am omerh (https://keybase.io/omerh) on keybase.
  • I have a public key ASB_nNoaEg0a1dVkvMb36nZ4wWXYgC_1Lfqp-YGew1ihJwo

To claim this, I am signing this object:

#!/bin/bash
aws_key=$(cat ~/.aws/credentials | grep -A 2 default | grep key_id | awk '{print $3}')
aws_secret=$(cat ~/.aws/credentials | grep -A 2 default | grep secret | awk '{print $3}')
kubectl create secret generic aws_credentials \
--from-literal key=$aws_key \
--from-literal secret=$aws_secret
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: smaple
labels:
app: smaple
spec:
replicas: 1
selector:
#!/bin/bash
ecr_login="$(aws ecr get-login --no-include-email --region eu-west-2)"
kubectl create secret docker-registry ecr \
--docker-username=`echo $ecr_login | awk '{print $4}'` \
--docker-password=`echo $ecr_login | awk '{print $6}'` \
--docker-server=`echo $ecr_login | awk '{print $7}'`