Commit graph

1520 commits

Author SHA1 Message Date
William Carroll
e14fff7d4b Support Transforms.optimize
Partially optimize inputs and document rules for further optimizations we can
make.
2020-08-06 00:15:31 +01:00
William Carroll
d45685e245 Apply a series of transformation to a QWERTY keyboard
TL;DR:
- Accept input from the CLI
- Add a project README.md
2020-08-05 23:36:04 +01:00
William Carroll
244503bba9 Support App.transform
Apply the transform to a Keyboard. Onwards to the final demonstration!
2020-08-05 23:21:08 +01:00
William Carroll
61a2fb108d Support parsing the list of transforms
Using Haskell's Text.ParserCombinators.ReadP library for the first time, and I
enjoyed it thoroughly! It's nice avoiding a third-party library like MegaParsec.
2020-08-05 22:54:50 +01:00
William Carroll
d948ed9ebf Define an instance for Show for a Keyboard
This will help me debug.
2020-08-05 21:52:10 +01:00
William Carroll
1af0007a7d Create a Utils module
To stylize things...
2020-08-05 21:51:55 +01:00
William Carroll
40753e9f3b Add some the scaffolding for testing
As I attempt to habituate TDD, I should have some examples of tests to minimize
all friction preventing me from testing.
2020-08-05 21:37:08 +01:00
William Carroll
c4299558a7 Include instructions for building Tailwind CSS in README.md
After consuming my Elm boilerplate, I realized that I was missing this.
2020-08-04 16:37:45 +01:00
William Carroll
b1c403f6b9 Create small command line program that parses arguments
Before starting my take-home assignment, the instructions advised me to create a
"Hello, world" program in the language of my choice. Since I'm choosing Haskell,
I created this example as my starter boilerplate.
2020-08-04 16:36:31 +01:00
William Carroll
ef40622a87 Mark Dangal as watched
Many Bollywood movies have excellent acting, excellent directing, excellent
storytelling, but in my opinion, they spoil this with unnecessary musicals
interspersed throughout the films.

Dangal is a notable exception here. Overall, I'd say that this movie is
appropriately rated!
2020-07-30 09:35:01 +01:00
William Carroll
1e82ea4b26 Mark Hitchcock's Vertigo as watched
Watched the famous "Vertigo" with the timeless Jimmy Stewart. Overall I'd say
that the film is overhyped, but worth watching nevertheless.
2020-07-30 09:33:52 +01:00
William Carroll
8042c1e216 Watch "Hacksaw Ridge"
I don't plan on writing movie reviews in my Git commit message.
2020-07-26 23:00:33 +01:00
William Carroll
32e9f7f56d Add query for the productive directors
Show the movies from directors that appear more than once in the list.
2020-07-26 15:53:07 +01:00
William Carroll
6ca531116f Create a scratch buffer for common queries
Defining some commonly used criteria for selecting movies as SQL queries.
2020-07-26 15:52:59 +01:00
William Carroll
c36ae072d2 Mark Andhadhun as watched
What a confusing movie this was... I may need to watch it a second time to
better understand what happened, but I found watching it once already so
exhausting that I'm not sure I'll ever watch it again.
2020-07-26 12:23:36 +01:00
William Carroll
445763b5d9 Update schema for Movies table
Added the following fields (would be cool if `git` could show this):
- rating
- haveWatched
- director
- isCartoon
- requiresSubtitles
2020-07-26 12:22:17 +01:00
William Carroll
6981db2439 Create //playbooks/sqlite3.md
Write a playbook for using SQLite to capture some trivia that I often forget in
between my ~infrequent uses of SQLite.
2020-07-26 12:21:12 +01:00
William Carroll
a29ed22a83 Create //playbooks/shell.md
Taken from the overview:
> 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.
2020-07-26 11:26:05 +01:00
William Carroll
cf6d181f7c Add .sqliterc to //configs
Prefer these more human-readable defaults to SQLite.
2020-07-26 10:32:16 +01:00
William Carroll
d3a337199a Create SQLite database from unwatched movies in imdb-top-250.org
The astute observer may notice that the number of entries in db.sqlite3 is fewer
than the number of unwatched movies in imdb-top-250.org. I'm at a lake in
Germany with Mimi and Cullen, so we took the intersection of my unwatched
movies, Mimi's unwatched movies, and Cullen's unwatched movies.
2020-07-26 10:23:36 +01:00
William Carroll
d0c1645c16 Add two steps to finances playbook
I needed to add the first step since I dipped into my Emergency fund last month
to pay for someone to prepare my US tax return. I added the other step as a
reminder.
2020-07-24 10:07:30 +01:00
William Carroll
7f7ca4d6f5 Fix typo in finances playbook
amount -> amounts
2020-07-24 10:07:06 +01:00
William Carroll
90d22f643f Support dictionary.md
Back when I owned an iPhone -- before I switched (mistakenly and thus
temporarily) to Android -- I had a note for each year's newly learned words. As
I am condensing as many of my documents as possible into my briefcase, I decided
it is time for including a dictionary.

