23 Jul 2019, 21:30

Learning Haskell: Session 1 - Stack

Learning Haskell

I spent the weekend learning some Haskell. My goals were:

  • learn a bit about the language in the trenches: is there any utility in learning more about this?
  • learn a bit about the toolchain: building, deploying, etc.
  • add a small plugin to xmobar, showing my age as a decimal number. Inspired by memento mori and trying to make the most of our limited time in this life.

This is something I want to see increase slightly every day, as a constant reminder to get stuff done.

I figured the above would be a nice whirlwind tour: not enough to start monad engineering, but enough to defend myself.

Below are some notes and thoughts.


Stack is the build system I chose to use for the library and CLI. It seems a bit more modern and recommended than pure cabal, which ships with Haskell itself. Stack seems to provide a higher level wrapping around cabal to some extent, along with some other goodies like caching.

I also like Stack’s commitment to reproducible builds, creating an environment per-project with its own ghc, the Haskell compiler. I actually don’t even have ghc installed locally, so there’s no chance I’m mucking up the build by having things on my system’s PATH override any project-specific stuff.

The downside is that Stack can eat massive amounts of disk, as you’ll have a ghc for even minor versions e.g. 8.4.2 vs. 8.4.3. Something to be aware of.

Hacking on stack basically involved looking at the documentation and various YAML files, so nothing too painful, yet.


  • stack build - produce binary
  • stack run [args] - run directly from slack
  • stack ghc - if you need to shell out to ghc for whatever
  • stack ghci - start a repl

Wrap up

It was pretty painless getting set up with stack, and creating a CLI/library project.

Next up: Haskell coding, xmobar detective work, and more.

27 Jun 2019, 22:41

Learning org mode: Session 4

Today’s goals


Within emacs

  1. Format is [[file:../notes/plans.org][Plans]]

    • C-c C-o to open any link (may open up browser)
    • can also do email, http, etc.
    • also org specific things including:

      file:projects.org::some words                text search in Org file(31)
      file:projects.org::*task title               heading search in Org file(32)
      docview:papers/last.pdf::NNN                 open in doc-view mode at page
      id:B7423F4D-2E8A-471B-8810-C40F074717E9      Link to heading by ID

Next steps

Unknown at this point, perhaps org-capture or anything else that comes up.

26 Jun 2019, 23:30

Learning org mode: Session 3

I am feeling great about this system.

Today’s goals

  • learn tags, filtering
  • add custom tags
  • continue breaking apart single uberfile into plans, tasks.

Labels of interest

  • Professional
    • e.g. project based
  • Todo list-y
    • must - have to do it
    • easy - easy wins
    • fun - .
    • saidiwould - integrity

Within emacs

  1. C-c C-q for a drop down of existing tags
    • C-c a then sort by tags (m)
  2. I added several tags I think will be useful
  3. C-c C-s for scheduled task, which means when it starts (vs. due)
  4. also hella organized into smaller files for better focus
    • I really like how the agenda shows the source of the item.

Next steps

  • not sure, but have 2 more days allocated to learning, so I’ll figure something out.

25 Jun 2019, 18:24

Learning org mode: Session 2

Today’s goals

  • set up and learn org modules and org-habit
  • learn how to set up recurring tasks

Set up org modules and habit

I’m using prelude so this may differ.

Add to ~/.emacs.d/personal/custom.el

