Josh Betz

Engineer, Solver of problems, Wisconsin Badger

Biased Algorithms

Biased algorithms and their effects are something I’ve been interested in exploring recently. It’s not a problem with Mathematics or Computer Science per se — humans with implicit bias come to false conclusions all the time. We’re the source of these problematic algorithms after all. The problem is that these bad assumptions can be deployed on a massive scale and aren’t questioned because we think of the math as infallible.

A recent episode of 99% Invisible, The Age of the Algorithm, discusses this topic and gives some examples of where it is having real, negative effects today.

Most recidivism algorithms look at a few types of data — including a person’s record of arrests and convictions and their responses to a questionnaire — then they generate a score. But the questions, about things like whether one grew up in a high-crime neighborhood or have a family member in prison, are in many cases “basically proxies for race and class,” explains O’Neil.

Essentially, any time you use historical data that was effected by a bias to influence the future, you risk perpetuating that bias.

If you’re interested, Cathy O’Neil also wrote a book called Weapons of Math Destruction: How Big Data Increases Inequality and Threatens Democracy.

 

Restless Dream

One of my New Years resolutions was to play more music. I decided it might also be fun to share some of it. I actually learned this song a couple years ago, but it’s one of my favorites. Naturally, a Jack’s Mannequin song — Restless Dream.

New Hyper Key

For quite a while now, I’ve had Caps Lock mapped to Escape. At first it was just out of convenience — as a vim user, I use Escape much more than Caps Lock. With the new MacBook Pro keyboards it’s somewhat of a necessity.

I had a great, but complex, setup that I copied from Brett Terpstra where Caps Lock was Escape if you pressed it by itself, but Control + Option + Command + Shift if you held it down with another key. This worked great for global hotkeys, especially when combined with an app like Snap, because that complex combination of keys is uncommon anywhere else. When Sierra was introduced, the super glue and duct tape fell apart, and the global hotkeys stopped working.

It looks like this was recently fixed with Karabiner Elements though; and it’s much easier now. There are some pre-made rules on the author’s website. I copied the caps lock recipe to GitHub for posterity. After installing Karabiner Elements from Github, you can automatically install the caps lock rules with a specially crafted link:

karabiner://karabiner/assets/complex_modifications/import?url=https://gist.githubusercontent.com/joshbetz/ef03e49e5d45ce34c8e23945260b122c/raw/54b65daa0377083b62a1c8219315457f087f18d8/caps_lock.json

Go Configure

I’ve been dabbling in Golang on and off for a little while now. Recently I was looking for a package to read and parse configuration files with the following requirements in mind:

  1. Be fast.
  2. Use environment variables and JSON files (in that order).
  3. Support hot reloading.

I looked at some of the popular configuration packages, but didn’t see anything that I loved. Many of them don’t meet the requirements I had in mind or are more complex than I’d like.

So, I decided to write config — I know, it’s a great name. It’s pretty simple. We cache values in memory to minimize disk IO. On SIGHUP (or any time you call config.Reload()), we clear the cache, so you can update the configuration without restarting your app.

Usage looks something like this:

There are more examples and details on the API in the README on Github.

If you have questions or ideas, issues and pull requests are welcome on Github. Let me know if you use it!

Writing Mode in Vim

I write quite a lot of Markdown on a daily or weekly basis. From meeting notes to documentation — most of the stuff I write for work that’s not code starts in Markdown. I used to use Byword, but it’s another app to switch between. After the last MacBook refresh, there were a few apps I installed immediately and it has pretty much stayed that way.

I’ve been using Vim to edit Markdown, which is fine, but was missing some things. So, I went hunting for the proper vimscript to enable things like soft line-wrapping and spell check. Needless to say, you can do more than that.

Goyo

One of the first things I found way Goyo. Goyo does “distraction-free writing in Vim” and does most of the work — disabling line numbers, vim-airline, soft-wrapping text at 80 characters, and centering it in the terminal window. You have to enable it with :Goyo after you open Vim, but I always want it enabled when I’m editing Markdown, so I wrote some vimscript:

" Goyo
function! s:auto_goyo()
    if &ft == 'markdown' && winnr('$') == 1
        Goyo 80
    elseif exists('#goyo')
        Goyo!
    endif
endfunction

function! s:goyo_leave()
    if winnr('$') < 2
        silent! :q
    endif
endfunction

augroup goyo_markdown
    autocmd!
    autocmd BufNewFile,BufRead * call s:auto_goyo()
    autocmd! User GoyoLeave nested call goyo_leave()
augroup END

vim-markdown

Next, I installed vim-markdown for syntax highlighting. Since most of my Markdown files have the .md extension, I need to tell Vim to treat them as Markdown.

autocmd BufNewFile,BufReadPost *.md set filetype=markdown

One of the vim-markdown features is to allow highlighting of other languages in code blocks:

let g:markdown_fenced_languages = ['javascript', 'go', 'php']

Spell Check

And, finally, I enabled spell checking in ~/.vim/ftplugin/markdown.vim with:

" Spell check
setlocal spell
highlight clear SpellBad
highlight SpellBad term=standout ctermfg=1 term=underline cterm=underline
Next Page »