Skip to content

Instantly share code, notes, and snippets.

View PsycheShaman's full-sized avatar
:atom:
wizarding

Christiaan Gerhardus Viljoen PsycheShaman

:atom:
wizarding
View GitHub Profile

Keybase proof

I hereby claim:

  • I am psycheshaman on github.
  • I am psyche_shaman_ (https://keybase.io/psyche_shaman_) on keybase.
  • I have a public key ASDC7kgM6i9DsXPPyRjNEJN7Q6Jy-Gqf6xLgXkBBms6w1Qo

To claim this, I am signing this object:

#!/bin/sh
gcloud auth activate-service-account\
--key-file\
your-personal-keyfile.json # <-- Replace this with your personal GCP keyfile
#In the call below, replace [SERVICE_NAME] with the name of the App Engine service you wish to stop
gcloud -q app versions stop $(gcloud app versions list --filter="traffic_split=1.00" --service=[SERVICE_NAME] --format="table(version.id)" | tail -n 1) --service=[SERVICE_NAME]
import os
from flask import Flask
from subprocess import Popen, PIPE
app = Flask(__name__)
@app.route('/')
def serve():
# Replace the argument below with '/app/switchoff' in the switchoff directory!!!
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.8-slim
# Install Curl
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install -y curl
# Downloading gcloud package
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
gcloud builds submit --tag gcr.io/your-project-name/switchoff
#!/bin/sh
gcloud auth activate-service-account\
--key-file\
your-personal-keyfile.json # <-- Replace this with your personal GCP keyfile
#In the call below, replace [SERVICE_NAME] with the name of the App Engine service you wish to stop
gcloud -q app versions start $(gcloud app versions list --filter="traffic_split=1.00" --service=[SERVICE_NAME] --format="table(version.id)" | tail -n 1) --service=[SERVICE_NAME]
export REGION=us-central1
export ZONE=us-central1-a
gcloud config set compute/zone ${ZONE}
export PROJECT=$(gcloud info --format='value(config.project)')
export WORKERS=5
gcloud beta dataproc clusters create presto-cluster \
--project=${PROJECT} \
--region=${REGION} \
--num-workers=${WORKERS} \
#! /bin/bash
apt update
apt -y install apache2
cat <<EOF > /var/www/html/index.html
<html><body><h1>Hello World</h1>
<p>This page was created from a startup script.</p>
</body></html>
EOF
sudo apt-get install snapd
sudo snap install core
sudo snap refresh core
sudo apt-get remove certbot
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --apache
#follow the prompts, specifying the domain you purchased as the one to be verified
http-server.https.enabled=true
http-server.https.port=8443
http-server.https.keystore.path=/etc/presto/prestocert.pem