A handy class of submodular functions

In this post, we will show that functions of the form

f(X)=1iΩX(1pi)iX(1qi)f(X) = 1 - \prod_{i \in \Omega \setminus X} (1 - p_i) \prod_{i \in X} (1 - q_i)

are submodular for pi,qi[0,1]p_i, q_i \in [0, 1] where each piqi,p_i \leq q_i, and examine an application of this small result that demonstrates its practical value.

Read more →

Recent reading

Finished reading, but still thinking about:

  • 정유정, «종의 기원», a thriller.
  • 김연수, «이토록 평범한 미래», a collection of short stories.
  • 권여선, «레몬», a thriller.
  • 신경숙, «엄마를 부탁해», a classic.
  • Cory Doctorow, The Internet Con: How to Seize the Means of Computation, a tinkerer’s manifesto.
  • Paul Abel, “I thought I wanted to be a professor. Then, I served on a hiring committee.”
  • From the September issue of The Sun, “No Small Wonder” (paywall), an interview with psychologist Dacher Keltner, a student of awe. It pairs nicely with Bewilderment below.

Currently reading:

  • Richard Powers, Bewilderment, a novel of astrobiology, biofeedback, and conservationism.
  • 정유정, «내 심장을 쏴라», a thriller.

Guitarix troubleshooting

For the past few updates of Guitarix, I have been having issues where changing the JACK server latency causes the audio output to go crazy. This seems to stem from changes that the developer has been making to the config files, because the following commands usually get things working again:

mv ~/.config/guitarix ~/.config/guitarix.backup
mkdir ~/.config/guitarix
cp -r ~/.config/guitarix.backup/banks ~/.config/guitarix/banks

These commands backup your amp/effects presets from ~/.config/guitarix/banks (which are the hard part to restore manually), and let the default settings take over the next time the application is launched.

fzl.fish

I’ve been using the following fish alias fzl (“fuzzy list”) to run fzf (“fuzzy find”) in the current directory with a bat preview. It’s just a couple of light tweaks to the examples listed in the fzf README.

~/.config/fish/functions/fzl.fish:

function fzl
    # `bat` is aliased to `batcat` on Debian
    if type -q batcat
        set -f bat_command "batcat"
    else
        set -f bat_command "bat"
    end

    # Set the overall width of the `bat` preview to
    # 50% the width of the current terminal
    set -l bat_width $(math ceil $COLUMNS x 0.5)

    # My preferred `bat` options
    set -f bat_command \
        $bat_command \
        --style numbers \
        --color always \
        --italic-text always \
        --wrap auto \
        --terminal-width $bat_width

    fzf \
        --preview "$bat_command {}" \
        --preview-window right,$bat_width,nowrap
end

Example below.

Read more →

Learning Korean idioms with UNIX fortune

fortune is a classic UNIX program that displays random fortunes, pithy quotes, and the like:

$ fortune
If you think last Tuesday was a drag, wait till you see what happens tomorrow!

Today, I repurposed fortune (really fortune-mod) as a language study tool by scraping some Korean idioms from Wikiquote from Wikiquote):

$ fortune korean
“쇠귀에 경 읽기.”
    아무리 좋은 말을 하면서 가르치려고 하여도 그 뜻을 제대로 헤아리지 못하는 사람을 두고 하는 말.

This one says “Chanting sutras into the ears of a cow,“ defined as “A phrase used when someone fails to understand what you are trying to teach them no matter how well you choose your words.”

I set fortune korean (with some gentle text styling) as my fish greeting, so I can learn a new idiom every time I open a terminal—see below.

Read more →