about summary refs log tree commit diff
path: root/playbooks
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-07-20T09·26+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-07-20T13·38+0100
commitc6106f7884fab3048ccce14dd56a193e706fbaac (patch)
tree473254a350490ce6956a656370fe695bf7cb0bdf /playbooks
parent5add8ddc13be3a7a5fbb6deb3f70cb18594f8750 (diff)
Create //playbooks
I'm particularly excited about this idea. As I was reading Graham's "Erase your
darlings" blog post, I had an idea: I should have playbooks at the root of my
monorepo.

I can have playbooks for the following:
- How to install NixOS
- How to build GCR images from Nix expressions
- A collection of miscellaneous shell commands (e.g. "how to kill a process by name")
- What series of steps should I follow when I receive a paycheck

I already keep README's at the root of each package, which I think is where many
of these instructions belong. Other tutorials that I write for myself that do
not belong to any package can go in //playbooks. I also will host my personal
habits in //playbooks since habits are a bit like playbooks for life. Let's see
how this idea ages as the caffeine wears off...
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/README.md3
-rw-r--r--playbooks/finances.org9
-rw-r--r--playbooks/first-of-the-month.org13
-rw-r--r--playbooks/habits.org54
-rw-r--r--playbooks/nix_gcr/README.md62
-rw-r--r--playbooks/nix_gcr/cloud_run.nix18
-rw-r--r--playbooks/nix_gcr/config.lisp21
7 files changed, 180 insertions, 0 deletions
diff --git a/playbooks/README.md b/playbooks/README.md
new file mode 100644
index 000000000000..70a26c8e8914
--- /dev/null
+++ b/playbooks/README.md
@@ -0,0 +1,3 @@
+# playbooks
+
+Here's the vision: playbooks for everything - not just software.
diff --git a/playbooks/finances.org b/playbooks/finances.org
new file mode 100644
index 000000000000..4622ce06d87f
--- /dev/null
+++ b/playbooks/finances.org
@@ -0,0 +1,9 @@
+# Let's pretend it's April 1st; all amount go in the March (not April) column.
+* Finance Chain (25th of each month)
+** Open "finances_2020" Google Sheet
+** Settle up with Mimi on TransferWise
+** Adjust "Stocks (after tax)" to reflect amount Google sent
+** Add remaining cash to "Carryover (cash)"
+** Adjust "Paycheck" to reflect amount Google sent
+** In the "International Xfer" table, send "Xfer amount" from Monzo to USAA
+** Go to an ATM and extract the amount in "ATM withdrawal"
diff --git a/playbooks/first-of-the-month.org b/playbooks/first-of-the-month.org
new file mode 100644
index 000000000000..98d6d591f244
--- /dev/null
+++ b/playbooks/first-of-the-month.org
@@ -0,0 +1,13 @@
+# In total this should take one hour to complete. This is a substantial amount
+# of time, which may disincentivize me from completing it. This time is
+# amortized over the length of its usefulness (i.e. an entire month), so it
+# should be thought of instead as two-minutes worth of work per day that is all
+# being completed upfront.
+* Tasks
+** TODO [20m] Create habit template in journal.
+*** Spend time choosing a habit that you can accomplish giving known traveling constraints.
+** TODO [45m] Assess previous month's performance.
+** TODO [10m] Book massage for the month.
+** TODO [05m] Register for HotPodYoga classes.
+** TODO [10m] Plan one museum date in London.
+** TODO [20m] Plan each weekend for month.
diff --git a/playbooks/habits.org b/playbooks/habits.org
new file mode 100644
index 000000000000..3b6f6f680e4d
--- /dev/null
+++ b/playbooks/habits.org
@@ -0,0 +1,54 @@
+* First of the year
+** [1hr] Write a post mortem for the previous year
+* First of the month
+** [20m] Create habit template in journal.
+** [45m] Assess previous month's performance.
+** [10m] Book massage for the month.
+** [05m] Register for HotPodYoga classes.
+** [10m] Plan one museum date in London.
+** [20m] Plan each weekend for month.
+* Payday
+** [10m] Audit Monzo expenses
+** [05m] Review "finances_2020" spreadsheet
+** [05m] Transfer GBP to USD account
+** [10m] Withdraw cash from ATM
+* Morning
+** [00m] Wake up at 7:00
+** [15m] Read
+** [02m] Brush teeth
+** [01m] Make bed
+** [01m] Water plants
+** [10m] 12 rounds of forward folds
+** [05m] 12 rounds Pranayama
+** [30m] Transcendental meditation
+** [10m] Shower
+** [05m] Put on clothes
+* Evening
+** [01m] Layout tomorrow's outfit
+** [01m] Floss
+** [02m] Brush teeth
+** [01m] Mouth wash
+** [30m] Read
+** [01m] Journal daily progress
+* Monday
+** [1hr] Jiu Jitsu
+* Tuesday
+** Work from 6PS
+** [1hr] Jiu Jitsu
+* Wednesday
+** [1hr] Hot Yoga
+** [10m] Shave
+** [15m] Clean apartment sinks
+* Thursday
+* Friday
+** [1hr] Hot Yoga
+* Saturday
+** [10m] Vacuum
+** [30m] Nap
+* Sunday
+** [1hr] Jiu Jitsu
+** [30m] Nap
+** [10m] Shave
+** [05m] Trim nails
+** [05m] Take out trash
+** [05m] Laundry
diff --git a/playbooks/nix_gcr/README.md b/playbooks/nix_gcr/README.md
new file mode 100644
index 000000000000..9d111cf6bba5
--- /dev/null
+++ b/playbooks/nix_gcr/README.md
@@ -0,0 +1,62 @@
+# Nix + Google Cloud Run (i.e. GCR)
+
+I'm documenting how I currently deploy projects that I package with Nix on
+Google Cloud Run.
+
+I'd like to automate this workflow as much as possible, and I intend to do just
+that. For now, I'm running things manually until I can design an generalization
+that appeals to me.
+
+## Dependencies
+- `nix-build`
+- `docker`
+- `gcloud`
+
+## Step-by-step
+
+1. Use `nix-build` to create our Docker image for Cloud Run.
+
+```shell
+> nix-build ./cloud_run.nix
+```
+
+This outputs a Docker image at `./result`.
+
+1. Load the built image (i.e. `./result`) into `docker` so that we can tag it
+   and push it to the Google Container Registry (i.e. GCR).
+
+```shell
+> sudo docker load <./result
+```
+
+1. (Optionally) Run the image locally to verify its integrity.
+
+```shell
+> sudo docker run -d -p 8080:4242 <name>:<tag>
+```
+
+1. Tag and push the image to GCR.
+
+```shell
+> sudo docker tag <name>:<label> gcr.io/<google-cloud-project-id>/<name>:<latest>
+```
+
+1. Visit Google Cloud Run; create a new service with "Create Service"; select
+   the uploaded Docker image from the "Container Image URL" field; click
+   "Create" to deploy.
+
+## Notes
+
+You may need to authorize `gcloud` by running the following:
+
+```shell
+> sudo gcloud auth login --no-launch-browser
+```
+
+You must use `sudo` here since the `docker` invocations are prefixed with `sudo`
+as well.
+
+## Todos
+
+- If possible, prefer using a command line tool like `gcloud` to create the
+  Cloud Run service.
diff --git a/playbooks/nix_gcr/cloud_run.nix b/playbooks/nix_gcr/cloud_run.nix
new file mode 100644
index 000000000000..70be4040c36b
--- /dev/null
+++ b/playbooks/nix_gcr/cloud_run.nix
@@ -0,0 +1,18 @@
+{
+  pkgs ? import <nixpkgs> {},
+  depot ? import <depot> {},
+  ...
+}:
+
+pkgs.dockerTools.buildLayeredImage {
+  name = "gemma";
+  tag = "latest";
+  config.ExposedPorts = {
+    "4242" = {};
+  };
+  config.Env = [
+    "GEMMA_CONFIG=${./config.lisp}"
+  ];
+  config.Cmd = [ "${depot.fun.gemma}/bin/gemma" ];
+  maxLayers = 120;
+}
diff --git a/playbooks/nix_gcr/config.lisp b/playbooks/nix_gcr/config.lisp
new file mode 100644
index 000000000000..54f8e5f34462
--- /dev/null
+++ b/playbooks/nix_gcr/config.lisp
@@ -0,0 +1,21 @@
+;; Example configuration file for Gemma
+
+(config :port 4242
+        :data-dir "/tmp/gemma/")
+
+(deftask bathroom/wipe-mirror 7)
+(deftask bathroom/wipe-counter 7)
+
+;; Bedroom tasks
+(deftask bedroom/change-sheets 7)
+(deftask bedroom/vacuum 10)
+
+;; Kitchen tasks
+(deftask kitchen/normal-trash 3)
+(deftask kitchen/green-trash 5)
+(deftask kitchen/blue-trash 5)
+(deftask kitchen/wipe-counters 3)
+(deftask kitchen/vacuum 5 "Kitchen has more crumbs and such!")
+
+;; Entire place
+(deftask clean-windows 60)