Skip to content

Instantly share code, notes, and snippets.

@npadmana
npadmana / idle-shutdown.sh
Last active August 27, 2022 18:26 — forked from JustinShenk/idle-shutdown.sh
Google Cloud Platform (GCP) instance idle shutdown
#!/bin/bash
# Add to instance metadata with `gcloud compute instances add-metadata \
# instance-name --metadata-from-file startup-script=idle-shutdown.sh` and reboot
# NOTE: requires `bc`, eg, sudo apt-get install bc
# Modified from https://stackoverflow.com/questions/30556920/how-can-i-automatically-kill-idle-gce-instances-based-on-cpu-usage
threshold_lo=0.1
threshold_hi=0.5
count=0
# I recommend excluding the linux data partition from Windows Defender
sudo apt-get -y update
# Basic
sudo apt-get install -y build-essential
sudo apt-get install -y cmake curl cpio git sudo wget unzip
sudo apt-get install -y tmux vim python python-setuptools
sudo apt-get install -y emacs24-lucid ispell
record A {
var D : domain(2);
var hist, cnt : [D] real;
proc init(n : int) {
D = {1..n, 1..n};
}
proc init(n1 : int, n2 : int) {
D = {1..n1, 1..n2};