diff options
Diffstat (limited to 'users/wpcarro/playbooks')
-rw-r--r-- | users/wpcarro/playbooks/README.md | 3 | ||||
-rw-r--r-- | users/wpcarro/playbooks/first-of-the-month.org | 12 | ||||
-rw-r--r-- | users/wpcarro/playbooks/habits.org | 49 | ||||
-rw-r--r-- | users/wpcarro/playbooks/hip_opening_challenge/poses.pdf | bin | 0 -> 2853812 bytes | |||
-rw-r--r-- | users/wpcarro/playbooks/hip_opening_challenge/progress.org | 65 | ||||
-rw-r--r-- | users/wpcarro/playbooks/nix_gcr/README.md | 62 | ||||
-rw-r--r-- | users/wpcarro/playbooks/nix_gcr/cloud_run.nix | 14 | ||||
-rw-r--r-- | users/wpcarro/playbooks/nix_gcr/config.lisp | 21 | ||||
-rw-r--r-- | users/wpcarro/playbooks/shell.md | 12 | ||||
-rw-r--r-- | users/wpcarro/playbooks/sqlite3.md | 115 |
10 files changed, 353 insertions, 0 deletions
diff --git a/users/wpcarro/playbooks/README.md b/users/wpcarro/playbooks/README.md new file mode 100644 index 000000000000..70a26c8e8914 --- /dev/null +++ b/users/wpcarro/playbooks/README.md @@ -0,0 +1,3 @@ +# playbooks + +Here's the vision: playbooks for everything - not just software. diff --git a/users/wpcarro/playbooks/first-of-the-month.org b/users/wpcarro/playbooks/first-of-the-month.org new file mode 100644 index 000000000000..7bce39ca76bc --- /dev/null +++ b/users/wpcarro/playbooks/first-of-the-month.org @@ -0,0 +1,12 @@ +# 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 [10m] create habit template in journal +** TODO [30m] assess previous month's performance +** TODO [10m] book massage for the month +** TODO [10m] create go/hallpass entries (BJJ, VHP) +** TODO [10m] expense home internet +** TODO [10m] buy TSLA through tdameritrade.com diff --git a/users/wpcarro/playbooks/habits.org b/users/wpcarro/playbooks/habits.org new file mode 100644 index 000000000000..aac63735d9c4 --- /dev/null +++ b/users/wpcarro/playbooks/habits.org @@ -0,0 +1,49 @@ +* First of the year +** [1hr] Write a post mortem for the previous year +* First of the month +** see ./first-of-the-month.org +* 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/users/wpcarro/playbooks/hip_opening_challenge/poses.pdf b/users/wpcarro/playbooks/hip_opening_challenge/poses.pdf new file mode 100644 index 000000000000..d292ef832c23 --- /dev/null +++ b/users/wpcarro/playbooks/hip_opening_challenge/poses.pdf Binary files differdiff --git a/users/wpcarro/playbooks/hip_opening_challenge/progress.org b/users/wpcarro/playbooks/hip_opening_challenge/progress.org new file mode 100644 index 000000000000..80749a3c6b81 --- /dev/null +++ b/users/wpcarro/playbooks/hip_opening_challenge/progress.org @@ -0,0 +1,65 @@ +# From Lucas Rockwood's 21-day hip challenge from yogabody.com +* DONE day 1 +** pigeon +** butterfly +* DONE day 2 +** blaster +** squat +* DONE day 3 +** happy baby +** thread the needle (supine) +* DONE day 4 +** frog +** jackknife blaster +* DONE day 5 +** lightning bolt +** scissors +* DONE day 6 +** zorro +** supine butterfly (w/ strap) +* TODO day 7 +** thread the needle (wall) +** prone butterfly +* TODO day 8 +** ninja squat +** chair scissors +** lateral chain stretch +* TODO day 9 +** psoas blaster (chair) +** reclined scissors +* DONE day 10 +** twisted blaster +** twisted squat +* TODO day 11 +** double pigeon +** bound butterfly +* TODO day 12 +** eagle fold +** cross-thread +* DONE day 13 +** swiss army knife +** saddle +* TODO day 14 +** butterfly squat +** half lightning bolt +* DONE day 15 +** fallen blaster +** asymmetric baby +* DONE day 16 +** standing psoas +** standing pigeon +* TODO day 17 +** marichi B +** long butterfly +* TODO day 18 +** eagle legs +** chair squat +* DONE day 19 +** twisted pigeon +** bound baby +* DONE day 20 +** seated pigeon +** railroad squat +* DONE day 21 +** thunderbolt +** yogi squat diff --git a/users/wpcarro/playbooks/nix_gcr/README.md b/users/wpcarro/playbooks/nix_gcr/README.md new file mode 100644 index 000000000000..9d111cf6bba5 --- /dev/null +++ b/users/wpcarro/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/users/wpcarro/playbooks/nix_gcr/cloud_run.nix b/users/wpcarro/playbooks/nix_gcr/cloud_run.nix new file mode 100644 index 000000000000..1f473b5f59fa --- /dev/null +++ b/users/wpcarro/playbooks/nix_gcr/cloud_run.nix @@ -0,0 +1,14 @@ +{ pkgs, 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/users/wpcarro/playbooks/nix_gcr/config.lisp b/users/wpcarro/playbooks/nix_gcr/config.lisp new file mode 100644 index 000000000000..54f8e5f34462 --- /dev/null +++ b/users/wpcarro/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) diff --git a/users/wpcarro/playbooks/shell.md b/users/wpcarro/playbooks/shell.md new file mode 100644 index 000000000000..5eda417f489c --- /dev/null +++ b/users/wpcarro/playbooks/shell.md @@ -0,0 +1,12 @@ +# Shell + +I'm making this as an offline reference for some of the commands that I use +often enough to need to remember but not often enough to *actually* remember. + +## Reference + +- To kill a process by its port number: + +```shell +$ fuser 8080/tcp +``` diff --git a/users/wpcarro/playbooks/sqlite3.md b/users/wpcarro/playbooks/sqlite3.md new file mode 100644 index 000000000000..aec87f0b59ee --- /dev/null +++ b/users/wpcarro/playbooks/sqlite3.md @@ -0,0 +1,115 @@ +# SQLite3 + +Creating a reference for SQLite that I can access when I'm offline +(e.g. traveling in an airplane). + +## Benefits + +I enjoy using SQLite because it's lightweight and simple. Instead of networking +microservices, I can oftentimes just create a simple `db.sqlite3` file and get +significant mileage without much tooling overhead. + +## Limitations + +SQLite has some limitations; here are some of the limitations that I have encountered. + +- SQLite **disables** support for `FOREIGN KEY` by default. Enable it with: + +``` +sqlite> PRAGMA foreign_keys = ON; +``` + +- SQLite has no `BOOLEAN` type; it uses 0 and 1 instead. + +``` +sqlite> SELECT TRUE; +TRUE +---------- +1 +sqlite> SELECT FALSE; +FALSE +---------- +0 +``` + +- SQLite has no `DATETIME` type; it uses `TEXT` instead. + +``` +sqlite> SELECT datetime('now'); +datetime('now') +------------------- +2020-07-26 09:52:32 +``` + +## Reference + +The following should serve as a useful reference for working with SQLite. + +### Schema + +```sql +CREATE TABLE IF NOT EXISTS Movies ( + title TEXT NOT NULL, + year INTEGER, + PRIMARY KEY (title) +); + +ALTER TABLE Movies ADD COLUMN rating DEFAULT 0.0; + +DROP TABLE Movies; +``` + +### Queries + +The following queries should come in handy as a reference: + +``` +sqlite> -- I'm using an intentionally incorrect date here for the subsequent UPDATE. +sqlite> INSERT INTO Movies (title, year) VALUES ('Toy Story 3', 2100); +sqlite> SELECT * FROM Movies WHERE year IS NULL; +sqlite> UPDATE Movies SET year = 2010 WHERE title = 'Toy Story 3'; +sqlite> -- % is like .* in a regex +sqlite> DELETE FROM Movies WHERE title LIKE 'Toy Story%'; +``` + +## Command Line + +- Create a `~/.sqliterc` file with the following contents: + +``` +.mode column +.headers on +``` + +- To start an interactive session: + +```shell +$ sqlite3 db.sqlite3 +``` + +- To create a SQLite database from a `.sql` file: + +```shell +$ sqlite3 db.sqlite3 <db.sql +``` + +- To reload changes to a `.sql` file while in an interactive session: + +``` +sqlite> .read db.sql +``` + +## Miscellaneous + +- For a web-browser-based SQLite viewer, run the following: + +```shell +$ sqlite_web db.sqlite3 +``` + +- To import a CSV: + +``` +sqlite> .mode csv <table-name> +sqlite> .import path/to/file.csv <table-name> +``` |