Commit graph

1532 commits

Author SHA1 Message Date
William Carroll
7c2933f3c3 Support hgwhat alias
Support a Mercurial alias for listing the files that have changed on a
particular branch.

This commit is particularly noisy because I reformatted the above aliases to
align with the new width.
2020-02-05 14:41:20 +00:00
William Carroll
70034d4cb9 Begin supporting Monzo OAuth 2.0 login flow
What's done:
- Basic support of the client authorization grant stage of the OAuth login
  flow:
  - Open Google Chrome to point the user to Monzo's client authorization page.
  - Created a web server to retrieve the authorization code from Monzo.

What's left:
- Pulling the authorization grant (i.e. code) from Monzo's request and
  exchanging it for an access token and a refresh token, which can be used to
  make subsequent requests.

Unanswered question:
- Assuming this is a stateless app, where should I store the access token and
  refresh token to avoid the authorization flow. I'd like to avoid the client
  authorization flow because ideally I could run this app as a job that runs
  periodically throughout the day without requiring my interactions with it.

Some interesting notes:
- Notice how in the .envrc file, it's possible to make calls to `pass`. This
  allows me to check in the .envrc files without obscuring their content. It
  also allows me to consume these values in my app by using
  `os.Getenv("client_secret")`, which I find straightforward. Overall, I'm quite
  pleased to have stumbled upon this pattern - assuming that it's secure.
2020-02-04 23:00:57 +00:00
William Carroll
cce926d60f Remove KBDs supporting undesired Ergodox configuration
I mistakenly mapped one of my dual-function keys on my Ergodox to send Shift+CMD
instead of CMD. When some of my Emacs keybindings weren't firing, I noticed that
the key event they received was some like `C-S-s-<char>` instead of say
`C-s-<char>`. As a quick fix, I duplicated each of my keybindings that relied on
the CMD key to support Shift+CMD as well until I remapped the key on my
Ergodox. This morning, I remapped the Shift+CMD key to CMD, so I'm bidding adieu
to this code.
2020-02-03 10:54:15 +00:00
William Carroll
916e46d7ce Support script to download RFCs to my Kindle
Today I learned that you can email your Kindle files to read them using the
paperwhite display. I'm attempting to read RFCs, so after reading 1/4 of the way
through RFC6479 (on OAuth2.0), I realized that it might be easier to read on my
Kindle instead of on my computer screen. Out of this, rfcToKindle.go was born.

I'm not sure if I'd like to publish this or not.
2020-02-02 18:54:26 +00:00
William Carroll
4de3e5c392 Add KBDs to vterm
Support pasting and scrolling.
2020-02-02 18:31:39 +00:00
William Carroll
ffbe5c9757 Support emacs fn for rebuilding wpcarros-emacs
Call `M-x` `nix/rebuild-emacs` to build and link `wpcarros-emacs`.
2020-02-02 18:31:33 +00:00
William Carroll
2cfcb1c34d Support focusing EXWM X-application buffers
Press `<M-escape.` to display a list of buffers hosting X applications. Use
`completing-read` to select and focus one of these.

See the function docs and TODOs for more information.
2020-02-02 18:31:33 +00:00
William Carroll
2e76601f70 Blacklist additional non-source-code modes
I don't want vterm buffers or magit buffers showing up when I cycle throw
buffers.
2020-02-02 18:31:33 +00:00
William Carroll
5521db80b1 Attempt to debug xrandr behavior in display.el
Currently, after I connect my monitor to my laptop, I run `display/enable-4k`,
which will use `xrandr` to enable the display. The scaling of the enabled
display is not what I expect. So I've habituated re-running the same function,
`display/enable-4k`, which scales the display and meets my expectations.

What's strange is that if instead of running `display/enable-4k` the first time
from Emacs, I call `xrandr ...` from a terminal, this enables the display and
scales it properly on the first invocation.

I'm unsure how to explain this behavior. It's possible that a environment
variable is set properly in the terminal that isn't set in my Emacs, but this is
just a guess.

I'm going to using a different invocation in display.el that explicitly passes
the monitors dimensions. Let's see if that works.
2020-02-02 18:31:32 +00:00
William Carroll
2ec436b2b5 Support KBDs for term-switcher package
To facilitate transitioning from using `terminator` to using `vterm`, I'm
defining some KBDs that I hope will help me habituate my usage of `vterm`.
2020-02-02 18:31:32 +00:00
William Carroll
851aba8201 Support timestring.el
Quickly access strings that encode time is various formats. See the module docs
in timestring.el for more information.
2020-02-02 18:31:32 +00:00
William Carroll
6fd9947ec8 Re-write delete_dotfile_symlinks in golang
I'm currently quite unfamiliar with golang. As an exercise to help me onboard
onto golang, and as a proof-of-concept to see if golang is a viable substitute
for Python as a scripting language, I decided to port my delete_dotfile_symlinks
to golang.

