2022 Goal Retrospective

I’ve been doing retrospectives on my yearly goals for a while now. Here’s my review of last year’s goals and my thoughts about what I can change in this years goals.

(as an aside, I’ve been working on open sourcing some of the templates we use as a family to plan out our life—if you are interested in taking a look while I refine them, drop me an email.)

What Worked I started using Streaks this year to track key habits I wanted to maintain or start. For well-structured habits, this worked. I had a daily recurring p1 task on todoist to track habits on Streaks and that was effective at keeping me looking at it daily. Tracking weekly goals on a google sheet (tied to our weekly review) worked well as a recurring reminder of weekly and monthly habits I want to improve on. Goals with very clear metrics continued to work well. Only focusing on two habits per year continued to be a good practice. Anymore than two is too much. Building new habits, or replacing engrained behaviors, is more challenging than achieving a specific goal. Creating a shared goal with my wife to get 2x kid-free trips away worked really well. This is an exciting goal for both of us, and it was great for our marriage. A great "pressure release" valve which allows us lots of time for conversation and connection in the midst of raising small kids and a demanding job. Parenting Protip: we’ve found the all-inclusive Mexico resorts work really well. They are cheap, great food, great beaches, and if you are in the west, great Mexico beaches are ~2hr direct flight. I love "adventure travel" (airbnbs in a unpopular town) but at this stage of life with small kids, going somewhere where you make zero decisions (including "where do we go to eat") is really helpful for maximizing time for conversation and reflection. The effort I’ve put into digital minimalism has continued to pay off. ActivityWatch has been great for tracking my computer usage and understanding where I’m wasting time. Setting time limits on my phone apps, and iterating on them weekly, has been effective in reducing overall screen time. I’m terrible at gifts and my wife loves getting gifts. Not a good combination. I finally solved this by putting key ‘special dates’ on my todo list (3w before the actual date) and kept a running list of presents/things she wanted. This worked well. What Didn’t Goals without extremely clear outcomes did not work well. For "life decision" goals it’s worth thinking about the particular decision outcome you can track against. This is challenging, especially if you aren’t sure exactly what the outcome is. Most of my goals over the last year were not exciting. This was partly the season of life, and this next year I need to focus on some really exciting goals. You can’t have boring goals each year. Habits are tricky and have continued to be elusive to consistently form. When a habit is forward looking and you primarily track your habits in the morning, it doesn’t work. Habits that are tracked need to be something you get done right now. Habits which change a behavior compared to starting a new behavior (like eating differently or doing a screen-less day each week) are not easily built through a habit tracking app. I’m not sure what needs to be done here, but my gut instinct is: You have to involve another person to keep you accountable Set aside a large block of time to implement any structural changes to make Focus exclusively on a hard habit like this; do not try to change more than one of these at once. Create an obnoxious reminder about this habit. Ex: house-wide alexa announcement. Relatedly, if you can’t easily track a habit, it is hard/impossible to build. Only try to build trackable habits. What Should Change All goals must have an extremely clear outcome. Really think about goals and make sure they are precise enough. Refine ActivityWatch reports, by improving filtering & categorization, to give me a very clear idea of where I’m wasting time on my computer. Try the iOS downtime feature to block phone usage on a more rigorous schedule. If this doesn’t work, have my wife set the screen time password. This will especially help with stopping phone usage at night and on my screen free day. Some ideas for habits which change existing behavior: You have to involve another person to keep you accountable. Get my wife, or a close friend, on board with habit changes that have been hard to make. Set aside a large block of time to implement any structural changes to make Focus exclusively on a hard habit like this; do not try to change more than one of these at once. Create an obnoxious reminder about this habit. Ex: house-wide alexa announcement. Try using OKR format for more expansive goals that lend themselves to weak metric-based definitions. The KRs can be a bit less interesting as long as the aggregate KRs add up to completing the challenging/exciting goal.

Continue Reading

Fixing Word Navigation in ZSH

Moving to zsh from bash has been a great quality of life improvement. However, there is one thing that has driven me nuts that I have not been able to figure out: customizing the word boundary definition.

I’m using zsh 5.9 and have a lot of plugins.

forward-word ,backward-word , and the kill variants were the main widgets that I use. I used bindkey to determine these functions. After some investigation, it seems like these widgets are controlled via zstyle ':zle:*' configuration. You can dump configuration via zstyle -L You can determine what underlying zsh function is used by a widget via zle -lL. If you want to view the source of a widget function use which After some digging, I found select-word-style which seemed to be what I was looking for, but didn’t work. After some grepping around I discovered word-style which solved the issue for me if I set it to unspecified. Based on the documentation, I shouldn’t need to do this, but this is what worked for me. I looked into the autocomplete, syntax highlighter, and substring history plugins but removing them did not fix the issue.

Here’s my final configuration which fixed the issue for me:

WORDCHARS='*?_-.[]~=&;!#$%^(){}<>/ '$'\n' autoload -Uz select-word-style select-word-style normal zstyle ':zle:*' word-style unspecified

Continue Reading

Advanced Text Editing Using Karabiner & macOS KeyBindings

I’ve always wanted some of the fancy keybindings I have in VS Code across my entire macOS experience. Additionally, ever since I discovered back/forward for code navigation in VS Code I wanted to bind my mouse keys to these shortcuts.

I ended up digging into Karabiner and the native macOS keybindings. Here are my notes! Most of the resulting code is here.

macOS Keybindings

Here are some notes about what I learned about this hidden macOS feature:

There are a set of special commands that control the native cocoa text system. You can combine these commands and tie them to keyboard shortcuts, but they only work in apps that use the native cocoa text system (not Chrome, for example!). In Karabiner there is not a application_windows command, but there is a mission_control. Holding cntrl while executing mission_control (which I have bound to my middle button) will execute "application windows" and holding cmd executes show desktop. All of the standard macOS keybindings are located /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict. However, this file is not a plain text dict. You can read it using plist buddy plistbuddy -c "print" /System/Library/Frameworks/AppKit.framework/Resources/StandardKeyBinding.dict There was some strange output encoding issues that caused many of the bindings to not display properly. Any user defined keybindings override system-level keybindings. You don’t need to add the shift modifier ($) to a keybinding if shift is modifying a letter that can be uppercased. It looks like macOS has a emacs-like kill-ring that is managed separately from the system clipboard. Resources Official documentation on keybindings Another good KeyBindings example Yet another KeyBindings example List of default macOS shortcuts Here’s the best description and examples of how this magical keybinding dict works. Karabiner Key Modifications You can use karabiner to convert any mouse/keyboard input into other mouse/keyboard input. The benefit of this approach is this works across any applications, and you apply filters (only activate when a specific application is active, etc) to keyboard shortcuts. If you are adding a new rule entry to a complex modification you already have, you’ll need to explicitly add it in the karabiner complex modifications UI. Bundle identifiers can be specified as a regex. Resources List of Karabiner keycodes lists out all of the possible ‘inputs’ into your custom karabiner mappings Example of shortcut based on application condition Really interesting project which turns the caps lock key into a modifier. It is strange how caps lock is such a big key that you basically never use. Using this for something better is a great idea. Karabiner has a great site with community keybindings Example mapping mouse buttons to back/forward Delete Line Using Karabiner

The delete line command in VS Code is so convenient. For a while, I’ve wanted to bring a similar command to all of macOS. Here’s the stackoverflow post that pointed me in the right direction.

However, this was slightly glitchy in some applications (like gdocs).