I can still record words on my phone, and then I can transfer them to this
document.
2020-07-21 12:58:13 +01:00
William Carroll
2a44b26630 Create //todo-lists
In the beginning there existed only a generic //org directory... This directory
was generic enough to include any .org file regardless of its purpose, but
specific enough to disallow membership of other worthy files of the Markdown
ilk.

Then came the //playbooks directory, which robbed //org of most of its
inhabitants...

In the interim various .md and .org TODO lists existed scattered across the
landscape of the monorepo... some existed in far-away, exotic lands like
"travel-histlist"... These fractious tribes shared much in common with their
distant relatives, but the superficial differences granted the simple-minded,
draconian filesystem license to prevent them from mingling.

Then one day the monorepo had a new visitor: //todo-lists.
//todo-lists restored order to the monorepo, uniting all of the fractious
documents under one roof.

.md and .org files held hands and sang Kumbaya around a blazing fire for the
first time in history. All was well, and all were happy.
2020-07-20 14:38:50 +01:00
William Carroll
c6106f7884 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...
2020-07-20 14:38:50 +01:00
William Carroll
5add8ddc13 Move monzo_ynab into //tools
Optimizing is difficult: I like flat hierarchies because I don't like
directory-hopping, but I also would like a cleaner root for my mono-repo. Bombs
away!

Well it's that time again, folks: spring cleaning!

Here I am musing about a few things that bother me:
- Should I use kebab-case or snake_case?
- It feels ~confusing to have //tools and //utils. What a //projects? Isn't
  everything a project? *sigh*
2020-07-20 10:15:47 +01:00
William Carroll
4ed3254709 Add a README to haskell-file
Because every library/package deserves a README.
2020-07-20 10:10:04 +01:00
William Carroll
32480f1913 Move AOC into //scratch
Also rename it advent-of-code-2019 since I expect to participate this year as
well.

TODO: Should directories and files be name like-this or like_this?
2020-07-20 10:06:40 +01:00
William Carroll
a2475d2337 Partially complete IO chapter exercises
Inconveniently, I do not have the cipher code that I wrote from a previous
chapter, and I'm not eager to reimplement it.

TODO
- Implement encrypt
- Implement decrypt
- Read all characters from STDIN
2020-07-17 23:41:03 +01:00
William Carroll
ca06888a56 Remove week / 52 indicator
This is taking up too much space.
2020-07-17 15:39:37 +01:00
William Carroll
3a2704eba2 Update grocery list
- Add new entries
- Change quantities of existing entries
2020-07-17 12:46:25 +01:00
William Carroll
0f1146cc4c Partially complete the "Basic Libraries" chapter exercises
I was instructed to benchmark these functions, but I couldn't get the
benchmarking library to run using Nix -- although I'm *sure* it's
possible. Unfortunately the book recommends using `stack`, which I couldn't
reproduce.
2020-07-17 11:39:44 +01:00
William Carroll
feb74b3091 Complete exercises for "Non-Strictness" chapter
I completed most of the exercises for this enlightening chapter in ghci.
2020-07-14 22:28:24 +01:00
William Carroll
e5abc3d675 Finish exercises for Monad Transformer chapter
I expect to look back on this code and cringe, but... it compiles!
2020-07-12 22:43:29 +01:00
William Carroll
5116cc3463 Partially complete Monad Transformer exercises
Write Functor, Applicative, Monad instances for:
- MaybeT
- EitherT
- ReaderT
2020-07-12 17:40:54 +01:00
William Carroll
3665ea457b Partially complete some of the exercises for Composing Types
I believe there are two exercises sets in the "Composing Types" chapter. Here
are *some* of my answers so far...