In the process, renamed ./python -> ./scripts, which is a more accommodating
name for a directory.
2020-02-02 18:31:32 +00:00
William Carroll
e8b47d5030 Support golang
I decided to start writing go code for scripts instead of python. I think this
will be a learning opportunity for me and should increase the integrity of my
scripts by adding some static type checking.
2020-01-31 23:18:59 +00:00
William Carroll
184404d542 Add deploy.nix to blog
Adding a deploy.nix to output docker images based on the <briefcase>.blog
derivation. See the deploy/README.md docs for more information.
2020-01-31 16:30:56 +00:00
William Carroll
755554176d Consolidate injected dependencies
Move the three injected dependencies into one.
2020-01-31 16:30:25 +00:00
William Carroll
4e0b18506f Rename docker -> deploy
I think the name deploy is more representative of the purpose of this directory
since docker is just one of a few tools that I'm using to deploy software.
2020-01-31 16:29:22 +00:00
William Carroll
265d202908 Render pandoc output to index.html
Using index.html allows us to use the Google AdSense script and extend the
styling by adding a CSS stylesheet.
2020-01-31 16:13:22 +00:00
William Carroll
837cfe07c7 Rename dotfiles -> briefcase
Renaming my mono-repo briefcase.

I first introduced this commit in master, but it introduced a bug where one of
two things would happen:

1. Emacs wouldn't start and would crash X.
2. Emacs would start but my keyboard wouldn't work.

I learned some valuable debugging skills in the process. Here are some of them:

When my keyboard was broken, I wanted to control my computer using my
laptop. Thankfully this is possible by using `x2x`, which forward X events from
the SSH client to the SSH host.

```shell
> # I'm unsure if this is the *exact* command
> ssh -X desktop x2x -west :0.0
```

Git commit-local bisecting. I didn't need to do a `git bisect` because I knew
which commit introduced the bug; it was HEAD, master. But -- as you can see from
the size of this commit -- there are many changes involved. I wanted to binary
search through the changes, so I did the following workflow using `magit`:

- git reset --soft HEAD^
- git stash 1/2 of the files changed
- re-run `nix-env -f ~/briefcase/emacs -i`
- restart X session
- If the problem persists, the bug exists in the non-stashed files. Repeat the
  process until you find the bug.

In my case, the bug was pretty benign. Calling `(exwm/switch "Dotfiles")` at the
bottom of `window-manager.el` was failing because "Dotfiles" is the name of a
non-existent workspace; it should've been `(exwm/switch "Briefcase")`.

There may have been more problems. I changed a few other things along the way,
including exposing the env vars BRIEFCASE to `wpcarros-emacs` inside of
`emacs/default.nix`.

The important part is that this was a valuable learning opportunity, and I'm
glad that I'm walking away from the two days of "lost productivity" feeling
actually productive.
2020-01-31 15:27:48 +00:00
William Carroll
a65b895c8e Support script to audit, remove dotfile symlinks
Adding a simple script to help me manage the symlinks to the dotfiles
managed by my mono-repo.
2020-01-31 14:28:08 +00:00
William Carroll
edea127e07 Support building wpcarros-emacs
I'm using a Makefile until I can remember the command:

```shell
> nix-env -f . -i
```

This will install (i.e. `-i`) any derivations instantiated from the Nix
expression resolvable by `-f`. Ideally the incantation will look something like
this:

```shell
> nix-env -f '<universe>' -iA emacs
```

Informing `nix-env` to install all of the derivations created by the expression
at attribute `emacs` in my `<universe>` repository. For now two things are
preventing this:

1. `emacs` isn't an attribute in my top-level expression defined in the
   `default.nix`.
2. If I do add `emacs` as an attribute and call the above command, my usage of
   `readTree` results in `pkgs` missing `.lib` and a few other stdlib commands
   that are available in `(import <nixpkgs> {})`.

A fix for both of these should be forthcoming.
2020-01-31 13:20:18 +00:00
William Carroll
039b260cac Point <nixpkgs> to ~/nixpkgs
At the moment, all of the Nix repositories that I'm consuming exist in ~. To
keep things consistent, I ran:

```shell
> hub clone nixos/nixpkgs ~/nixpkgs
```
2020-01-31 12:44:38 +00:00
William Carroll
578ed1ba98 Move move .emacs.d out of configs/shared
Moving all of my Emacs-related files into their own directory at the root of
this repository.
2020-01-30 16:00:29 +00:00
William Carroll
3684adf23f Remove unused files
When I first moved to London, I created common.txt to store the address of my
office, my temporary housing, my new phone number, and other information. It
serverd its purpose, but I no longer need it anymore.