(require 'org)
(require 'org-install)

(add-to-list 'org-modules 'org-habit)

Restart emacs.

Set up habit tasks

See references below for inspiration.

Mine will be:

  • Daily
    • reflect on day
    • plan tomorrow
  • Weekly
    • review previous week
    • plan next week

Within emacs

  1. add items
  2. set TODO state
  3. set deadlines
    • Tue 23:00 - add time due date (not just day)
    • .+1d attempt to do every day but no catch ups if missed
  4. C-c C-x p - open property dialog
    • STYLE
    • habit
  5. add tags
    • C-c C-q - :daily:, :monthly:, etc.

I also added tags. I am not sure I will actually use these, but for now, it’ll be something else useful to learn and search by (ideally).

Next steps

  • learn tags, filtering
  • figure out best way to add some custom tags
    • e.g. must-do, professional, product


24 Jun 2019, 22:31

Learning org mode: Session 1

I am spending this week learning org-mode. My motivation is better time tracking.

It’s quite powerful and even the guide is a bit obtuse, so I’m stealing this intro guide, but will be exclusively using keyboard shortcuts as I don’t even see the menu whilst running emacs -nw.

By the end of the week, I’d like to have a custom weekly agenda view, complete with some quotes, that can show my tasks for the week.

You may find this useful if you know a very little bit of emacs (like C-f for opening file type knowledge, nothing too intense). Follow along below.


  • emacs installed
  • org-mode installed

Within emacs

  • C-x C-f to ~/notes/tasks.org to create a file
  • add my example tasks
  • C-c t shifts state: TODO, DONE, normal
  • C-c d opens up calendar to pick due date
    • navigate with shift-arrow
    • . moves to today
    • +1w - one week from today
  • C-c [ - add this to agenda files
    • I am not sure how to cycle these files
  • C-c a - agenda mode
    • a - show weekly agenda
    • RET on item jumps to file

Looks like that’s the end.


I am going to add two items to my agenda, due today:

  • blog post on this, due today
  • figure how sort through agenda list files (no deadline)
  1. C-x b to open buffer
  2. add item 1
  3. C-c t to set TODO
  4. C-c d to set date, RET to set to today
  5. add item 2
  6. C-c t to set DONE on blog post

Next steps

Looks like there’s no more guide left to follow, so I’ll be paving my own road from here on out, barring some inspiration on DDG.

16 May 2019, 18:07

Kubernetes/kubectl crash course - engineering POV

Brain dump of various kubernetes/kubectl things before I forget them all. I’m coming from the deploying analytics side, not the person who sets up kubernetes side, so this will be a list of useful day 1 type stuff for anyone who is learning kubernetes practically via deployments and kubectl.


  • service - something with an IP/hostname you want to hit, e.g. a RESTful front end.
  • deployment - powers a service by specifying things like number of instances, and how ports are shuffled.
  • pods - basic atomic-ish unit that make up a deployment. An instance.

Suppose you want to stand up your RESTful analytic with 8 instances, available at foo.internal.com. Start with a service, then a deployment. Pods come via the deployment.


pacman -S kubectl

Get config file from ops-type person. Put or link in ~/.kube/config, then

kubectl config show

to make sure you’re running with the correct one.

Change contexts, if needed, for various projects.

Basic commands


kubectl get pods
kubectl delete pod ...

You can delete a pod to have K8s immediately kick another one off, useful for getting info about why things aren’t working


kubectl logs pod-name
kubectl logs pod-name --previous

Get logs, or see why app crashed before via --previous. Anything else, you probably need some log aggregation service (Helm/fluentd?)


kubectl deploy -f ./service.yaml
kubectl get services

Deploy services, which are sort of the interface between pods/containers and the rest of the cluster (and outside world).


kubectl deploy -f ./deployment.yaml
kubectl delete deployment your-deployment

Deployments power services by specifying instances and memory, ports, docker images, etc.

Interaction outside cluster

kubectl port-forward services/your-service 8080:8080

Test whether or not your API/service/deployments actually work.

Next up: how Terraform does all this for you.

25 Oct 2018, 21:49

The most important advice for up and coming *nix/BSD administrators

Here is the most important thing that all, new and old *nix/BSD admins should know about administering a machine remotely:

Always run any important administrative operations in a screen session.

Always run any important administrative operations in a screen session.

Always run any important administrative operations in a screen session.

You’re bound to lose internet at the most critical time.

Like when your BSD shell is sitting in vi waiting for you to manually merge in some changes.

Or when you’re arch package upgrades happen to make a destructive change that requires confirmation, but you weren’t paying attention.

Or you’re 4 hours into a huge build and the coffee shop is closing.

Get in the habit of doing screen -D -R any time you log in remotely and want to do administrative work. Put it on a sticky note next to your monitor. You will thank me later.

If you don’t know what screen is, just spend a few minutes learning it, even if you usually use tmux. It’s sort of like vi: the machine you’re working with probably has it by default, unlike tmux (maybe). The sixty seconds it takes to learn the basics are worth it.

01 Jul 2018, 17:03

Starting Over

I’m convinced that the most important skill in life is the ability to start a new skill, hobby, or effort from nothing.

Imagine you’re a native English speaker who wants to learn Amharric. You’re probably unable to verbally communicate with the language. It’s a different alphabet, so writing won’t help. You very well may be the least talented person in this skill in the room. Some may judge you based on your lack of ability instead of a positive bias as an expert in another field. No amount of reasoning, inference, or other parallel skills can help - you just have to sit down and learn. From scratch.

Of course, even experts are constantly being challenged in a somewhat similar if not so extreme manner. This is especially true in fields like technology, where new techs are always outpacing personal growth. But it isn’t limited to tech: business leaders are always, to some extent, growing and adjusting to competitors or other externalities, like loss of funding.

This can be especially tough if your ego doesn’t quite allow it.

Are there any secrets to make it easier? Don’t go too long without a from-scratch effort. The first fall from your level of expertise will be really tough on your ego, but doing it with some frequency will make it seem less painful and more normal. It also helps you appreciate what you do have, and how far you’ve come in your other skill sets.

Of course, this isn’t a prescription for the rest of your life. Without dedicated effort to mastery, you’ll always be sojourning between hobbies, fields, or technologies. But it’s important to keep a balance: don’t allow yourself to be unwilling to try new efforts or explore new ideas, even while striving for mastery in your chosen field.

And remember, you don’t have to attain mastery in this new field. In fact, it might be counterproductive, in terms of efficient use of time, to do so. But do make a habit of challenging yourself, trying things you have no idea how to do.

27 Jun 2018, 22:24

Did X in Y, without Z

Many people reflect positively on things like glide years (a year long-ish trip between jobs, schools, or opportunities), saying: “I had great memories in France, Italty, and Croatia during my 6 month trip”.

What they often leave out is what they had to forsake: training, mentoring, opportunity costs related to finances, building community, networking, and so forth.

It’s critical to understand that everything has an opportunity cost. That includes generating fun memories in foreign countries, which often upon reflection become pure positives, but do have concrete costs. Of course, practical things like language learning are not exempt: becoming a master in golang, or Spanish, means that time is no longer allocated for trying out functional programming, or Portuguese.

When deciding on how to spend the next day, month, year, or other amount of time, try to answer this question before starting:

What will I do (x) in y time? What will I forsake (z)?

This is a good way to frame questions like: Should you do a “glide year”? If so, what should you actually do? Should I quit my job to start my own business?

Or for reflection on the past:

I did x in y [time units]. I had to forsake z.

This provides context for big and small decisions. Watching a 7 hour YouTube movie, for example, may have a significant cost if you’re able to bill $150 per hour to a client.

Of course, this doesn’t mean that decision should be vetoed, but keep in mind opportunity costs when both making and reflecting upon decisions.

25 Jun 2018, 03:17

Your Character Sheet

Imagine for a moment that you’re writing a small document about a fantasy character for a complete stranger, whose purpose is to see how this character you created fits into a fantasy world.

This is largely what I imagine happens in Dungeons and Dragons. The leader of the game, the dungeon master, needs information about the characters playing in order to craft a realistic story. The players must offer up some information, hopefully interesting, about their characters. What makes them unique? Why are they here?

The leader of the game would have trouble adjusting his plot given a character with a lack of purpose. Similarly, without a brief historical background, it’d be difficult to morph the story to this character.

Creating a real-life character sheet seems like a great exercise. It’s like a resume, but for yourself.

You should be able to write down:

  • Purpose
  • Strengths
  • Weaknesses
  • Events that have signficantly shaped your history

All of these seem like reasonable things to both be aware of and frequently remind yourself of. Not only that, but they’re necessary to communicate to others in order to have a meaningful relationship with them. An investor looking for his first engineer likely would not accept “I’m not sure” as a purpose in his character sheet (resume).

Having trouble? Identify what you can do to create your purpose, or find the courage to share your weaknesses and imperfect past. Remind yourself frequently of your strengths. Most importantly, update the document or align yourself when your behavior diverges from it.