about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorFilesLines
2020-04-01 Version-control first-of-the-month.orgWilliam Carroll1-0/+13
Every time it is the 1st day of the month, I complete this habit chain.
2020-04-01 Add finance.org to briefcase/orgWilliam Carroll1-0/+8
I'd like to version-control the habit chain that I follow after Google sends me my paycheck.
2020-03-31 Update morning routineWilliam Carroll1-0/+2
I've been trying to read 15 minutes in the mornings. I also recently purchased some house plants that I have been watering daily before I do my yoga routine.
2020-03-31 Progress with InterviewCake's coin problemWilliam Carroll1-0/+102
I'm writing a function that returns the total number of ways a cashier can make change given the `amount` of change that the customer needs and an array of `coins` from which to create the change. My solution conceptually works but it actually does not return the results I am expecting because I cannot create a Set of Map<A, B> in JavaScript. I'm also somewhat sure that InterviewCake is expecting a less computationally expensive answer.
2020-03-30 Add dir-locals.nix to boilerplate/typescriptWilliam Carroll1-0/+3
This should help prettier-mode work out-of-the-box.
2020-03-30 Prototype my digital habits journalWilliam Carroll15-0/+5904
Trying to obviate my Google Sheets spreadsheet in favor of a more focused web app.
2020-03-30 Solve InterviewCake's compute nth FibonacciWilliam Carroll2-1/+73
While the "Dynamic programming and recursion" section hosts this problem, the optimal solution does not use recursion. Many cite the Fibonacci problem as a quintessential dynamic programming question. I assume these people expect an answer like: ```python def fib(n): cache = {0: 0, 1: 1} def do_fib(n): if n in cache: return cache[n] else: cache[n - 1] = do_fib(n - 1) cache[n - 2] = do_fib(n - 2) return cache[n - 1] + cache[n - 2] return do_fib(n) ``` The cache turns the runtime of the classic Fibonacci solution... ```python def fib(n): if n in {0, 1}: return n return fib(n - 1) + fib(n - 2) ``` ... from O(2^n) to a O(n). But both the cache itself and the additional stacks that the runtime allocates for each recursive call create an O(n) space complexity. InterviewCake wants the answer to be solved in O(n) time with O(1) space. To achieve this, instead of solving fib(n) from the top-down, we solve it from the bottom-up. I found this problem to be satisfying to solve.
2020-03-29 Drop attempt to support a user-local /etc/hostsWilliam Carroll2-2/+0
While the idea of managing the hosts at a per-user level appeals much more to me that running this as root and managing /etc/hosts, I haven't been able to get it to work.
2020-03-29 Delete the stale testsWilliam Carroll2-44/+1
While this project would benefit from having test coverage, the current tests are not providing any useful coverage.
2020-03-29 Read and write to /etc/hostsWilliam Carroll8-25/+182
TL;DR: - Rename website-blocker to url-blocker - Add a README.md - Reads and writes to /etc/hosts
2020-03-29 Parse and serialize rules.jsonWilliam Carroll5-110/+216
TL;DR: - Write FromJSON instances to decode rules.json file - Prefer Text to String and use the OverloadedStrings language extension - Read /etc/hosts and append the serialized rules.json to the end Notes: - I can remove some of the FromJSON instances and use GHC Generics to define them for me. TODO: - Define the systemd timer unit for this to run - Ensure script can run with root privileges
2020-03-29 Experiment with user /etc/hostsWilliam Carroll2-0/+3
I have not been able to get this to work yet, but I hear that it is possible to maintain a user-specific /etc/hosts.
2020-03-29 Implement isToday predicateWilliam Carroll2-23/+17
Use the Data.Time package to implement the isToday predicate.
2020-03-28 Add <unstable> to NIX_PATHWilliam Carroll1-1/+1
1. I should be using NixOS/nixpkgs-channels instead of NixOS/nixpkgs 2. Instead of refactoring everything, I'm supporting <unstable> and pointing it to NixOS/nixpkgs-channels I needed <unstable> to get a more recent version of the Data.Time Haskell package.
2020-03-28 Start social-fasting appWilliam Carroll3-0/+143
I'd like to ensure that my /etc/hosts file blocks websites at certains times. I use this to allow / disallow websites at various times of the day. TODO: - Add project README - Add tests - Publish - Create a Nix derivation - Run as a systemd timer unit - Figure out if I can run this as a user rather than root
2020-03-27 Digitize daily habitsWilliam Carroll15-0/+6048
Create a web app off the post-its that I keep near my bathroom mirror.
2020-03-27 Add timestamps to habits.orgWilliam Carroll1-28/+33
Add approximations to the duration of each activity.
2020-03-27 Change srcs to src for website.goals derivationWilliam Carroll1-1/+1
Debug the typo.
2020-03-27 Publish habits as a webpageWilliam Carroll4-0/+66
I think it might be a good idea to version control my habits, so that I can audit them as they change. I'm publishing these on my website, so that I can refer to them wherever I had internet.
2020-03-27 Ensure Emacs prettier hook activatesWilliam Carroll1-2/+0
Problem: prettier-js waits for rjsx-mode. rjsx-mode only runs on .js files. As such, the hook that installs prettier-js-mode for *all* of my frontend hooks, which includes more than just js files, does not install until a javascript file is opened. Solution: Do not conditionally load prettier-js. Bonus: Remove the .js mode from rjsx.
2020-03-27 Add node_modules to .gitignore of boilerplate/typescriptWilliam Carroll2-4/+6
briefcase's top-level .gitignore ignores node_modules, so I never noticed that it was missing from my boilerplate .gitignore. I don't *really* need to add it to that .gitignore, but if I want to cleanly eject directories from this monorepo, it makes sense to keep the .gitignore files local to each project.
2020-03-27 Run Prettier across projectsWilliam Carroll22-128/+181
Problem: Prettier was not running when I saved Emacs buffers. Why? - prettier-js-mode needs needs node; lorri exposes node to direnv; direnv exposes node to Emacs; lorri was not working as expected. Solution: Now that I'm using nix-buffer, I can properly expose node (and other dependencies) to my Emacs buffers. Now Prettier is working. Commentary: Since prettier hadn't worked for so long, I stopped thinking about it. As such, I did not include it as a dependency in boilerplate/typescript. I added it now. I retroactively ran prettier across a few of my frontend projects to unify the code styling. I may need to run... ```shell $ cd ~/briefcase $ nix-shell $ npx prettier --list-different "**/*.{js,ts,jsx,tsx,html,css,json}" ``` ...to see which files I should have formatted.
2020-03-27 Delete nut-scoreWilliam Carroll13-474/+0
In the spirit of minimalism, I would like to delete this half-baked project from my repository. Do less, but better.
2020-03-27 Drop support for lorriWilliam Carroll20-52/+43
Lorri does not cleanly integrate with my corporate device, which cannot run NixOS. To expose dependencies to Emacs buffers, I will use nix-buffer.el, which reads its values from dir-locals.nix. To easily expose dependencies from my existing shell.nix files into dir-locals.nix, I wrote a Nix utility function.
2020-03-26 Change theme to doom-oneWilliam Carroll1-1/+1
TL;DR - Prefer doom-one theme to solarized light - Prefer colorscheme/set to themes/set
2020-03-26 Solve InterviewCake's recursive string permutations problemWilliam Carroll2-1/+86
Write a function that returns the set of all of the possible permutations of an input string. This function should be solved recursively.
2020-03-26 Solve InterviewCake's find duplicate beast modeWilliam Carroll2-2/+116
Write a function to find a duplicate item in a list of numbers. The values are in the range [1, n]; the length of the list is n + 1. The solution should run in linear time and consume constant space. The solution is to construct a graph from the list. Each graph will have a cycle where the last element in the cycle is a duplicate value. See the solution for specific techniques on how to compute the length the cycle without infinitely looping.
2020-03-25 Use Parcel's --public-url option when buildingWilliam Carroll2-2/+2
By default Parcel prefixes output paths with /. So when Chrome loads wpcarro.dev/goals it attempts to get the CSS and JS and other assets from wpcarro.dev/ instead of wpcarro.dev/goals/. Using the --public-url ./ option makes Parcel output relative paths, which should work better for my needs.
2020-03-25 Use boilerplate/typescript for goalsWilliam Carroll14-3554/+5785
After deploying the version of this application that built everything in the browser, which originally was the impetus for the entire project, I learned that the babel in-browser transformer won't work. I'm not sure why, but I need to move on from this project and do other work. I ported the code to my boilerplate/typescript, which works. Wahoo!
2020-03-25 Debug typescript/default.nixWilliam Carroll1-5/+5
TL;DR - Change derivation name - Point to $src/index.html instead of non-existent index.html - Prefer defining pkgs as a function argument
2020-03-25 Remove math.ts from boilerplate/typescriptWilliam Carroll1-3/+0
This file is only a distraction.
2020-03-25 Create wpcarro.dev/goalsWilliam Carroll9-21/+3705
Create a simple React app to define my goals. See the goals/README.md for more context.
2020-03-24 Add @types/node to typescript boilerplateWilliam Carroll2-0/+6
Parcel uses process.env to expose environment variables. Since process.env is a Node concept and this boilerplate is for TypeScript projects, we need @types/node to support these Node types.
2020-03-24 Add sandbox project using Contentful CMSWilliam Carroll16-0/+5965
I used the boilerplate/typescript project as a starting point. This project fetches and renders books that I'm defining in a Contentful CMS that I created.
2020-03-24 Move nut-score into website/sandboxWilliam Carroll15-9/+7
Also move some .gitignore entries from the top-level .gitignore into a subdirectory .gitignore.
2020-03-24 Delete mail/William Carroll1-6/+0
I do not use this. In the interest of trimming fat, I'm removing it.
2020-03-23 Support boilerplate for TypeScript projectsWilliam Carroll16-0/+5906
I would like to support boilerplate code for ReasonML, TypeScript, ClojureScript, and Elm projects before I specialize in any of these frameworks. All of my projects should use TailwindCSS. All of this boilerplate should offer: - Same command to start developing - Same API to build and deploy - TailwindCSS support - Basic boilerplate for components, state, and routes This TypeScript boilerplate is not complete, but I would like to commit the progress in case I do not return to this for awhile.
2020-03-20 Change the value of constants/current-projectWilliam Carroll1-1/+1
Yesterday evening, I moved the blog directory to website/blog; I forgot to update this value.
2020-03-20 Solve InterviewCake.com's mesh-message problemWilliam Carroll2-1/+184
Write a function that returns the shortest path between nodes A and B in an unweighted graph. I know two algorithms for finding the shortest path in a *weighted* graph: - Use a heap as a priority queue instead of the regular queue that you would use when doing a BFT. This is called Dijkstra's algorithm. You can also use Dijkstra's algorithm in an unweight graph by imaginging that all of the weights on the edges are the same value (e.g. 1). - Map the weighted graph into an unweighted graph by inserting N nodes between each node, X and Y, where N is equal to the weight of the edge between X and Y. After you map the weighted graph into an unweighted graph, perform a BFT from A to B. A BFT will always find the shortest path between nodes A and B in an unweighted graph. I had forgotten that a BFT in an unweighted graph will always return the shortest path between two nodes. I learned two things from InterviewCake.com's solution: 1. I remembered that a BFT in an unweighted graph will return the shortest path (if one exists). 2. I learned to use a dictionary to store the edge information and then back-tracking to reconstruct the shortest path.
2020-03-20 Unbind <SPC> in evil's motion mapWilliam Carroll1-1/+1
By default this just advances the point one character, which I don't use nor want especially because my leader key is the space key.
2020-03-20 Support KBD for toggling linum-modeWilliam Carroll1-2/+1
I would like to restore the good practice of jumping precisely to line numbers within buffers.
2020-03-20 Move sandbox into websiteWilliam Carroll12-67285/+3
Nest the sandbox work under ./website.
2020-03-20 Move learn to website/learnWilliam Carroll5-2/+1
Nest the learn directory in the website directory.
2020-03-20 Move blog into website/blogWilliam Carroll40-3/+2
Nest the blog work within the website directory.
2020-03-20 Add sitemap to wpcarro.devWilliam Carroll14-4/+79
- Create ./website directory - Add a sitemap to wpcarro.dev - Move covid-uk directory to sandbox directory TODO: Next sandbox, blog, and learn in the website directory
2020-03-19 Attempt to serve sandbox.wpcarro.dev/covid-19William Carroll1-1/+3
Right now my website is serving at sandbox.wpcarro.dev, but I would rather people view it at sandbox.wpcarro.dev/covid-19. I previously tried to accomplish this with the following Nginx configuration: ```nix locations."/covid-19" = { root = briefcase.covid-uk; } ``` I am now trying `alias = ...` instead of `root = ...`. I got the idea from this SO question, https://stackoverflow.com/questions/10631933/nginx-static-file-serving-confusion-with-root-alias.
2020-03-19 Solve InterviewCake's graph-coloring problemWilliam Carroll3-1/+240
Write a function that colors the nodes of a graph such that no two neighbors share a color.
2020-03-19 Update COVID-19 webpageWilliam Carroll10-51430/+67916
- Prefer hosting on sandbox.wpcarro.dev; I would prefer to host it at sandbox.wpcarro.dev/covid-19, but I haven't figure out how to use Nginx to do serve locations like /covid-19 yet. - Splice the src directory: When I develop locally and index.html exists within ./src, I cannot access ./node_modules because ./node_modules is in a parent directory. I could fix this if I used a bundler like Parcel or Webpack, but I do not want to set that up at this time. - Introduce Tailwind for CSS. This complicates my build a bit as well. For now, I'm including output.css even though ideally I should not version-control this file. I haven't figured out how to `yarn install` and run commands like `npx tailwindcss build styles.css -o output.css` in a Nix derivation yet. Hopefully I will learn and refactor this. - Add some content about why I made this chart - Add some content about some of my covid-19 predictions - Add a footer to the webpage - Delete timeseries.json and prefer fetching the published data instead
2020-03-19 Prefer live timeseries.jsonWilliam Carroll1-1/+1
When I was first developing this, and I attempt to access https://pomber.github.io/covid19/timeseries.json, the browser prevents me from reading the data because it violates the same origin policy. I'm learning more about CORS, and I'm going to try consuming this from... https://wpcarro.dev -> https://pomber.github.io ...instead of... http://localhost:8000 -> https://pomber.github.io ...because the http -> https protocol violates CORS. I will not know unless I try, so... bombs away.
2020-03-18 Remove git.wpcarro.dev entry fron Nginx configWilliam Carroll1-7/+0
This is not currently working and it is causing Nginx to enter a retry loop. I am removing it until I choose to focus on it.