Skip to content

Instantly share code, notes, and snippets.

Testing Mermaid inline diagrams in Github markdown

just some text

Mermaid Graphs

  graph TD;
      A-->B;
      A-->C;
      B-->D;
      C-->D;
@JulianSprung
JulianSprung / delete-this-instance.py
Last active June 16, 2020 14:30
Basic example of how to snapshot and delete a Genesis Cloud instance from within the instance by matching the private IP address.
import requests
import json
import os
from datetime import date
import time
# Go to https://account.genesiscloud.com/dashboard/security
# and create and paste your secret API token here or export it as environment variable 'GC_API_TOKEN'
API_TOKEN = os.getenv('GC_API_TOKEN')
@JulianSprung
JulianSprung / Delete-this-instance.py
Created June 5, 2020 17:34
Basic example of how to delete a Genesis Cloud instance from within the instance by matching the private IP address.
import socket
import requests
import json
import os
# Go to https://account.genesiscloud.com/dashboard/security
# and create and paste your secret API token here or export it as environment variable 'GC_API_TOKEN'
API_TOKEN = os.getenv('GC_API_TOKEN')
#!/bin/bash
# installing miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh -b
eval "$(/home/ubuntu/miniconda3/bin/conda shell.bash hook)"
conda init
#TensorFlow 1.13.1
@JulianSprung
JulianSprung / gc-compute-api-python-example.py
Last active February 19, 2022 17:37
Genesis Cloud - Compute API Python Example. See https://developers.genesiscloud.com/
# This mini tutorial shows you how you can call the Genesis Cloud Compute API to create an instance with NVIDIA GPU driver, take a snapshot, and delete it.
# This allows you to write scripts that can programmtically create GPU instances and destroy them when you are done.
# In order to create an instance we first need to look up the IDs of the:
# - image we want to use
# - stored public SSH Key(s) we want to use
# - [OPTIONAL] security groups that we want to use
#
# If we don't specify any security groups the 'standard' security group will be applied which allows incoming Ping, SSH, HTTP, HTTPS.
# If you need an open port to expose a Jupyter notebook or Tensorboard to the internet. You need to create an apply a new security group to your instance,
#!/bin/bash
sudo apt update
sudo apt install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
#!/bin/sh
set -eux
__nvidia_full_version="430_430.50-0ubuntu2"
__nvidia_short_version="430"
is_installed=false
for i in $(seq 1 5)
do
echo "Connecting to http://archive.ubuntu.com site for $i time"
if curl -s --head --fail --request GET http://archive.ubuntu.com/ubuntu/pool/restricted/n/nvidia-graphics-drivers-${__nvidia_short_version} ;
then
#!/bin/sh
set -eux
export http_proxy=203.0.113.9:3128
export https_proxy=203.0.113.9:3128
echo "Acquire::http::Proxy \"http://203.0.113.9:3128\";" | sudo tee -a /etc/apt/apt.conf
echo "Acquire::https::Proxy \"http://203.0.113.9:3128\";" | sudo tee -a /etc/apt/apt.conf
echo http_proxy=http://203.0.113.9:3128 | sudo tee -a /etc/environment
echo https_proxy=http://203.0.113.9:3128 | sudo tee -a /etc/environment