bookmarks.txt started out as a dmenu/rofi -> google-chrome integration. This
predates EXWM, which has replaced this with a google-chrome.el module (or
something similarly named).
2020-01-29 14:45:39 +00:00
William Carroll
5c9079a410 Splice ./universe directory into ./
Manually merging:
- README.md: I added the description from universe/README.md into the heading of
  dotfiles/README.md.
- .envrc: dotfiles/.envrc was a superset of universe/.envrc
- .gitignore: Adding some of the ignored patterns from universe/.gitignore to
  dotfiles/.gitignore

Everything else here should be a simple rename.
2020-01-29 14:43:20 +00:00
William Carroll
fb9380ba26 Add 'universe/' from commit '8ad51b24dd8719840aac47134835ea25cfe1b0b8'
git-subtree-dir: universe
git-subtree-mainline: 15110e6de9
git-subtree-split: 8ad51b24dd
2020-01-29 14:29:25 +00:00
William Carroll
15110e6de9 Drop support for ZSH
I've been using Fish consistently for about a month now, and I don't see myself
switching back to ZSH. Some of the code from this commit should be published. I
may get around to that one day. Before I did that, I would need to clean it up
and document it, which I won't be doing today.

Thank you, ZSH, for your service.
2020-01-29 14:21:01 +00:00
William Carroll
093b566e71 Support env vars for {DESK,LAP,CLOUD}TOP devices
I recently changed my hostname for my desktop and laptop from

wpcarro.lon.corp.google.com -> zeno.lon.corp.google.com
wpcarro2                    -> seneca

If you're curious, the names Zeno and Seneca come from famous Stoic
philosophers. As you can see from this commit, my configuration depends on the
values of these hostnames.

Immediately impacted:
- .profile
- device.el

Not immediately impacted:
- configs/install
- configs/uninstall
- .ssh/config
- .zshrc*

* As a side note, I should stop supporting ZSH.

Using an .envrc file helps me DRY up some of my configuration. Ideally I should
only need to make changes to the .envrc file and then expect everything to work
as expected. Let's see how that goes.
2020-01-29 14:21:01 +00:00
William Carroll
8ad51b24dd Document current deployment tactics
Adding a README including my current method for deploying. See the README for
more details. All of this is quite virgin and as such is subject to change.
2020-01-28 16:48:28 +00:00
William Carroll
ff06ffcf9c Package depot's gemma as a docker image for Cloud Run
Using <depot>'s gemma project with `dockerTools.buildLayeredImage` because I
need access to a nix-packaged server and gemma is the first thing that comes to
mind.
2020-01-28 16:47:35 +00:00
William Carroll
d28690d814 Remove PAGER prefix from hgst abbreviation
1. This isn't correct fish syntax.
2. I'm not sure that I need this.
2020-01-28 11:35:02 +00:00
William Carroll
bacaa0ca8a Add docker/cloud_run.nix
I'm attempting to setup my blog using the following:
- Google Cloud Run: I whitelist a docker image that packages my application and
then Google runs it "statelessly" (i.e. without persistence). The stateless part
should be fine for the time being.
- Nix: Using `<nixpkgs>.dockerTools.buildLayeredImage` to output docker images
from Nix expressions.
- Docker: Upload the output image from the Nix expressions and upload it to
Google Container Registry from which it can be run from Google Cloud Run.

Some helpful commands:

```shell
> sudo gcloud auth login
> nix-build ./docker/cloud_run.nix
> sudo docker image import ./result
> sudo docker tag <name> gcr.io/<google-cloud-project-id>/<name>:<tag>
> sudo docker push gcr.io/<google-cloud-project-id>/<name>:<tag>
```

I'm unsure if Google Cloud Run is my desired end goal, but it may help me
publish a blog faster than setting up a Kubernetes cluster, which is what I'd
ultimately like to do. Cloud Run should be cheaper financially and time-wise.
2020-01-28 00:00:05 +00:00
William Carroll
4ef1396a51 Add missing dependencies to constants.el
Perhaps commits like these will become less frequent when I adopt Nix and a
proper packaging strategy.
2020-01-27 23:58:56 +00:00
William Carroll
af26b6a181 Partially packages package that I partially want to use
A Poem:

I wanted to try out this package...
30 minutes later after a dozen failed attempts at packaging it...
I no longer want to try this package...
for now.
2020-01-27 16:52:16 +00:00
William Carroll
7e1391cc47 Rename mono -> universe
Update code that depends on my mono-repo being named "mono". I've renamed it to
"universe", which explains the changes in this commit.