{ "title": "cmd+shift+k delete line", "rules": [ { "description": "cmd+shift+k delete line", "manipulators": [ { "type": "basic", "from": { "modifiers": { "mandatory": ["left_command", "left_shift"] }, "key_code": "k" }, "to": [ { "repeat": false, "key_code": "a", "modifiers": ["left_control"] }, { "repeat": false, "key_code": "k", "modifiers": ["left_control"] }, { "repeat": false, "key_code": "delete_or_backspace" } ] } ] } } Duplicate Line Using Karabiner { "title": "duplicate line", "rules": [ { "description": "opt+shift+down duplicate line", "manipulators": [ { "type": "basic", "conditions": [ { "bundle_identifiers": [ "com\\.microsoft\\.VSCode", "com\\.microsoft\\.VSCodeInsiders" ], "type": "frontmost_application_unless" } ], "from": { "modifiers": { "mandatory": ["left_option", "left_shift"] }, "key_code": "down_arrow" }, "to": [ { "repeat": false, "key_code": "right_arrow", "modifiers": ["left_command"] }, { "repeat": false, "key_code": "up_arrow", "modifiers": ["left_shift", "left_option"] }, { "repeat": false, "key_code": "c", "modifiers": ["left_command"] }, { "repeat": false, "key_code": "right_arrow" }, { "repeat": false, "key_code": "return_or_enter" }, { "repeat": false, "key_code": "v", "modifiers": ["left_command"] } ] } ] } ] } Back & Forward Code Navigation in VS Code Using Karabiner

I have a logitech MX vertical mouse (which I’ve enjoyed). I wanted to conditionally map the back/forward buttons to the VS code keyboard shortcut for back/forward code navigation.

{ "title": "Back/Forward in Visual Studio Code", "rules": [ { "description": "Change mouse button 4/5 to navigate back/forward in VSCode", "manipulators": [ { "type": "basic", "conditions": [ { "bundle_identifiers": [ "^com\\.microsoft\\.VSCode" ], "type": "frontmost_application_if" } ], "from": { "pointing_button": "button4" }, "to": [ { "key_code": "hyphen", "modifiers": [ "left_control" ] } ] }, { "conditions": [ { "bundle_identifiers": [ "^com\\.microsoft\\.VSCode" ], "type": "frontmost_application_if" } ], "from": { "pointing_button": "button5" }, "to": [ { "key_code": "hyphen", "modifiers": [ "left_control", "left_shift" ] } ], "type": "basic" } ] }, { "description": "When VS Code is not active, use standard browser back/forward commands", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ "^com\\.microsoft\\.VSCode" ], "type": "frontmost_application_unless" } ], "from": { "pointing_button": "button4" }, "to": [ { "key_code": "open_bracket", "modifiers": [ "left_command" ] } ], "type": "basic" }, { "conditions": [ { "bundle_identifiers": [ "^com\\.microsoft\\.VSCode" ], "type": "frontmost_application_unless" } ], "from": { "pointing_button": "button5" }, "to": [ { "key_code": "close_bracket", "modifiers": [ "left_command" ] } ], "type": "basic" } ] } ] } Duplicate Line, Move Line, Delete Line using macOS KeyBindings

The Karabiner versions work well enough, but they are a bit glitchy in some applications. An alternative is implementing these functions in macOS keybindings. The downside is they do not work on applications that do not use the native text input and are glitchy in applications that overload the native text input in strange ways.