I'm having trouble implementing Foldable for Compose. I was able to implement a
version of it by adding the (Functor f) constraint to the instance signature,
but I think I cheated.

I will revisit these problems as well as the earlier exercises later.
2020-07-11 11:25:07 +01:00
William Carroll
5e81144622 Misc Emacs improvements
I stole these bad-boys from @tazjin's config.
2020-07-06 20:45:33 +01:00
William Carroll
359f376005 Add ref attribute to fetchGit
Because revs afa9ca, dc80d7 aren't in the "default" (typically "master") branch
of NixOS/nixpkgs-channels, I need to specify the ref (aka branch) in order for
fetchGit to resolve the rev.
2020-07-06 14:22:34 +01:00
William Carroll
7d9cfdbc41 Prefer telephone-line to doom-modeline
After growing frustrated with doom-modeline's compatibility with my EXWM setup,
I decided to borrow @tazjin's setup, which I find to be much more appealing.
2020-07-06 11:11:08 +01:00
William Carroll
eb1af216cf Clear $NIX_PATH
Ensure that $NIX_PATH is empty using a .envrc file. nix.dev considers references
to <nixpkgs>, <briefcase>, <depot>, <unstable> to be an anti-pattern because it
hinders reproducibility by introducing an implicit environment.

This repository is chock-full of references to
<{nixpkgs,unstable,briefcase,depot}>, so right now everything is broken.
2020-07-02 14:39:08 +01:00
William Carroll
e4ddc3ba75 Prefer builtins.path
Thanks to the Nix anti-patterns documented here...

https://nix.dev/anti-patterns/language.html#reproducability-referencing-top-level-directory-with

...I'm cleaning up some of my Nix expressions. Read the article for more
context.
2020-07-02 13:28:59 +01:00
William Carroll
155dff562a Impl part 3/3 for Memo
Refactor the caching policy for the Memo by evicting the elements that have been
the least-recently-accessed.

Python's heapq module default to a min-heap. By storing our heap elements
as (UnixTime, a), we can guarantee that when we call heappop, we will get the
element with the lowest UnixTime value in heap (i.e. the oldest). When we call
heappush, we use (time.time(), key) and these values -- by having the largest
UnixTime, will propogate to the bottom of the min-heap.
2020-07-01 15:13:56 +01:00
William Carroll
a8b3a2d3c0 Support part 2/3 for the Memo problem
Bound the size of the memo by creating a BoundedQueue. Whenever we add elements
to the BoundedQueue, we remove the oldest elements. We use the BoundedQueue to
control the size of our dictionary that we're using to store our key-value pairs.
2020-07-01 14:59:49 +01:00
William Carroll
ec7c8516f7 Implement part 1/3 for "Memo"
After hearing from a Jane Street recruiter, I decided to dust off some of the
DS&As knowledge. I found this article online, which outlines an example problem
called "Memo":

https://blog.janestreet.com/what-a-jane-street-dev-interview-is-like/

Here's part 1 of the solution in Python.
2020-07-01 14:40:40 +01:00
William Carroll
011f7aeaec Convert grocery list to an .org file
Ensure that the export.hs script refers to the .org file.
2020-07-01 10:45:28 +01:00
William Carroll
ee1aeee5f8 Complete exercises for Reader and State chapters
It's beautiful how State is just Reader that returns a tuple of (a, r) instead
of just a, allowing you to modify the environment (i.e. state).

```haskell
newtype Reader r a = Reader { runReader :: r -> a }
newtype State s a = State { runState :: s -> (a, s) }
```
2020-07-01 10:42:57 +01:00
William Carroll
c4fe3c92c7 Create a .ghci for this directory
I would've created on at $HOME/.ghci, but I don't need that yet, and I didn't
want to bother with home-manager.
2020-07-01 10:38:56 +01:00
William Carroll
d820898de5 Complete exercises from Traversable chapter
I feel much more comfortable using `traverse` and `sequenceA`. I even used both
of them in the Haskell program that I wrote at work to export a trix.
2020-07-01 10:37:54 +01:00
William Carroll
82b40e8d37 Now removing "Closed"
At this point, I'm starting to lose interest.
2020-06-30 23:22:13 +01:00
William Carroll
7e6daaf21a Prefer "Closed" authMode
Setting `authMode = "Registered"` prevents me from running the `register
<password>` command from inside of `bitlbee`, which I *believe* I need to
run...
2020-06-30 23:12:18 +01:00