TODO: Merge dotfiles into universe.
2020-01-27 16:21:30 +00:00
William Carroll
7d51b40e66 Rename mono -> universe
Prefer the name universe for my mono-repo. A bit grandiose, sure, but I prefer
the metaphor to no metaphor at all.
2020-01-27 16:04:20 +00:00
William Carroll
be0e05c669 Prefer home variable rather than hard coded path to readTree
TIL: Nix support the ~ as a home variable, which makes my code more portable
since it's shared between my work laptop and work desktop.
2020-01-27 14:57:47 +00:00
William Carroll
680d129cb3 Temporarily remove server-start from Emacs
I'm having trouble debugging why `pgrep emacs` returns two PIDs instead of just
one. Additionally when I call `emacsclient .` on the command line, I see a
message...
"Waiting for Emacs..."
...but when I cycle through all of my workspaces, I don't see any active
buffers. This commit is part of a larger debugging effort to get this working as
expected.
2020-01-27 14:56:14 +00:00
William Carroll
4952142916 Sketch ideas for YNAB integration
The end goal is to have some functions that help me manage my Monzo and YNAB
accounts. YNAB (i.e. youneedabudget.com) doesn't support Monzo
integrations. However, both services offer APIs. Here I'm sketching ideas for
what the API integrations might look like. Coming soon: monzo.el.
2020-01-27 14:56:10 +00:00
William Carroll
5399b4bd03 Add maybe.el dependency to fn in prelude.el
Not adding it as a top-level dependency since maybe.el depends on on
prelude.el. This shouldn't be a circular dependency when the requirement happens
in the function's scope though.
2020-01-27 14:52:04 +00:00
William Carroll
22968046b7 Rename alarm.el -> egg-timer.el
Add path to `egg-timer.el` module for now until it's published on MELPA.
2020-01-27 14:51:22 +00:00
William Carroll
b5c0d29601 Change Emacs startup
Remove `dbus-launch` and prefer simply `exec emacs`. Add `--no-site-file` and
`--no-site-lisp` flags.

Temporarily disable `google-stuff.el` because it's unavailable with the
`--no-site-lisp` flag.

This should all be fixed when I fully nixify my Emacs.
2020-01-27 14:50:09 +00:00
William Carroll
b6e9952889 Disable auto-fill-mode and company-mode in IRC buffers
Why?
- `company-mode` is too noisy in IRC buffers.
- `auto-fill-mode` inserts newline characters that end up each being their own
  message, which means that I make more noise than I should in IRC.
2020-01-27 11:40:05 +00:00
William Carroll
fb51c8b458 Support nix-eval fish function
Wrapping the `nix eval` incantation in a fish function for two reasons:
1. Document that this is how to evaluate Nix from a file.
2. Provide a more ergonomic way of evaluating Nix from a file.
2020-01-27 11:39:02 +00:00
William Carroll
d1fdc9fa63 Enable ivy-mode globally
This takes care of my outstanding TODO of understanding why something ivy was
being used and other times it wasn't. It turns out that there is a generic
`completing-read` function that many Emacs packages consume. `ivy-mode` ensures
that when that function is called it is used instead of the default Emacs
completing package.

I'm still unsure of the difference between ivy and counsel. My best guess
currently is that counsel is the narrowing framework and ivy is the integration
of the narrowing framework with `completing-read`. Swiper must be the
integration with incremental {forward,backward} search.
2020-01-27 11:26:10 +00:00
William Carroll
11d0a6c794 Add missing require for ivy-clipmenu
Adding the missing dependency requirement for keybindings.el
2020-01-27 11:25:32 +00:00
William Carroll
d8193c3a52 Delete alarm.el
Since I've exported alarm.el as egg-timer.el, prefer requiring the latter, which
is in a separate repository.
2020-01-27 11:24:40 +00:00
William Carroll
d67993266f Add index.html with AdSense script to blog
Adds some dummy markup, which includes my Google AdSense `<script>` tag. The
script won't work unless it is loaded from wpcarro.dev.
2020-01-26 00:29:34 +00:00
William Carroll
130155121a Sketch idea of a buildClojure nix function
The previous commit that adds Java code is part of a larger project intended to
use Nix to package Clojure. I'd like to build something similar to @tazjin's
buildLisp except for Clojure instead of for Common Lisp. Once building for both
ecosystems is similarly easy, it will be easier for me to compare the two
languages. Right now `buildLisp` is so good that it attracts me to Common Lisp
even when I don't know the language.
2020-01-25 19:41:19 +00:00
William Carroll
5a2a1694e3 Support java directory
Add an example of two java files, Main.java and Another.java, where Main.java
depends on Another.java. This is part of a larger example of attempting to use
Nix to package these.

Also ignoring the *.class files that `javac <filename>` outputs.
2020-01-25 19:39:49 +00:00
William Carroll
b6b8611f69 Prefer keynav daemonize
Instead of `keynav &`.
2020-01-25 18:36:24 +00:00