{ // duplicate paragraph, opt + shift + down "~$\UF701" = (setMark:, moveToBeginningOfParagraph:, moveToEndOfParagraphAndModifySelection:, copy:, swapWithMark:, moveToEndOfParagraph:,moveRight:,insertNewline:,moveLeft:, paste:); // delete line/paragraph, cmd + shift + k "@K" = (selectParagraph:, delete:, moveToBeginningOfParagraph:); // Move line up "~\UF700" = (selectParagraph:, setMark:, deleteToMark:, moveLeft:, moveToBeginningOfParagraph:, yank:, moveLeft:, selectToMark:, moveLeft:); // Move line down "~\UF701" = (selectParagraph:, setMark:, deleteToMark:, moveToEndOfParagraph:, moveRight:, setMark:, yank:, moveLeft:, selectToMark:); } Open Questions On my Logitech mouse, there is a fourth button (not conveniently located) that doesn’t show up in the Karabiner event viewer. I wonder if there’s any way to map this via karabiner? How exactly how the emacs kill ring work in macOS? Can zsh/tmux be customized to use similar shortcuts?

Continue Reading

Learning Swift Development for macOS by Building a Website Blocker

I loved Focus App. It blocked websites and apps on a schedule. But, years ago it started glitching out: sucking up tons of ram and freezing my computer. They didn’t fix the bug and I abandoned using it and instead switched to a host-based blocking system which has served me well.

However, there are some issues with the host-based approach:

I can’t block specific URLs, only hosts (focus app couldn’t do this either) I can’t set a schedule I can’t block apps If I remove a host it will not automatically get blocked unless I sleep and wake the computer Sleepwatcher (cli tool) is dead and requires some manual set up to get working.

My goal is to layer on top of the existing host-based system that has been working great and add another layer of focus tooling:

CLI-first tool Allow configuration to be easily set using a JSON file Allow different blocking configuration to be scheduled Replace sleepwatcher by configuring script execution on wake Add a ‘first wake of the day’ trigger that I can tie into clean browsers and todoist scheduler Allow both hosts and partial match urls to be blocked ‘Partial match’ means (a) anchors are excluded and (b) the configured block url must only be a subset of the url on the browser in order to be blocked. This will enable things like blocking news or shopping search on google. Support blocking urls in google chrome and safari No UI, maybe build a simple REST API that could be tied into my beloved Raycast Run CLI tool as privileged (in order to mutate /etc/hosts)

With a clear goal in mind for this learning project, I was able to get started and build this out. Here are the two repos with the resulting code:

hyper-focus CLI source code hyper-focus GUI via Raycast extension

I haven’t touched macOS development in years and hadn’t done any Swift development before. Below are my notes from learning swift and macOS development.

Swift Language The guard statement is explicitly used to return early. It’s like unless in ruby with some special scoping properties. More info. Specifically guard is useful for unwrapping an optional and assigning the unwrapped variable to something that can be used in the outer scope. There’s a community built package manager, but it requires that you (a) have a Package.swift and (b) use a specific source code structure. Both of which are a pain for a simple utility. I found later on that it’s better to just set up your application using Package.swift, even if it’s small. You’ll end up needing a community package and using the swift CLI tooling is nice. There’s a built-in JSON decoder, but it requires you to describe the incoming JSON payload as a struct. This makes sense since swift is strictly typed, but makes fiddling with data structures a PITA. There’s no built-in logging library with levels. There’s an open-source package out there, but not having it included with the stdlib is crazy to me. Here’s a < 50 line implementation of a simple stdout log. @objc exposes the swift function/class to the objective-c side of the world. You don’t have to worry too much about this, the compiler will warn you and enforce that you put these attributes in the right places. You can extend existing classes via extension String and add whatever methods you’d like onto them. I’m surprised by this for what seems an otherwise very structured language. This was a great compromise. One of the guys who works on the Swift language built Rust. I don’t know Rust (it’s on my learning list!) but from what I’ve heard—and the adoption it’s gotten across the new CLI tooling that has been emerging—it’s an amazing language. Probably part of the reason Swift seems so well-designed. Doesn’t seem like there are union types in Swift. You have to define an enum and then unwrap the enum using a switch statement. This seems insane to be and makes for very ugly code, I must be missing something here. You can nest struct definitions, which is nice. You can’t add a trailing comma to arrays or dicts, which drives me nuts. Makes it harder to refactor code and adds additional mental overhead to editing anything. It’s puzzling to me why more languages don’t allow this (one of the things I love about Ruby). You can typecast an object to a specific type with as! SafariWindow I imagine, since Swift is strongly typed, this has some limitations + compile errors, but I don’t know what they are and didn’t bother to learn. You only need an import to pull in a framework, not individual files. All files in the project are automatically compiled. Anything marked with public is available to everything in the project. This seems to indicate something otherwise, still some more investigation needed here. Argument order matters even when using keyword arguments. Bummer. Crash reports are still nearly useless. They have a stack trace, but no line numbers. You need to convert the crash report into a stack trace which is usable, which requires symbol-mapping file (dSYM) generated at the same time as the binary that generated the crash report. PLCrashReporter does a lot of this for you, but for a simple single-file swift script this is a massive pain. There are no stack traces on the command line, even in debug mode. ! asserts that the optional is not nil. If it is, your app will crash. You can use as? to define a default value if a non-nil value does not exist Method overloads exist, so you can define a method multiple times with different params. I really like this pattern, wish Swift had method guards like Elixir (one of my favorite things about Elixir). You have to explicitly indicate that a func could throw an exception with throws in the method signature. This is interesting, I think I like it, makes the design of the function more explicit. Empty dictionary is [:], and you can inline-type Any to a dictionary via varName: [String: Any]. I think Swift dictionaries are the same as an NSDictionary under the hood. dispatchMain() is not the same as RunLoop.main.run() despite what some blog articles say. let == const in JavaScript, var is roughly equivalent to JavaScript. Multiple let statements in an if can be separated by a comma. If any of the let statements results in a nil value, then the if statement fails. I don’t understand the value of this syntax above &&. I don’t like this language design choice. There are some magic variables. For instance, if you are in a catch block the error variable represents the exception. If you have a global function named error it is not accessible and overwritten by the local error variable. I didn’t read up on Swift’s memory allocation strategy, but my assumption is if a var isn’t referenced any longer (i.e. out of scope) it’s removed/garbage collected. The foot gun here is you have a class which subscribed to a notification (NSWorkspace.shared.notificationCenter.addObserver) but that class is not assigned to a var that will continue to persist after the caller completes (i.e. a class or global variable) the object will be garbage collected and you’ll never receive that notification and an error will not be thrown. However, if a function creates a Task which creates its own run loop, that task will continue to run as long as the loop is created even after the caller that created the Task has completed. I would imagine this is a bad design pattern. This also applies to other systems which receive ‘notifications’. I use this word very vaguely because I don’t understand macos subsystems very well/at all. It seems like there are ‘grand central dispatch’ queues which feel similar to a SQS queue, and those seem to be impacted as well. Any async pub/sub type interface would be impacted by the subscriber being garbage collected and you will not receive an error. It puzzles me why errors are not thrown. Hosting a localhost server

This is simple as long as you do bind to a local IP: localhost, 127.0.0.1, etc. If you bind to your router’s IP address you’ll run into all sorts of permissioning issues:

The default permissioning is different depending on what macos version you are on. Here’s an example of how to check an application’s default permissioning You cannot change your entitlements/permissions if you are just building a simple binary or cli app. You need an app with a Info.plist to set the proper security config. This is because of new security stuff that apple has introduced. This means you need to use xcode to setup and build your application. I couldn’t find any good examples of an app that is built without using XCode. The alternative to this is using another layer of indirection, like tuist. This is bringing back memories of all of the stuff I hated about desktop application development. Don’t bind to the device IP (i.e. the wifi- or ethernet-assigned address) unless you need to. Bind to localhost so the server is only accessible on the device. Swift server package options https://criollo.io https://github.com/httpswift/swifter https://github.com/Building42/Telegraph https://github.com/envoy/Ambassador Packaging

Not using a Package.swift for anything even slightly complex will bring a world of pain:

The VS Code tooling doesn’t work as well (no error highlights and LSP stuff) You can’t use a package manager and therefore can’t easily pull in community packages Anything that uses swift build doesn’t work

You’ll want to use a Package.swift in your project. Generating a Package.swift is pretty easy:

swift package init --type executable

When running swift build I ran into:

no such module 'PackageDescription

This post describes the issue and the following command fixes it for me:

sudo xcode-select --reset

If you run into issues with compilation errors due to some features not being available on older macos versions, you’ll need to add a platform requirement to your Package.swift:

platforms: [ .macOS(.v13) ],

Here’s an example Package.swift for the CLI tool.

Cleaning All Cache

I ran into a very weird build error:

❯ swift run Building for debugging... Build complete! (0.25s) dyld[21481]: Symbol not found: (_$s10Foundation11JSONDecoderC6decode_4fromxxm_AA4DataVtKSeRzlFTj) Referenced from: '/Users/mike/Projects/focus-app/.build/x86_64-apple-macosx/debug/focus-app' Expected in: '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation' [1] 21481 abort swift run

Even after resetting the project to a state where I knew it compiled, it still errored out. After walking away for a while, I found this post and tried updating the min macos version. It magically fixed the issue.

Here’s what I used to clear all build caches:

rm -Rf .build/ rm Package.resolved rm -Rf ~/Library/Developer/Xcode/DerivedData rm -Rf /Users/mike/Library/Caches/org.swift.swiftpm Open Questions Is there a way to open a repl with your application’s code imported? It was nice that a compiled language had a recent repl, but ideally, I want to open a repl and be able to import/use my applications code. How is the debugger? I just did caveman debugging for this project and didn’t bother understanding the GUI debug tooling. It’s unclear how good the package ecosystem is. It seems better than my Cocoa days, but there weren’t that many options and the package activity seems pretty dead. It doesn’t seem like you can build a .app without an xcode project. This is annoying, especially if you are building a small tool and don’t want to learn and understand the xcode toolchain (it still seems terrible). I wonder if I’m missing something here and if there’s some good tooling to support a CLI-based application build? I was surprised at how many errors were not reported. If you’ve subscribed an object as an observer to a notification center, the object was GC’d, that should give you an error. It seems like there were a good number of silent failures which made it harder to discover unexpected failures, especially to someone who is not a desktop developer. I wonder if there’s some env flags that change this behavior. I never understood/learned exactly what the @ does in Swift. It looks like a JS/Python decorator, but it’s unclear if all of the annotations are owned by Swift or if developers can write their own. Where is the documentation for all of the magic variables? i.e. error in a catch block? Open Source https://github.com/Ranchero-Software/NetNewsWire https://github.com/rxhanson/Rectangle Has automated some of the release process https://github.com/exelban/stats https://github.com/kean/PulsePro https://github.com/piemonte/Player https://github.com/cirruslabs/tart https://github.com/signalapp/Signal-iOS https://github.com/onevcat/Rainbow https://github.com/Sequel-Ace/Sequel-Ace https://github.com/HedvigInsurance/ugglan https://github.com/lvillani/chai https://github.com/halo/LinkLiar Thoughts on Swift

Swift is a really nice language. I like how it is strongly typed, but the typing system is good at inferring types when it can, so you don’t have to specify that many types. The type inference seems very good—better than TypeScript, Sorbet, and python from what I can tell.

I don’t like how there are not any imports, and how anything marked as public can clutter the global namespace. I hate this about ruby, and it’s something I think python gets very right. I wish there would be explicit imports and any package-level functions would be forced to be called with their package name. I can understand how this would get very messy with the objc stuff, but that could have been special-cased in some way.

Some of the objc interface stuff is strange, but I think the language designers did a very good job of dealing with it in a simple way.

The tooling isn’t bad but there are some strange gaps in the stdlib, largely because of the legacy cocoa infrastructure you can leverage. I found this annoying: there’s not a simple logger, there’s no built-in yaml parser, etc. The Cocoa apis have a lot of legacy decisions to deal with and they are generally a pain to use. I wish the stdlib was more expansive and designed without thinking about the legacy APIs too much.

The package manager requires you to build your application in a specific way, which is annoying, but if you follow the golden path things work in a pretty clean way. It’s nice that there is an official package manager that Apple is committed to maintaining.

After writing something simple in Swift, I found myself wishing JavaScript was Swift. It feels like JavaScript in many ways, but has less foot guns and is more simple. The language designers did a great job, and it felt fun to work in.

Continue Reading

My Experience With GitHub Codespaces

I have an older intel MacBook (2016, 2.9ghz) that I use for personal projects. My corporate machine is an M1 Macbook Pro and I love it, but I’ve been holding off on replacing my personal machine until the pro M2 comes out (hopefully soon!).

I love playing with new technology, especially developer tools, and when I got accepted to the codespace beta I couldn’t resist tinkering with it. To speed up my ancient MacBook, try some new tech, and have the ability to learn more ML/AI tooling in the future.

Summary

I largely agree with this analysis.

Codespaces are very cool. They work better than I expected—it felt like I was developing on a local machine. Given how expensive the sticker pricing is, I don’t get why you wouldn’t just buy a more powerful local machine in a corporate setting (codespaces is free for open source work). I can’t see devs being ok with a Chromebook vs MacBook pro, so the cost savings aren’t there (i.e. buy a cheaper machine and put the savings into rented codespace).

You could run a similar dockerized setup locally on the MacBook if you wanted to normalize the dev environment (which is a big benefit, esp in larger orgs). I think this is one of the best benefits of codespaces—completely documented and normalizing your development environment so it’s portable across machines.

Notes

Here are some notes & thoughts on my experience with codespaces:

Codespace is essentially a docker image running on a VM in the cloud wired up to your VS code local installation in a way that makes your experience feel like you aren’t using a remote machine. Amazingly, code, gh pr view --web, etc all work (i.e. opens a local browser) and integrate with macOS. They’ve done a decent job integrating codespaces into the native experience so you forgot If you are curious, this is done by a magic environment variable: BROWSER=/vscode/bin/linux-x64/e7f30e38c5a4efafeec8ad52861eb772a9ee4dfb/bin/helpers/browser.sh Add Development Container Configuration is the command you need to run to autogen the default .devcontainer/ config for your codespace. Your dotfiles are magically cloned to /workspaces/.codespaces/.persistedshare/dotfiles File system changes are not instantly updated in the file explorer. There is a slight delay, which is frustrating. It looks like there is a reference that has emerged after the initial beta. Lots of examples/open source code still references some of the old stuff, so you’ll have to be careful not to cargo-cult everything if you want to build things in the latest style that will be resilient to changes. /workspaces/.codespaces/shared/.env has a bunch of tokens and context about the environment. You can have multiple windows/editors against multiple folders. You can do this by cloning additional folders to /workspaces and then run code . when cd‘d in that folder. Terminal state is not restored when a codespace is paused Codespace logs are persisted to /workspaces/.codespaces/.persistedshare/EnvironmentLogbackup.txt. You can also access them via the cli gh codespace logs Some of the utilities used to communicate with your local installation of vscode are located in ~/.vscode-remote/bin/[unique sha]/bin/. It’s interesting to poke around and understand how client communication works. /workspaces/.codespaces/shared/.env-secrets contains github credentials, and other important secrets. CODESPACE_VSCODE_FOLDER is not setup in /etc/profile.d. This is injected into the environment via VS Code extension JavaScript. Therefore, this variable is not available during postCreateCommand execution. If you’ve used the remote SSH development, much of the magic that makes that work is used in a codespace. There’s a hidden .vscode folder installed on the remote machine and some binaries which run there to make VS Code work properly. Load order

I couldn’t find clear documentation on the load order: when does your code get copied to the container, when do all of the VS code tools startup on the machine, etc. https://containers.dev/implementors/spec/ for the general devcontainer specification, but it’s not too helpful.

Dockerfile. Your application code does not exist, features are not installed. Features (like brew). Each feature is effectively a bundle of shell scripts that are executed serially. Application code does not exist at this point. Post Install. Dockerfile is built, features are installed, application code exists, dotfiles are not installed. Dotfiles. At this step (and all previous steps), code (vs code cli) does not exist and has not yet been installed. Sometime after this the code binary is installed and some of the daemon-like processes that run on the remote machine are started up. From what I can tell, there’s not a single-run lifecycle hook that you can use at this stage. ASDF: Version Manager for Everything

I really like asdf conceptually: one version manager to rule them all. Consistent versions and installation methods across machines and languages. Simple and beautiful. I’ve been using it for years on Elixir, Ruby, JavaScript, and Python projects and have had a great experience.

The devcontainer image examples had a completely different runtime for each major language. What if you use multiple languages? What if your environment is more custom?

I thought it would make sense to try to use asdf across all projects, as opposed to language-specific builds.

Some notes:

If you install asdf via homebrew it will throw asdf installation files in /home/linuxbrew/.linuxbrew/Cellar/asdf/0.10.2/libexec/asdf.sh. Many tools, including ElixirLS assume that the full installation exists in ~/.asdf . This caused issues on the codespace, it seems as though the shell script to start ElixirLS was not using the default shell and did not seem to be sourcing standard environment variables. I’m guessing depending on how the extension is built it does not properly run in I ran into weird issues with pyright: poetry run pyright . returned zero errors, while running pyright. inside of poetry shell triggered a lot of errors relating to missing imports (related issue). Erlang uses devcontainers and asdf, which is a good place to look for examples.

Here’s the image I ended up building and it’s been working great across a couple of projects.

Docker Compose & Docker-in-Docker

Using docker compose (to run postgres, redis, etc) is super helpful but is not straightforward. Here’s how I got it working:

You can specify a docker-compose.yml file to be used in your devcontainer.json. This seems like a great idea until you realize that you can’t manage the other services that are started through the compose definition at all. You are "trapped" inside your application container and cannot inspect or manage the other processes at all. Most of the documentation + content out there recommends using dockerComposeFile in your devcontainer.json. This is not the best way. The more flexible approach is to install docker inside a single container. This requires a bit more setup, specifically passing additional flags to the parent docker container in order to be able to run docker. Dotfiles transformation

My dotfiles are very well documented, but were not ready for codespaces. I needed to do some work to separate out the macos specific stuff from the cross-platform compatible tools.

Here’s a great guide on how to get your dotfiles setup Thankfully, brew works on linux and has a really easy integration within codespaces. This made my life easier since my dotfiles are built around brew. Pull out packages that are system-agnostic and stick them in a Brewfile. Here’s mine. Create an install script specifically for codespaces. Here’s what mine looks like. VS Code Extensions

Sync Settings extensions are not installed automatically. You have to specify which extensions you want installed on the codespace through a separate configuration github.codespaces.defaultExtensions.

Homebrew Installation Failure

Due to old packages (or old apt-get state, not sure which) installed on the image. If you use a raw base image for your codespace, you need to ensure you run apt-get update in order for homebrew install to work properly.

Another alternative is using the dev- variant of many of the base images (here’s an example).

GPG Signing

It looks like the codespace machine calls some sort of GH API to power the GPG signing. If you have a .gitconfig in your dotfiles, it will overwrite the custom settings GitHub creates when generating the codespace machine. You’ll run into errors writing commits in this scenario.

Here’s what you need to do to fix the issue:

git config --global credential.helper /.codespaces/bin/gitcredential_github.sh git config --global gpg.program /.codespaces/bin/gh-gpgsign

You’ll also want to ensure that GPG signing is enabled for the repository you are working in. If it’s not, you’ll get the following error:

error: gpg failed to sign the data fatal: failed to write commit object

You can ensure you’ve allowed GPG access by going to your codespace settings and looking at the "GPG Verification" header.

As an aside, this was an interesting post detailing out how to debug git & gpg errors.

Awk, and other tools

The version of awk on some of the base machines seems old or significantly different than the macOS version. It wouldn’t even respond to awk --version. I installed the latest version via homebrew and it fixed an issue I was having with git fuzzy log where no commit found on line would be displayed when viewing the commit history.

I imagine other packages are old or have strange versions installed too. If you run into issues with tooling in your dotfiles that work locally, try updating underlying packages.

Shell Snippets

Here are some useful shell commands to make integrating cs with your local dev environment more simple.

# gh cli does not provide an easy way to pull the codespace machine name when inside a repo targetMachine=$(gh codespace list --repo iloveitaly/$(gh repo view --json name | jq -r ".name") --json name | jq -r '.[0].name') # copy files from local to remote machine. Note that `$RepositoryName` is a magic variable that is substituted by the gh cli gh codespace cp -e -c $targetMachine ./local_file 'remote:/workspaces/$RepositoryName/remote_file' # create a new codespace for the current repo in the pwd gh alias set cs-create --shell 'gh cs create --repo $(gh repo view --json nameWithOwner | jq -r .nameWithOwner)' Unsupported CLI Tooling

Here are some gotchas I ran into with my tooling:

zsh-notify. Macos popup when a command completes won’t work anymore. pbcopy/pbpaste doesn’t work in the terminal. You lose all of your existing shell history. There are some neat tools out there to sync shell history across machines, might be a way to fix this. Open Questions Is there more control available for codespaces generated by a pull request? Ideally, you could have a script that would run to generate sample data, spin up a web server, etc and make that web server available to the public internet in some secure way. I think vercel does this in some way, but it would be neat if this was built into GitHub, tied into VS Code, and allowed for a high level of control. I’m still in the process of learning/mastering tmux, there seemed to be some incompatibilities that I’ll need to work around. cmd+f within the integrated shell doesn’t search through scroll buffer clipboard integration doesn’t work (main reason for using tmux is keyboard scroll-buffer search and copy/paste support) pbcopy/pbpaste, which I use pretty often, doesn’t work. A good option is using something like Uniclip, but this will require some additional effort to get working. Other alternatives that might be worth investigating: https://github.com/jedisct1/piknik https://gist.github.com/dergachev/8259104 I had trouble with some specific VS Code tasks not working properly. This was due to how some tasks build the shell environment. Can you run github actions locally within the codespace? This would be super cool. Looks like it’s not possible right now, but there’s some open source tooling around this which looks interesting. There’s got to be a cleaner way to sharing a consistent ssh key with a codespace for deploys. This post had some notes around this. I’m not sure how the timeout works. What if I’m running a long-running test or some other terminal process? Will it be terminated? Is there a way to keepalive the session in some other side process? Can you mount the remote drive locally and have it available in the finder? scping files to view and manipulate locally is going to get tired fast.

Continue Reading

Blocking Websites on a Schedule With Pi-Hole

I’ve written about blocking adds and distracting websites before as part of my digital minimalism crusade. I’m a big fan of thinking through your lifestyle design and automating decisions as much as possible.

For instance, after 9pm at night and before 7am there’s a set of distracting websites that I do not want myself, or anyone in my family, to be able to access. This introduces just enough friction to bad behavior (like scrolling Twitter at 9pm) that it prevents me from doing the wrong thing.

Below I’ve described how I block (and then subsequently allow) websites on a schedule, and some other misc related trick with the Raspberry Pi & Pi-Hole.

Block Sites on a Schedule

I wanted to block my Roku TV based on my cron schedule. However, the TV uses a bunch of different subdomains across various services. With a /etc/hosts blocking method, you can’t block domains based on a pattern, but you can with pi-hole.

The --wild command converts your domain into a wildcard regex to match the domain of any subdomains.

For example, if you have a blocklist file containing a simple list of URLs:

facebook.com pinterest.com amazon.com netflix.com feedbin.com disneyplus.com roku.com youtube.com twitter.com

Your block.sh would look like:

blockDomains=$(<blocklist) for domain in ${blockDomains[@]}; do pihole --wild $domain done

Note that the position of the -d is significant in your allow.sh:

blockDomains=$(<blocklist) for domain in ${blockDomains[@]}; do pihole --wild -d $domain done

Here’s a great discussion about how to block groups in Pi-hole.

Running Pi-Hole & Scheduled Blocking on Docker

I’ve codified most of this into a docker container and related docker-compose.

Whitelist Alexa-related Domains

If you block amazon (which I recommend to avoid buying stuff or getting sucked into prime video), you may want to whitelist alexa-related domains so they work inside "blocked hours". Here are the domains you want to whitelist (and here’s a script to do it):

bob-dispatch-prod-na.amazon.com avs-alexa-14-na.amazon.com api.amazon.com api.amazonalexa.com latinum.amazon.com DDNS with Dreamhost

Sometimes, if you are running a VPN or a node on a service (like Storj) you’ll want to have an external domain available which points to your network IP.

I have a dreamhost server that runs a couple of WordPress sites for me. They have a nice API for modifying DNS records that can be used to dynamically update a domain record which points to my home network.

Here’s the modified dreamhost script that worked for me (I couldn’t get the PR for this merged). Here’s how to set it up as a cron on the pi:

crontab -e @hourly bash -l -c 'DREAMHOST_API_KEY=THEKEY DREAMHOST_UPDATE_DOMAIN=subdomain.domain.com /home/pi/Documents/dreampy_dns/dreampy_dns.py'

Watch the logs:

tail -f /var/log/cron.log

To test to make sure it’s working (from a server outside your network):

telnet node.thesite.com 28967 Even better: DDNS with Dreamhost + Docker

You can also run this as a docker image. Here’s an example docker-compose.

Blocking DNS over HTTP

iOS and specific websites on macos use DNS over HTTP. This breaks the blocking rules you setup on pihole. You can configure pihole to reject all DNS over HTTP queries.

Here’s what this looks like in the pi-hole interface:

Here’s how to do this on the command line.

Blocking Spam, Porn & Other Sites on Raspberry Pi

Block List Project has a great index of various site groups you can block, including porn. Here’s another block list.

Navigate to Group Management > Ad List and then pick the "Original" version of the lists on the blocklist project.

Here’s a script which does this.

Continue Reading

Using the Multiprocess Library in Python 3

Python has a nifty multiprocessing library which comes with a lot of helpful abstractions. However, as with concurrent programming in most languages, there are lots of footguns.

Here some of the gotchas I ran into:

Logging does not work as you’d expect. Global state associated with your logger will be wiped out, although if you’ve already defined a logger variable it will continue to reference the same object from the parent process. It seems like the easiest solution for logging is to setup a new file-based logger in the child process. If you can’t do this, you’ll need to implement some sort of message queue logging which sounds terrible. Relatedly, be careful about using any database connections, file handles, etc in a forked process. This can cause strange, hard to debug errors. When you pass variables to a forked process, they are ‘pickled’. This serializes the python data structure and deserializes on the ‘other end’ (i.e. in the forked process). I was trying to decorate a function and pickle it, and ran into weird issues. Only top-level module functions can be pickled. If you are using the macos libraries via python, you cannot reference them both on a parent and child process. The solution here is to run all functions which hit the macos libraries in a subprocess. I was not able to get the decorator in this linked post working. Here’s a working example using a modified version of the source below.

I struggled to find full working examples of using the multiprocess library online (here’s the best I found). I’ve included an example of using multiprocessing to create a forked process to execute a function and result the results inline.

Send a signal from the parent process to the child process to start executing using multiprocessing.Condition. I want not able to get this working without first notify()ing the parent process. Kill the child process after 10m. This works around memory leaks I was running into with the applescript I was trying to execute. Configure logging in forked process. Return result synchronously to the caller using a shared queue implemented using multiprocessing.Queue import multiprocessing import time import logging forked_condition = None forked_result_queue = None forked_process = None forked_time = None logger = logging.getLogger(__name__) def _wrapped_function(condition, result_queue, function_reference): # this is run in a forked process, which wipes all logging configuration # you'll need to reconfigure your logging instance in the forked process logger.setLevel(logging.DEBUG) first_run = True while True: with condition: # notify parent process that we are ready to wait for notifications # an alternative here that I did not attempt is waiting for `is_alive()` https://stackoverflow.com/questions/57929895/python-multiprocessing-process-start-wait-for-process-to-be-started if first_run: condition.notify() first_run = False condition.wait() try: logger.debug("running operation in fork") result_queue.put(function_reference()) except Exception as e: logger.exception("error running function in fork") result_queue.put(None) def _run_in_forked_process(function_reference): global forked_condition, forked_result_queue, forked_process, forked_time # terminate the process after 10m if forked_time and time.time() - forked_time > 60 * 10: assert forked_process logger.debug("killing forked process, 10 minutes have passed") forked_process.kill() forked_process = None if not forked_process: forked_condition = multiprocessing.Condition() forked_result_queue = multiprocessing.Queue() forked_process = multiprocessing.Process( target=_wrapped_function, args=(forked_condition, forked_result_queue, function_reference) ) forked_process.start() forked_time = time.time() # wait until fork is ready, if this isn't done the process seems to miss the # the parent process `notify()` call. My guess is `wait()` needs to be called before `notify()` with forked_condition: logger.debug("waiting for child process to indicate readiness") forked_condition.wait() # if forked_process is defined, forked_condition always should be as well assert forked_condition and forked_result_queue # signal to the process to run `getInfo` again and put the result on the queue with forked_condition: forked_condition.notify() logger.debug("waiting for result of child process") return forked_result_queue.get(block=True) def _exampleFunction(): # do something strange, like running applescript return "hello" def exampleFunction(): return _run_in_forked_process(_exampleFunction) # you can use the wrapped function like a normal python function print(exampleFunction()) # this doesn't make sense to use in a single-use script, but if you need to you'll need to terminate the forked process forked_process.kill()

Note that the target environment here was macos. This may not work perfectly on linux or windows, it seems as though there are additional footguns on windows in particular.

Continue Reading

Book Notes: The Hard Thing About Hard Things

Something new I’m doing this year is book notes. I believe writing down your thoughts helps you develop, harden, and remember them. Books take a lot of time to read, taking time to document lessons learned is worth it.

Here are the notes for The Hard Thing About Hard Things by Ben Horowitz. Definitely worth reading, especially if you are actively building a company, although I wouldn’t say it’s in the must-read category.

Below are my notes! Enjoy.

Leadership

A much better idea would have been to give the problem to the people who could not only fix it, but who would also be personally excited and motivated to do so.

I think any good leader feels personally responsible for the outcome of whatever they are doing. Everything is their job, in the sense that ultimately if the project isn’t successful it is their fault.

However, I think Ben’s framing is important: it’s the leaders job to clearly describe problems—instead of hiding them—no matter how large, and get the right people aligned to the problem who are energized by big scary problems that need to be solved.

The more you communicate without BS—describing reality exactly how it is—the more people will trust what you say. There are no lines to read between. It takes time for this trust to filter its way through an organization, but it makes any other communication (which is a prime job of a leader) way easier in the future.

Former secretary of state Colin Powell says that leadership is the ability to get someone to follow you even if only out of curiosity.

Sometimes only the founder has the courage to ignore the data;

It’s nice to lean on data to make decisions. All of the great decisions in life need to be made out of an absence of data; in the absence of certainty. The safety of the modern world has made us less comfortable with taking risks and being decisive in areas of life where it is impossible to get certainty.

the wrong way to view an executive firing is as an executive failure; the correct way to view an executive firing is as an interview/integration process system failure.

Ben has a lot of counterintuitive thinking about executive management throughout the book. I found the thinking around executive hiring, management, etc the part of the book most worth reading.

He articulates the executive hiring, management, and firing process as incredibly messy, opaque, and constantly changing. I think this is the thing that technical founders struggle with a lot—it’s not straightforward, requires a lot of tacit knowledge that can only be acquired through experience, and requires lots of conflict-laden conversations which everyone hates.

Part of the leader’s job is the ability to step-in and cover any of the executive’s job if they leave or are fired. This helps the leader understand what’s really needed in that role at this stage of the company.

What is needed from an executive changes quickly as a company grows. It’s your job as a leader to understand what is needed right now, communicate that expectation, and then measure their performance off that revised standard. It’s up to the executive to figure out how to retool their skills to meet the new requirements; you don’t have time to help them here. If they can’t figure out the new role you need to let them go fast.

Management techniques that work with non-executives don’t work with executives. You can’t lead professional leaders in the same way. For instance, the "shit sandwich" approach feels babying to a professional when it may work well for a lead-node individual contributor. What works on a lead-node team doesn’t work when running a management team.

in my experience, look and feel are the top criteria for most executive searches.

Developing and holding to an independent standard in any of life is incredibly hard. We are deeply mimetic and avoiding pattern-matching on what the herd believes is right is one of the hardest tasks of leadership.

Consensus decisions about executives almost always sway the process away from strength and toward lack of weakness.

You want someone who is world-class at thing you are hiring them for. Make sure your organization can swallow their faults; don’t try to avoid faults—even major ones—completely.

Relatedly, the concept of "madness of crowds" is a good mental model to keep in mind.

This is why you must look beyond the black-box results and into the sausage factory to see how things get made.

Understanding how things work at the ground-level in an organization is key to improving performance. I always thought Stripe’s leadership did a great job here: jumping into engineering teams for a week to understand what the real problems were can’t be replaced by having 100 1:1s.

I describe the CEO job as knowing what to do and getting the company to do what you want.

This is what I liked most about the book—plain descriptions of commonly amorphous concepts.

Company building

as often candidates who do well in interviews turn out to be bad employees.

If someone is good at cracking an interview, it could be a signal that they aren’t good at the core work. If someone is exceptional, they aren’t going to care about interviewing well or understanding the big-company decision-making matrix around hiring: they know they are smart and want to work at a place that values the work.

This is a distinct advantage startups have. I love the interview process at one of my new favorite productivity apps:

We don’t do whiteboard interviews and you’re always allowed to google. We’ll talk about things you’ve previously worked on and do a work trial – you’ll be paid as a contractor for this.

They can focus on the work and ignore the mess of other signals that are only important when you need to ensure quality at scale.

In good organizations, people can focus on their work and have confidence that if they get their work done, good things will happen for both the company and them personally. It is a true pleasure to work in an organization such as this. Every person can wake up knowing that the work they do will be efficient, effective, and make a difference for the organization and themselves. These things make their jobs both motivating and fulfilling.

Simple and true description of what makes a company great, and conversely what makes bureaucratic organizations painful to operate in.

Companies execute well when everybody is on the same page and everybody is constantly improving.

Constant improvement compounds over time.

What do I mean by politics? I mean people advancing their careers or agendas by means other than merit and contribution.

Good definition of politics.

I’d love to understand what companies have designed a performance process for higher management tiers that isn’t political. At larger companies, getting promoted to higher levels becomes more political almost by definition: it’s harder to describe your impact quantitatively because your work is more people-oriented and dependent on your leadership ability.

Perhaps the CEO’s most important operational responsibility is designing and implementing the communication architecture for her company.

I’d love to hear more stories about well-designed communication systems in companies.

Perhaps most important, after you and your people go through the inhuman amount of work that it will take to build a successful company, it will be an epic tragedy if your company culture is such that even you don’t want to work there.

Reminds me of the parenting idea "don’t raise kids that you don’t want to hang out with."

the challenge is to grow but degrade as slowly as possible.

Ben makes the assumption that all companies degrade over time. Things that were easy become difficult when you add more people: mostly because of the communication overhead/coordinate and knowledge gaps across the organization.

I want to learn more about what organizations fought against this and when they felt there was an inflection point of degradation. How big can you grow before things degrade quickly?

Management

big company executives tend to be interrupt-driven.

They wait for problems to come to them, and they don’t execute work individually. Be aware of when you’ve reached this stage and then hire for these people. Hiring this type of person too early will most likely fail—if you are used to working in this style, it’s hard to change.

An early lesson I learned in my career was that whenever a large organization attempts to do anything, it always comes down to a single person who can delay the entire project.

Resonates with my experience. It’s amazing how one or two B players can destroy the ability to get anything significant done. The Elon Musk biography talks about how Elon’s employees were terrified about being "the blocker" and would do anything they needed to in order to avoid being that person. He would ask for status update multiple times a day and force you to do whatever needed to be done to eliminate yourself as the primary blocker.

However, if I’d learned anything it was that conventional wisdom had nothing to do with the truth and the efficient market hypothesis was deceptive. How else could one explain Opsware trading at half of the cash we had in the bank when we had a $20 million a year contract and fifty of the smartest engineers in the world? No, markets weren’t “efficient” at finding the truth; they were just very efficient at converging on a conclusion—often the wrong conclusion.

[managing by the numbers] penalizes managers who sacrifice the future for the short term and rewards those who invest in the future even if that investment cannot be easily measured.

Not everything can be measured. You need to have qualitative and quantitative metrics, and you can’t rely too strongly on quantitative metrics. Building anything great requires great conviction in the absence of evidence supporting the outcome you believe is inevitable.

As Andy Grove points out in his management classic High Output Management, the Peter Principle is unavoidable, because there is no way to know a priori at what level in the hierarchy a manager will be incompetent.

This is the sort of thing that makes management so incredibly hard.

If you become a prosecuting attorney and hold her to the letter of the law on her commitment [to fix a problem that she discovered], you will almost certainly discourage her and everybody else from taking important risks in the future.

No easy answer to this question. You have to hold people accountable but understand the situation enough not to disincentivize critical behavior which improves the company. If you don’t do this right, people notice and will manage their work towards what is indirectly rewarded.

the best ideas, the biggest problems, and the most intense employee life issues make their way to the people who can deal with them. One-on-ones are a time-tested way to do that,

This rings true to me. Although, I think it’s critical to get as much state out of meetings into central systems as possible so 1:1s can mostly focused on the small batch of critically important stuff that cannot be handled async.

Sales

There’s an interesting thread in the story of OpsWare that could yield the lesson "Don’t rely too much on whales". I don’t think anyone would disagree with this advice in the abstract, but I think practically it’s hard to build a big business without whales. I think you want to avoid being too reliant on whales, but I believe you also need to be ok pandering to your largest customers in B2B SaaS and doing what needs to happen to keep them thrilled with you.

There was a really helpful appendix with some great questions and guides to hiring a sales leader. I think these people-oriented jobs can sometimes seem as a black art to the hyper-logical work that technical founders start out doing.

Continue Reading

Book Notes: Successful Fathers

An older book (no kindle version!), Successful Fathers, was recommended to me by a father I really respect. Here are my book notes for it.

Fathers and mothers today, isolated as they are from their own parents and extended family, need as much experienced advice as they can get. In our own era, they need to work harder to get it.

Rings very true. Most parents, who aren’t under some other massive life stress (finances, health, etc) are very concerned about raising their kids the "right way". I am too.

However, parenting advice is an industry. It’s a business. There’s lots of advice in books, videos, courses, etc and much of it is conflicting. We aren’t missing advice, we are missing advice we can trust.

What he identifies here is this didn’t use to be a problem. Your parents, cousins, tight-night community passed down what they learned and that was it. You trusted them because you saw the outcome and didn’t try to look anywhere else. It’s definitely more complicated now.

Love is the capacity and willingness to embrace hardship for the sake of someone’s welfare

Beautiful definition.

From the earliest infancy, we acquire [values] by imitating people whose character we admire, principally from our parents.

I really enjoyed Wanting which explores the idea of mimetic desire. This is another example of how we are deeply mimetic. It’s not something that’s good or bad, it just is, and it’s important to take into account when thinking about human nature.

If my kids copy who they admire, it’s important that I become someone they can admire. This may sound obvious, but it results in interesting tradeoffs: should I spend time with my kids, or time doing something that powers the rest of my life?

I think the answer is complicated. Modern parenting advice and the current cultural norms—at least in how I perceive them—seem to push for spending more time with your kids, always. You aren’t a good dad unless you are at the soccer game, dance practice, reading to your kids, etc. Those are all good things, but the equation is more complex when thinking about how to spend your time when you have kids: making sure you are living life to the fullest is a critically important thing and can’t be sacrificed on the altar of maximizing time with your kids.

A husband’s neglect for his wife, a failure to support her authority, leads eventually toward the children’s saas and disobedience at home.

Parents need to be fully aligned in how they are raising kids—standard of behavior, discipline, etc. If dad isn’t fully behind mom, and vise-vera, kids will naturally use this against their parents to get what they want.

It’s up to parents to ensure kids don’t get what they want, but get what they need.

Psychologists have noted that much of the posturing and verbal defiance of adolescents is really testing and questioning of their father’s standards.

This aligns closely with the "high standard, high connection" parenting approach that most of the "emotion coaching"-type parenting books espouse.

The idea is that kids really want boundaries and rules and bad behavior—when they are young, or older—is their way of testing where the boundaries really are. This has felt very true in my experience.

Middle-class children today almost never see their father work

I think this is changing with remote work, but in a sense, it’s hard to ‘see’ the work that dad (or mom!) might be doing on a call or on the computer.

The idea still holds that kids rarely see dads working in an area where they excel. This decreases the respect for their parents and naturally encourages them to look elsewhere for a mimetic model for their life.

Bringing kids into your work in creative and sometimes strange ways feels key to giving them a greater understanding of what you do and why they should respect you for it.

Television and other entertainment have become the principal means by which children concepts of adult life

The core of this statement is true: rather than kids learning about adult life through a group of adults, kids do infer what ‘real life’ is like through screens. Videos, social media, news, articles, etc have an outsized influence on how kids decide how the real work operates.

The book makes the argument that this influence has grown over time because of the decreased interaction with other adults. I think this is more true than ever before—we don’t interact with nearly as many people as we used to, because we don’t have to. Mostly everything you need can be ordered quickly on a phone, work can be done remotely, neighborhoods are more isolated, etc. The lack of adult interaction changes how kids build a model of how adult life really is.

Material riches crowd out the central realities of life

The more wealth we have, the more we are comfortable and forget the suffering of others. It’s easier to empathize with others’ suffering when you are experiencing it yourself.

children come to know their father’s mind inside and out

Letting kids into your inner life—what you are experiencing, what you are feeling, how you are thinking about a problem, how you are approaching a situation is key to giving them an understanding of who you are. If they don’t know who you are, they can’t decide if they should model their life after you.

I’ve always loved families that have intense discussions. Vigorous debate and explaining how you are thinking are key to a child’s formation.

Continue Reading

Book Notes: Making it All Work

Something new I’m going to try doing this year is book notes. I’m continually more bought into the idea that writing down your thoughts helps you harden and remember them. Books take a lot of time to read: if I’m going to invest the time in a book, I should be ok investing another ~hour in calcifying the lessons I learned—so that’s what I’m going to try to do. This should help me better filter what books to read: if it’s not worth spending the time to write the notes, I probably shouldn’t read the book (obviously excluding entertainment-only reading).

Here are the notes for Making it All Work. The book wasn’t great, I wouldn’t read it unless you haven’t read Getting Things Done and are new to personal productivity. Here are the notes! Enjoy.

Improving your productivity system David Allen has a zen feel to how he describes things. Meditation, and the idea of generally being self-aware about what you are thinking, feeling, experiencing, etc is a very useful tool. When I sat back and thought about how I ‘felt’ when trying to work on something, I was able to identify various little blockers and better determine what the best thing to do at the moment is. In other words, being aware of where you aren’t performing well is key to improving. This takes time & effort. For instance, there were times I just felt distracted and I didn’t have any state of a specific project ‘loaded up’ in my mind. When I already have ideas around a project, email, etc ‘loaded’ into my mind I can work much more quickly on executing. Doing something physical—kettlebell swings, going for a run, pull-ups, etc—can shift me out of a distracted mode and convince my mind to focus its attention on the next project. I find that this sort of ‘focus shift’ using something physical can help when I’m switching between projects. I find this is true with parenting too. If your kid is in a bad mood / having a meltdown, shifting the physical environment can solve the problem. When my toddler is having a meltdown I suggest we go on a "barefoot walk" around the neighborhood (I’m weird and like walking without shoes on) and she immediately stops crying is ready to go.

And frankly, if you have any thought more than once, in the same way about the same subject, you’re probably involved in unnecessary work and exhausting your creative energy.

Thinking about the same thing over and over is a ‘process smell’: you aren’t clear on what you need to do next and don’t trust your system.

Paying attention to what has your attention

Good catchphrase from the book that encompasses this.

GTD is fundamentally much more about mind management than about time management

Time management tools have never worked well for me, but GTD has.

Given the vast changes in speed, volume, and ambiguity of what grabs our attention these days, we face an increasing need to have an “extended mind” that can truly relieve the pressure from our psyche and free it up for more valuable work.

I have felt the increase in information throughput in my life and have spent a lot of time intentionally decreasing it. The other half of the equation is developing processes and systems to help manage the information you do ne ed to care about. Todoist and Obsidian have been helpful here, but I need to continue to improve my processes.

Create clarity about your work He talks a lot about ‘task dumping’: getting everything you are thinking about dumped somewhere where you know you are going to look at it again. I’ve made this an obsessive habit over the last decade, but reflecting on it I need to do better at this in the mornings. I pray & read every morning, and tasks / projects can distract me during this time. Having a pad of paper (explicitly not using your phone, since it can be distracting just to have it around) to jot down thoughts to ‘clear’ them from your mind is an effective practice for me that I need to get better at. He defines this as "accepting, clarifying, sorting, reflecting, and engaging". I think this is a good articulation of the process we need to go through before intentionally working on the right thing. Chunking down loosely defined tasks (I use todoist) is something I don’t spend time on right now. Without a clearly defined next action, it’s hard to complete the task, and it takes extra cognitive overhead to start working on the task (because it has multiple components). An easy improvement here for me is task splitting. If there’s a large task, even if it’s well defined, I can punt the ‘large’ task to be due in the future, and add a simple next action to my near-term todo list. This applies to parenting too. A task can seem complex and overwhelming to kids, even if they have done it before and seems obvious to you. "Unload the dishwasher" is more ambiguous than "put the forks and spoons away that are in the bottom of the dishwasher". I’ve seen breaking down the task for my kids be an important way of getting them engaged with a project more. In my todo list, there are a bunch of investigative tasks. Writing or researching something I’m interested in. This could be anything from thinking about a parenting problem with my wife, investigating a new productivity tool like Raycast, implementing a new health habit, etc. These are rarely ever things I’m going to be able to complete in one sitting, and I’m rarely able to do more than one per day. However, they clutter up my todo list and weigh down on my psyche (i.e. if I see a ton of tasks due in one day, I get overwhelmed, even if I know they don’t need to be completed right now). I need to think through this and determine how to automatically limit these types of tasks each day.

Ambiguity is a monster that can still take up residence and lurk in the sharpest, most productive places and among the most sophisticated people.

Unlocking the creative process Whenever I’m hugely productive I feel this: "Loss of control and perspective is the natural price you will pay for being creative and productive. The trick is not how to prevent this from happening, but how to shorten the time you stay in an unsettled state. " Spending time organizing yourself is an important function: "Much of the energy in propelling a rocket is spent in course correction—it is, in a way, always veering out of control and off-target." Patrick Lencioni’s work is aligned with the idea that the unsaid human issues in the room (whether at work or home) affect your ability to be creative and solve problems together: "Perhaps we all are more attuned to one another than we realize, and if someone is disconnected from the mutual intention of the occasion because of unacknowledged issues, they just won’t participate fully in the game, which will mitigate the group’s cohesion and positive energy." Separating creativity from analysis or rigor is important. I’ve found you can spark creative thoughts by intentionally including bad, wild, or dumb ideas in a list. It makes it feel easier—even if it’s an exercise you are doing with yourself—to express more creative ideas. "Good brainstorming is stifled by any attempt to analyze and evaluate the meaning and merit of those ideas too soon." Levels of perspective

I’ve always felt it’s hard to calculate the next best thing to do. There are too many options, there is too much to do. In the book, it’s articulated that the reason this is hard is that there are too many inputs and it’s impossible to determine the next best thing. By organizing your tasks and thoughts well, you can make a better intuitive judgment aided by your best-effort prioritization and your psyche will slowly trust your judgment. For me, I often feel mental friction when I’m not certain about what to do next and I think this idea will help me here.

He makes the argument that it’s critical to think in terms of "level of perspective" or "horizons of focus":

Purpose/Principles Vision Goals Areas of Focus Projects Tasks

I think this is a good model, even if the exact wording of these categories might change depending on how you think about the world. I need to refine some of my thinking on the higher-level areas of focus; reflecting on this during reading the book made me realize how much I’m missing at the "top".

The true power in a long-range vision is the acceptance that holding that picture inside your consciousness permits you to imagine yourself doing something much grander than you would normally allow yourself.

Big thinking is a skill. Some people don’t have it naturally (like myself). Clarity around a long-range vision does seem to enable your mind to think bigger.

No effective framework will ever get any simpler than the continuum of purposes/principles, vision, goals, areas of focus, projects, and next actions.

This was a helpful structure for me. I was missing the higher-level categories and need to work on defining them and putting them in a place where I can be reminded and structure the lower levels around them.

Continue Reading