<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title>beepb00p</title>
    <link>https://beepb00p.xyz</link>
    <description>feed</description>
    <atom:link href="https://beepb00p.xyz/rss.xml" rel="self"/>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>python-feedgen</generator>
    <lastBuildDate>Mon, 22 Feb 2021 00:00:00 +0000</lastBuildDate>
    <item>
      <title>Map of my personal data infrastructure</title>
      <link>https://beepb00p.xyz/myinfra.html</link>
      <description>Sorry, this post contains a huge diagram and isn't RSS friendly. It's best viewed on the website</description>
      <guid isPermaLink="true">https://beepb00p.xyz/myinfra.html</guid>
      <pubDate>Mon, 22 Feb 2021 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Promnesia</title>
      <link>https://beepb00p.xyz/promnesia.html</link>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang="en" prefix="og: http://ogp.me/ns#"&gt;&lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;meta content="width=device-width, initial-scale=1" name="viewport"/&gt;

    &lt;title&gt;Promnesia | beepb00p&lt;/title&gt;
    &lt;link href="https://beepb00p.xyz/promnesia.html" rel="canonical"/&gt;
    &lt;meta content="promnesia pkm" name="keywords"/&gt;
    &lt;!-- TODO concat with keywords tags; also need to make comma separated? --&gt;

    &lt;!-- can test it with https://telegram.me/webpagebot --&gt;
    &lt;!-- or https://developers.facebook.com/tools/debug --&gt;
    &lt;meta content="website" property="og:type"/&gt;
    &lt;meta content="https://beepb00p.xyz/promnesia.html" property="og:url"/&gt; &lt;!-- todo base? --&gt;
    &lt;meta content="Promnesia | beepb00p" property="og:title"/&gt;
    &lt;meta content="A journey in fixing browser history" property="og:description"/&gt;
    &lt;!-- ugh. why is image necessary??? otherwise other parts aren't working or I get lots of 404s --&gt;
    &lt;!-- ugh. Facebook really wants jpg, but whatever --&gt;
    &lt;!-- also Facebook displays it with black background, but whatever, fuck it. --&gt;
    &lt;!-- svg does't work on  --&gt;
    &lt;meta content="https://beepb00p.xyz/assets/favicon.png" property="og:image"/&gt;

    &lt;!-- Icon made by Twitter --&gt;
    &lt;!-- https://twemoji.twitter.com/content/twemoji-twitter/en.html --&gt;
    &lt;!-- todo replace with svg favicon? most browsers support it --&gt;
    &lt;link href="./assets/favicon.png" rel="icon"/&gt;

    &lt;meta content="https://github.com/karlicoss/beepb00p" name="generator"/&gt;
    &lt;meta content="English" name="language"/&gt;

    &lt;!-- TODO get rid of google font. probably Georgia or Garamond? sadly they aren't available in Ubuntu by default.. --&gt;
    &lt;link href="https://fonts.gstatic.com" rel="preconnect"/&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&amp;amp;display=swap" rel="stylesheet"/&gt;

    &lt;link href="./assets/css/default.css" rel="stylesheet"/&gt;
    &lt;!-- TODO make conditional?? --&gt;
    &lt;link href="./assets/css/posts-list.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/links.css" rel="stylesheet"/&gt;

    &lt;!-- &lt;link rel="stylesheet" href="/assets/css/org.css" /&gt; --&gt;
    &lt;link href="./assets/css/htmlize.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-default.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-extra.css" rel="stylesheet"/&gt;
    &lt;script&gt;
    const TID = 'settings-timestamps';
function timestampsCheckbox() {
    return document.getElementById(TID)
}

window.onload = () =&gt; {
    const box = timestampsCheckbox()
    function setState(state) {
        box.checked = state
        const dd = state ? 'initial' : 'none'
        Array.from(document.querySelectorAll('.timestamp-wrapper, .property.CREATED')).map(x =&gt; {
            x.style.display = dd
        })
        localStorage.setItem(TID, JSON.stringify(state))
    }

    let state = localStorage.getItem(TID)
    if (state != null) {
        state = JSON.parse(state)
    } else {
        state = true
    }
    // todo a bit annoying that it glitches this way.. but whatever
    setState(state)
    // user click
    box.addEventListener('change', (event) =&gt; {
        setState(box.checked)
    })
}&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;!-- TODO not sure what to do on mobile devices? --&gt;
    &lt;!-- https://www.gwern.net/ --&gt;
    &lt;!-- could use position: fix so it's displayed  --&gt;
    &lt;div id="settings" style="position:fixed; top: 0; right:0; opacity: 0.3"&gt;
        &lt;!-- TODO headerlinks etc? --&gt;
        settings:
        &lt;div&gt;show timestamps&lt;input id="settings-timestamps" type="checkbox"/&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;nav id="topnav"&gt;
        &lt;a href="./"&gt;Home&lt;/a&gt;
        &lt;a href="./ideas.html"&gt;Ideas&lt;/a&gt;
        &lt;a href="./exobrain"&gt;Exobrain&lt;/a&gt;
        &lt;a href="./tags.html"&gt;Tags&lt;/a&gt;

        &lt;a href="./feed.html" style="margin-left:auto"&gt;Feed&lt;/a&gt;
        &lt;!-- margin-left aligns the rest to the right in flex layout --&gt;
        &lt;a href="./site.html"&gt;Site&lt;/a&gt;
        &lt;a href="./me.html"&gt;Me&lt;/a&gt;

        &lt;span style="font-size: 0.4em;"&gt;
            &lt;a href="https://twitter.com/karlicoss" style="display:block;"&gt;@twitter&lt;/a&gt;
            &lt;a href="https://github.com/karlicoss" style="display:block;"&gt;@github&lt;/a&gt;
        &lt;/span&gt;
    &lt;/nav&gt;

    &lt;!-- main contains the stuff which is not repeated across the site --&gt;
    &lt;main&gt;
        &lt;article&gt;
    
    &lt;section id="post-title"&gt;
    &lt;h1&gt;
        Promnesia
        &lt;a href="./blog-graph.html#promnesia" style="font-size: 1rem;vertical-align: super;" title="See this post within the blog graph, and how it's connected to other posts"&gt;[see within blog graph]&lt;/a&gt;
    &lt;/h1&gt;
    &lt;div class="summary"&gt;A journey in fixing browser history
    &lt;/div&gt;&lt;/section&gt;
    &lt;!-- are sections appropriate for that? --&gt;

    &lt;section id="post-content"&gt;
    &lt;p&gt;
Promnesia is a browser extension (Chrome/Firefox/Firefox mobile) that serves as a web surfing copilot
by enhancing your browsing history, improving your web exploration experience, and integrating with your knowledge base.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="https://github.com/karlicoss/promnesia#readme"&gt;The repository&lt;/a&gt; contains more information about the project and the setup guide, this post is more about the motivation and the story of what led me to work on it.
&lt;/p&gt;
&lt;p&gt;
Also, you can quickly skim through the &lt;a href="https://github.com/karlicoss/promnesia#demos"&gt;demos&lt;/a&gt; first before reading, if you prefer!
&lt;/p&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#singularity_when"&gt;1. I want my singularity!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#what_i_want"&gt;2. Ok, maybe a web assistant at least?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#history_broken"&gt;3. Browser history is broken&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#not_just_browser"&gt;it's not just about web browsers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#siloed"&gt;it's scattered and siloed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#significance"&gt;it's got varying significance&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#urls_broken"&gt;4. URLs are broken&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#prior_art"&gt;5. Prior art&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#prototypes"&gt;Prototypes and mockups&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#google"&gt;Google Activity/Takeout&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#history_extensions"&gt;'Unlimited history' extensions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#histre"&gt;Histre&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#vivaldi"&gt;Vivaldi Browser&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#memacs"&gt;Memacs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#memex_louis"&gt;Memex by Andrew Louis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#worldbrain_memex"&gt;Worldbrain Memex&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#promnesia"&gt;6. Hello, Promnesia!&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#promnesia_goals"&gt;Goals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#promnesia_metagoals"&gt;Meta-goals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#how_does_it_work"&gt;How does it work?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#how_to_use"&gt;7. How can you use Promnesia?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#future"&gt;8. Future of Promnesia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#fin"&gt;9. ---&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="singularity_when"&gt;&lt;a class="headerlink" href="#singularity_when"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; I want my singularity!&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
I was raised on science fiction and grew up dreaming about technology drastically changing our lives.
Artificial intelligence, augmenting the brain with a math co-processor, head-up displays, neural interfaces, having perfect reaction and memory – many of you are on the same page and know the drill.
&lt;/p&gt;
&lt;p&gt;
Years passed, I became a software engineer, and realized just how far we are from all these fancy technologies I wanted.
So my aspirations have become more modest, and I've chosen a more realistic and plausible target:
using my digital trace (such as browser history, webpage annotations and my &lt;a href="./tags.html#exobrain"&gt;personal wiki&lt;/a&gt;) to make up for my limited memory.
&lt;/p&gt;
&lt;p&gt;
I'm exploring lots of information on the Internet, and it feels wasteful to use my &lt;a href="./tags.html#meatsack"&gt;meat resources&lt;/a&gt; to keep track of it.
Meanwhile, web browsers keep a record automatically, without any manual and conscious effort.
Surely we can benefit from the immense computing power and memory capabilities of computers?
&lt;/p&gt;
&lt;p&gt;
So I figured that I wanted:
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="what_i_want"&gt;&lt;a class="headerlink" href="#what_i_want"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; Ok, maybe a web assistant at least?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
A web surfing companion. A copilot.
A &lt;a href="https://en.wikipedia.org/wiki/Memex"&gt;Memex&lt;/a&gt;.
A &lt;a href="http://alumni.media.mit.edu/~rhodes/Papers/remembrance.html"&gt;Remembrance Agent&lt;/a&gt;?
&lt;/p&gt;
&lt;p&gt;
Call it whatever you like, I &lt;i&gt;wish&lt;/i&gt; it were a concept with a widely accepted name. Something that will sit in my browser and:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
aid me with &lt;b&gt;information processing&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Keep track of what I've read, when, on which device, and for how long.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
show me my &lt;b&gt;annotations and highlights&lt;/b&gt;, within the original page
&lt;/p&gt;
&lt;p&gt;
I don't want to keep wondering whether I have my notes and thoughts stashed in some app, I want the computer to let me know instead.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
unify my &lt;b&gt;scattered and siloed bookmarks&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Firefox bookmarks; Reddit/Hackernews saves; "Watch later" on Youtube, saved links in my instant messenger.
&lt;/p&gt;
&lt;p&gt;
These are the same damn thing, yet there is no way to oversee and process them through a single interface.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="https://jborichevskiy.com/posts/digital-tools/#queue-management-for-inbound-digital-content"&gt;"Queue management for inbound digital content"&lt;/a&gt;:
a post expanding further on this idea.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
connect with my online presence: chats and social networks
&lt;/p&gt;
&lt;p&gt;
If I tweeted about a page, surely this should be somehow recorded in the browsing history?
&lt;/p&gt;
&lt;p&gt;
In fact, the page that I bothered to tweet about is &lt;b&gt;much&lt;/b&gt; more important than a page I merely visited in the browser.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
help me explore new information and &lt;b&gt;prioritize&lt;/b&gt; it
&lt;/p&gt;
&lt;p&gt;
There is so much awesome stuff on the Internet! The biggest problem I have is picking the next cool link to dig into.
&lt;/p&gt;
&lt;p&gt;
Imagine if in one click, I could see which of my friends, or the people I follow have read a certain link.
What did they think? Have they posted about it, annotated, or something else? Do they follow the author, perhaps I should too?
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
bridge the gap between the browser and my &lt;a href="./tags.html#exobrain"&gt;personal wiki&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Whatever product I choose for managing my notes: Google Keep, Evernote, Roam Research, or even org-mode files on my disk,
they always end up &lt;b&gt;isolated and disconnected&lt;/b&gt; from my web browsing.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I searched for a system like this &lt;a href="https://twitter.com/karlicoss/status/767412935316611072"&gt;for&lt;/a&gt; several &lt;a href="https://twitter.com/karlicoss/status/896313846159298560"&gt;years&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
After enough failed attempts at finding an &lt;a class="link-down" href="#prior_art"&gt;existing solution&lt;/a&gt;, I figured it was going to be yet another thing I'd have to implement myself.
&lt;/p&gt;
&lt;p&gt;
The journey of building it took longer than I expected, led me through a rabbit hole of &lt;a href="./tags.html#dataliberation"&gt;data liberation&lt;/a&gt;, lots of &lt;a href="https://en.wiktionary.org/wiki/yak_shaving"&gt;yak shaving&lt;/a&gt;,
and made me realize: &lt;b&gt;browser history is very, very broken&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
Note: the next two sections are (somewhat technical) rants. If you prefer a more positive/less boring agenda, feel free to skip them straight to &lt;a class="link-down" href="#prior_art"&gt;"Existing solutions"&lt;/a&gt;
, and you can return back later if you feel like it.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="history_broken"&gt;&lt;a class="headerlink" href="#history_broken"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; Browser history is broken&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
To a large extent, URLs express &lt;b&gt;relationships and hierarchy&lt;/b&gt; between the bits of information. For example:  &lt;code class="inline"&gt;blog &amp;lt;-&amp;gt; post &amp;lt;-&amp;gt; comment&lt;/code&gt;, &lt;code class="inline"&gt;person &amp;lt;-&amp;gt; tweet&lt;/code&gt;, &lt;code class="inline"&gt;playlist &amp;lt;-&amp;gt; video&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
With this information you should be easily able to find everything relevant to the current page and trace your jumps through past websites.
Merely by looking at URLs, without "AI" or some dubious machine learning algorithm!
Seems like a low hanging fruit to harvest, right?
&lt;/p&gt;
&lt;p&gt;
Web browser history is a rich source of potentially useful information.
Just think about it: it's zero effort &lt;a href="./tags.html#lifelogging"&gt;lifelogging&lt;/a&gt;.
It contains exact timestamps and links which &lt;i&gt;basically&lt;/i&gt; address information.
&lt;/p&gt;
&lt;p&gt;
Now think about the experience you actually have. What was the last time you used the browser history in any nontrivial way, for something other than reopening an accidentally closed tab?
&lt;/p&gt;
&lt;p&gt;
Besides:
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="not_just_browser"&gt;&lt;a class="headerlink" href="#not_just_browser"&gt;¶&lt;/a&gt;it's not just about web browsers&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
When you're using a native phone app (say, for Reddit or Twitter), your history either isn't logged anywhere or if it is, it's only stored locally on your phone.

&lt;/span&gt;&lt;aside class="sidenote"&gt;this is why I emphasize &lt;b&gt;browsing&lt;/b&gt; history, not &lt;b&gt;browser&lt;/b&gt; history&lt;/aside&gt;&lt;/div&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
On Android, it's likely to be in an Sqlite database in &lt;code class="inline"&gt;/data/data/app.name&lt;/code&gt;.
This directory is not accessible to normal users &lt;b&gt;unless your phone is rooted&lt;/b&gt;.
Just think about how ridiculous this is. It's &lt;b&gt;your own data&lt;/b&gt;, yet your OS babysits you, preventing access to it.

And yes, I know sandboxing and security are important, but locking my data inside the app is hardly an acceptable tradeoff.
&lt;/span&gt;&lt;aside class="sidenote"&gt;rooting Android phones ranges from "&lt;b&gt;somewhat&lt;/b&gt; painful" to "&lt;b&gt;very&lt;/b&gt; painful"&lt;/aside&gt;&lt;/div&gt;
&lt;p&gt;
As a specific example, the &lt;a href="https://github.com/ccrama/Slide"&gt;Reddit Slide&lt;/a&gt; app keeps your view history in &lt;code class="inline"&gt;/data/data/me.ccrama.redditslide/SEEN&lt;/code&gt;.
Okay, say you root your phone and access the database. Turns out the the app isn't persisting the data forever, it's merely keeping a few weeks' cache.
And I can hardly blame the developer for this: because of the data model, no one expects regular users to access this database.
&lt;/p&gt;
&lt;p&gt;
So if you want your complete history, you have to backup this database regularly, keep the snapshots and &lt;a href="exports.html#synthetic"&gt;somehow&lt;/a&gt;
reconstruct it.
&lt;/p&gt;
&lt;p&gt;
You may dismiss this as nitpicking and obsession over every last bit of my data.
But when &lt;b&gt;all&lt;/b&gt; of your phone apps are doing this you're missing out on quite a lot of useful information.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="siloed"&gt;&lt;a class="headerlink" href="#siloed"&gt;¶&lt;/a&gt;it's scattered and siloed&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Building on the previous point:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;for the most part, you can't access history in your phone apps&lt;/li&gt;
&lt;li&gt;lots of data which &lt;i&gt;ought&lt;/i&gt; to be counted as web history is scattered across silos

&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;in the cloud: behind APIs (best case), GDPR and manual exports (worst case)

It is never easy to get hands on, &lt;i&gt;even&lt;/i&gt; if you're an experienced software engineer.&lt;/span&gt;&lt;aside class="sidenote"&gt;&lt;a href="sad-infra.html"&gt;#sadinfra&lt;/a&gt;&lt;/aside&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
on the filesystem, for example in markdown/org-mode files
&lt;/p&gt;
&lt;p&gt;
A slightly better scenario, but as far as the web browser is concerned, it doesn't make any difference.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Even &lt;i&gt;regular&lt;/i&gt; browser history is not easy to get:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;Firefox &lt;a href="https://support.mozilla.org/en-US/questions/1080942"&gt;used to&lt;/a&gt; silently 'expire' your browser history&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Chrome deletes history older than &lt;a href="https://superuser.com/a/364475/300795"&gt;90 days&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
The only way to access older history I'm aware of is &lt;a href="https://myactivity.google.com"&gt;Google Activity&lt;/a&gt; and Takeout.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Google Takeout &lt;a href="./takeout-data-gone.html"&gt;quietly recycles your history&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Migration is limited to the most popular browsers
&lt;/p&gt;
&lt;p&gt;
The retention limits the migration as well.
E.g. if you migrate from Chrome to Firefox, history older than 90 days is locked and siloed in your Google Account.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
You're going to have a hard time if you're not using Google/Mozilla sync
&lt;/p&gt;
&lt;p&gt;
Your history will be scattered across devices and lost on OS reinstalls.
&lt;/p&gt;
&lt;p&gt;
There are ways of self-hosting Firefox sync, and (&lt;a href="https://superuser.com/questions/614744/how-to-set-up-a-own-chrome-sync-server"&gt;allegedly&lt;/a&gt;) even Chrome sync,
but as you can imagine, is quite tedious.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="significance"&gt;&lt;a class="headerlink" href="#significance"&gt;¶&lt;/a&gt;it's got varying significance&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Not all links in your history are equally important:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;some are clicked on by accident&lt;/li&gt;
&lt;li&gt;some you've just skimmed&lt;/li&gt;
&lt;li&gt;some are on your reading list&lt;/li&gt;
&lt;li&gt;some you've been reading for hours and are full of your highlights and annotations&lt;/li&gt;
&lt;li&gt;some you reference in your knowledge base/personal wiki&lt;/li&gt;
&lt;li&gt;some of them you've shared with others on social media&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The current browser history experience makes no distinction between these scenarios.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="urls_broken"&gt;&lt;a class="headerlink" href="#urls_broken"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; URLs are broken&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
This topic probably deserves a separate post, but I'll keep it section-sized for now.
&lt;/p&gt;
&lt;p&gt;
URLs might seem great because they mostly address content and are semi-descriptive: people &lt;i&gt;try&lt;/i&gt; to keep URLs somewhat reasonable, tidy and working.
But in the real world:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
links &lt;b&gt;rot&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Many URLs are &lt;a href="https://www.gwern.net/Archiving-URLs#link-rot"&gt;&lt;b&gt;literally&lt;/b&gt; broken&lt;/a&gt;.
We're lucky to have &lt;a href="https://web.archive.org"&gt;archive.org&lt;/a&gt;, so you can at least access dead pages.
&lt;/p&gt;
&lt;p&gt;
But there is no way to migrate your browser history, e.g. point old URLs to their respective archive.org entries or a new domain.
Similarly if you had the page annotated, your annotations become orphans without an easy way to relink them.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
links are &lt;b&gt;obfuscated&lt;/b&gt; by shortening and redirects
&lt;/p&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
What happens to all the &lt;code class="inline"&gt;t.co&lt;/code&gt; links when Twitter as a service dies?

&lt;/span&gt;&lt;aside class="sidenote"&gt;see &lt;a href="https://indieweb.org/silo#Linkwrapping"&gt;linkwrapping&lt;/a&gt;&lt;/aside&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
links are &lt;b&gt;obscured&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
There is no easy way to know what's behind &lt;code class="inline"&gt;https://www.instapaper.com/read/1265139707&lt;/code&gt; without querying the Instapaper API.
&lt;/p&gt;
&lt;p&gt;
Relations between data are often obscured as well. For example:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;code class="inline"&gt;https://news.ycombinator.com/item?id=22918980&lt;/code&gt; is a submission link&lt;/li&gt;
&lt;li&gt;&lt;code class="inline"&gt;https://news.ycombinator.com/item?id=22919718&lt;/code&gt; is a comment to that submission&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
These links are clearly related, but there is no way to tell it just from &lt;samp class="inline"&gt;id&lt;/samp&gt;.
&lt;/p&gt;
&lt;p&gt;
Compare this to Reddit links:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;code class="inline"&gt;https://reddit.com/r/orgmode/comments/g6ejwe/is_there_an_orgmode_workbook_tutorial_that_is&lt;/code&gt; is a post link&lt;/li&gt;
&lt;li&gt;&lt;code class="inline"&gt;https://reddit.com/r/orgmode/comments/g6ejwe/is_there_an_orgmode_workbook_tutorial_that_is/fo9qnen&lt;/code&gt; is a comment to that post&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The ids are obscure, but at least we can clearly see the &lt;code class="inline"&gt;post &amp;lt;-&amp;gt; comment&lt;/code&gt; relation merely by looking at the URLs.
Alas, browsers are just ignoring this useful information.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
links are &lt;b&gt;unstandardized&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
For example, &lt;a href="https://en.wikipedia.org/wiki/Query_string"&gt;queries&lt;/a&gt;
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;typically don't point to anything persistent and are used for querying (duh)&lt;/li&gt;
&lt;li&gt;but other times they are used to address information: &lt;code class="inline"&gt;http://wiki.c2.com/?LispLanguage&lt;/code&gt; or &lt;code class="inline"&gt;https://www.scottaaronson.com/blog/?p=2694&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;and in many cases are utter garbage used for &lt;a href="https://en.wikipedia.org/wiki/Query_string#Tracking"&gt;tracking&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The worst part is that these use cases overlap. For example, take a look at &lt;code class="inline"&gt;youtube.com/watch?v=wHrCkyoe72U&amp;amp;feature=share&amp;amp;time_continue=6&lt;/code&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;code class="inline"&gt;v=wHrCkyoe72U&lt;/code&gt; is the most important part of this link&lt;/li&gt;
&lt;li&gt;&lt;code class="inline"&gt;feature=share&lt;/code&gt; is just garbage&lt;/li&gt;
&lt;li&gt;&lt;code class="inline"&gt;time_continue=6&lt;/code&gt; could be treated as useful information&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
A similar story applies to &lt;a href="https://en.wikipedia.org/wiki/Fragment_identifier"&gt;fragments&lt;/a&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;on Google groups, they are meaningful and address specific discussions and messages: &lt;code class="inline"&gt;https://groups.google.com/a/list.hypothes.is/forum/#!topic/dev/kcmS7H8ssis&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;on most websites, they refer to the content within a page: &lt;code class="inline"&gt;https://github.com/lipoja/URLExtract/issues/13#issuecomment-467635302&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;links are &lt;b&gt;unnormalized&lt;/b&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;just think of all the &lt;samp class="inline"&gt;www.&lt;/samp&gt;, &lt;samp class="inline"&gt;amp.&lt;/samp&gt;, &lt;samp class="inline"&gt;mobile.&lt;/samp&gt;, &lt;samp class="inline"&gt;m.&lt;/samp&gt; garbage&lt;/li&gt;
&lt;li&gt;&lt;code class="inline"&gt;youtu.be/1TKSfAkWWN0&lt;/code&gt;, &lt;code class="inline"&gt;youtube.com/embed/1TKSfAkWWN0&lt;/code&gt; and &lt;code class="inline"&gt;https://www.youtube.com/watch?v=1TKSfAkWWN0&amp;amp;list=WL&amp;amp;index=11&lt;/code&gt; refer to the exact same content, yet your browser has no idea.&lt;/li&gt;
&lt;li&gt;&lt;code class="inline"&gt;&amp;lt;link rel="canonical" ...&amp;gt;&lt;/code&gt; &lt;a href="https://en.wikipedia.org/wiki/Canonical_link_element"&gt;element&lt;/a&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;often it's not not present&lt;/li&gt;
&lt;li&gt;when present, often used improperly,&lt;/li&gt;
&lt;li&gt;you need to fetch the page first to get the canonical link&lt;/li&gt;
&lt;li&gt;only works one way; you can't easily retrieve all links that have &lt;b&gt;the same canonical page&lt;/b&gt; as the current&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I want URLs to &lt;b&gt;address information&lt;/b&gt; and &lt;b&gt;represent relations&lt;/b&gt;. The current URL experience is far from ideal for this.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="prior_art"&gt;&lt;a class="headerlink" href="#prior_art"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;5&lt;/span&gt; Prior art&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;span id="existing" style="visibility:hidden"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Sadly, I've seen very few similar projects.
&lt;span style="color:darkorange"&gt;&lt;strong&gt;Please let me know if I missed anything!&lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="prototypes"&gt;&lt;a class="headerlink" href="#prototypes"&gt;¶&lt;/a&gt;Prototypes and mockups&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="http://alumni.media.mit.edu/~rhodes/Papers/mnotes-iui00.html"&gt;"Margin Notes: Building a Contextually Aware Associative Memory"&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
A paper from 2000 (!):
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
Margin Notes is a system that automatically annotates every webpage you visit with links to other potentially useful documents.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
&lt;a href="http://alumni.media.mit.edu/~rhodes/RA/Mnotes"&gt;This page&lt;/a&gt; has more information and
this seems like more of a recommendation system, and I haven't found any source code to check it out.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://docs.google.com/document/d/1QlrVpAl59gmJD7Kl--q3uyfZo936iZIb45fim6EV53k"&gt;Historia&lt;/a&gt; by &lt;a href="https://mek.fyi/#experiments"&gt;Mek&lt;/a&gt;
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
Goal: use a chrome extension to supplement your browsing experience by introducing a superior browsing history data structure:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;preserve provenance. maintain a detailed account of browsing history&lt;/li&gt;
&lt;li&gt;track interactions with dynamic content&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Sadly it's only a concept.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="google"&gt;&lt;a class="headerlink" href="#google"&gt;¶&lt;/a&gt;Google Activity/Takeout&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Though I covered it already, it's worth another mention as many people use it. I find it problematic because:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;it's a Google-specific silo, and the functionality provided by Google is only useful for deliberate searches&lt;/li&gt;
&lt;li&gt;it doesn't have an API, and can't be integrated in the browser&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="history_extensions"&gt;&lt;a class="headerlink" href="#history_extensions"&gt;¶&lt;/a&gt;'Unlimited history' extensions&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
There is a family of Chrome extensions similar to &lt;a href="https://chrome.google.com/webstore/detail/history-trends-unlimited/pnmchffiealhkdloeffcdnbgdnedheme"&gt;History Trends Unlimited&lt;/a&gt;
which try to make up for Chrome's 90-day retention by keeping the history in IndexDB.
Unfortunately, retention is the only problem this solves, and then it it ends up as a yet another silo.
&lt;/p&gt;
&lt;p&gt;
But, thousands of users indicates there is at least demand for such functionality.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="histre"&gt;&lt;a class="headerlink" href="#histre"&gt;¶&lt;/a&gt;&lt;a href="https://histre.com"&gt;Histre&lt;/a&gt;&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Histre is an open source browser extension that presents history as a tree to allow for easier exploration.
I really like the idea, and it's a shame this is not the default representaion in our browsers.
&lt;/p&gt;
&lt;p&gt;
The downside of Histre is that it doesn't integrate with your existing knowledge about the page from other services, so it's a silo in its own regard.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="vivaldi"&gt;&lt;a class="headerlink" href="#vivaldi"&gt;¶&lt;/a&gt;Vivaldi Browser&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Vivaldi has some &lt;a href="https://help.vivaldi.com/article/history"&gt;fresh ideas&lt;/a&gt;, in particular, statistics for browser history and calendar view.
You can also enable infinite retention for the history in the settings.
&lt;/p&gt;
&lt;p&gt;
However you only have access to your history within Vivaldi, and all your other data is left out.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="memacs"&gt;&lt;a class="headerlink" href="#memacs"&gt;¶&lt;/a&gt;Memacs&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;a href="https://github.com/novoid/Memacs#readme"&gt;Memacs&lt;/a&gt; by Karl Voit is a memex software which unifies your data as org-mode, allowing you to query it from within Emacs.
&lt;/p&gt;
&lt;p&gt;
It's excellent as a personal timeline/information search system. However, that means you have to query information &lt;b&gt;actively&lt;/b&gt; in your Emacs, as opposed to a &lt;b&gt;passive&lt;/b&gt; assistant doing it for you.
&lt;/p&gt;
&lt;p&gt;
Having your full detailed history as plaintext is kind of noisy without extra interfaces, and inefficient for long browsing histories with hundreds of thousands of entries.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="memex_louis"&gt;&lt;a class="headerlink" href="#memex_louis"&gt;¶&lt;/a&gt;&lt;a href="https://hyfen.net/memex"&gt;Memex&lt;/a&gt; by Andrew Louis&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
This is a working (but not open-source, at least yet) prototype of a Memex, unifying personal data and exposing an API for it.
&lt;/p&gt;
&lt;p&gt;
I only ran into it a few months ago! Because it's not public, I'm not sure to what extent it can address the browser history problems specifically.
Jumping a bit ahead of myself, I expect it to integrate well with &lt;a class="link-down" href="#promnesia"&gt;Promnesia&lt;/a&gt;, so we could potentially benefit from each other's work.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="worldbrain_memex"&gt;&lt;a class="headerlink" href="#worldbrain_memex"&gt;¶&lt;/a&gt;Worldbrain Memex&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;a href="https://github.com/WorldBrain/Memex#memex-features"&gt;Worldbrain Memex&lt;/a&gt; is a browser extension to annotate, search and organize what you've seen online,
and soon a &lt;a href="https://community.worldbrain.io/t/new-testing-memex-mobile-app-sync/233"&gt;mobile app&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
It's an amazing product: open source, local first, supports tagging, highlights, annotations, and even full-text history search.
By all means, try it!
&lt;/p&gt;
&lt;p&gt;
It would be pretty close to my vision of the personal web assistant if not for a problem: it is also a kind of a silo.
You can import the data from other services into Memex, but then you have to conform to its model of the data.
If for some reason you can't use Memex for annotating and recording your history (e.g. on some of your devices) – you
end up using multiple services, or having redundant (and potentially inconsistent) copies of your data scattered across your digital space.
&lt;/p&gt;
&lt;p&gt;
Having privacy focused and open source tools is a very important step towards a better future.
However, I want a different &lt;b&gt;model&lt;/b&gt; of interacting with my &lt;b&gt;existing&lt;/b&gt; data, which doesn't require moving data in between the silos.
(see &lt;a class="link-up" href="#not_just_browser"&gt;"it's not just about the browser"&lt;/a&gt;)
&lt;/p&gt;
&lt;p&gt;
And jumping ahead again, &lt;a class="link-down" href="#promnesia"&gt;Promnesia&lt;/a&gt; can be integrated with Memex data.
Overall, it seems that our vision is pretty similar, and I &lt;a class="link-down" href="#future"&gt;expect&lt;/a&gt; that both projects can benefit from each other's work,
up to the point that Promnesia extension is sharing the extension/backend with Worldbrain Memex.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="promnesia"&gt;&lt;a class="headerlink" href="#promnesia"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;6&lt;/span&gt; Hello, Promnesia!&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
Ok enough rants! &lt;a href="https://github.com/karlicoss/promnesia"&gt;Promnesia&lt;/a&gt; is the tool I've developed to address some of the issues with the browsing history and URLs.

&lt;/span&gt;&lt;aside class="sidenote"&gt;&lt;span style="color:darkgreen;font-weight:bold"&gt;infrastructure map&lt;/span&gt;: &lt;a href="myinfra.html#promnesia"&gt;promnesia&lt;/a&gt;&lt;/aside&gt;&lt;/div&gt;
&lt;p&gt;
I've already &lt;a class="link-up" href="#what_i_want"&gt;mentioned&lt;/a&gt; what I wanted, but I'll recap:
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="promnesia_goals"&gt;&lt;a class="headerlink" href="#promnesia_goals"&gt;¶&lt;/a&gt;Goals&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
&lt;a class="link-up" href="#history_broken"&gt;make history useful&lt;/a&gt;: unify scattered and siloed history under a single interface
&lt;/p&gt;
&lt;p&gt;
There should be absolutely no difference between a link you opened yesterday in your Instapaper phone app,
and a link you visited in Firefox ten years ago.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-up" href="#urls_broken"&gt;make URLs useful&lt;/a&gt;: make use of their hierarchy and relations between them&lt;/li&gt;
&lt;li&gt;assist me in exploring new information&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
make it possible to easily trace my history
&lt;/p&gt;
&lt;p&gt;
Let me answer when, how, and why did I visit/bookmark the page?
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
integrate metadata: annotations, highlights, notes, chat messages, tweets, etc.
&lt;/p&gt;
&lt;p&gt;
Release it from walled gardens and display it right within the page when applicable (e.g. highlights)
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
make it flexible
&lt;/p&gt;
&lt;p&gt;
As long as it's &lt;i&gt;something&lt;/i&gt; you can extract URLs from, you should be able to feed it in Promnesia.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
A cool thing is that some of these goals weren't clear from the beginning – I discovered them during development,
and I think there are many more I haven't discovered yet!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="promnesia_metagoals"&gt;&lt;a class="headerlink" href="#promnesia_metagoals"&gt;¶&lt;/a&gt;Meta-goals&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
There are also some &lt;b&gt;meta-goals&lt;/b&gt; and principles I'm adhering to:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
make it &lt;b&gt;open source&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
This goes without saying: everything I'm doing for this project is shared and open source.
Frankly, I'm not even sure such a project can be sustainable any other way.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;b&gt;local first&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Your past is sensitive data and you should have control over where you keep it and how you're accessing it.
In the simplest setup, promnesia communicates with your browser through a &lt;b&gt;local&lt;/b&gt; port.
&lt;/p&gt;
&lt;p&gt;
In addition, you have all your data available &lt;a class="post-tag" href="./tags.html#offline"&gt;#offline&lt;/a&gt;.
Modern browsers provide a pretty pathetic offline experience, but if you use a tool similar to &lt;a href="https://github.com/pirate/ArchiveBox"&gt;ArchiveBox&lt;/a&gt;, this can be useful to you.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
make it &lt;b&gt;modular&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Make sure components can be reused.
&lt;/p&gt;
&lt;p&gt;
For the past several months, I've mostly been removing/moving away the code from Promnesia
to make sure that the &lt;a href="https://github.com/karlicoss/HPI"&gt;data processing and normalization code&lt;/a&gt; in it can be used for other purposes by other people.
&lt;/p&gt;
&lt;p&gt;
I'm going to take this even further and explore the potential for interoperability and integration with other open source tools, I'll write about it a bit &lt;a class="link-down" href="#future"&gt;later&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;b&gt;don't build another silo&lt;/b&gt;, use existing information
&lt;/p&gt;
&lt;p&gt;
This kind of complements the previous point.
&lt;/p&gt;
&lt;p&gt;
There are many decent services and tools already. They all have their own &lt;a href="annotating.html#comparison"&gt;pros and cons&lt;/a&gt;.
Different people prefer different tools. Sometimes because they're locked in and don't have much choice,
but other times because they genuinely have subtle preferences and opinions.
&lt;/p&gt;
&lt;p&gt;
The cost of switching is too high, both in terms of the time and the cognitive effort.
There's always the risk of encountering &lt;i&gt;one small thing&lt;/i&gt; that would make the tool a no-go.
&lt;/p&gt;
&lt;p&gt;
We should invest in finding better ways of &lt;b&gt;combining&lt;/b&gt; existing tools, not rewriting all over again.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="how_does_it_work"&gt;&lt;a class="headerlink" href="#how_does_it_work"&gt;¶&lt;/a&gt;How does it work?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Promnesia consists of three parts:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
browser extension
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;neatly displays the history and other information in a sidebar&lt;/li&gt;
&lt;li&gt;handles highlights&lt;/li&gt;
&lt;li&gt;provides search interface&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
However, browser addons can't read access your filesystem, so to load the data we need a helper component:
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
server/backend: &lt;samp class="inline"&gt;promnesia serve&lt;/samp&gt; command
&lt;/p&gt;
&lt;p&gt;
It's called 'server', but really it's just a regular program with the only purpose to serve the data to the browser.
It runs locally and you don't have to expose it to the outside.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
indexer: &lt;samp class="inline"&gt;promensia index&lt;/samp&gt; command
&lt;/p&gt;
&lt;p&gt;
Indexer goes through the sources (specified in the config), processes raw data and extracts URLs along with other useful information.
&lt;/p&gt;
&lt;p&gt;
Another important thing it's doing is &lt;b&gt;normalising&lt;/b&gt; URLs to establish equivalence and stip off garbage.
I write about the motivation for it in &lt;a href="https://beepb00p.xyz/promnesia.html#urls_broken"&gt;"URLs are broken"&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
You might also want to skim through the &lt;a href="https://github.com/karlicoss/promnesia#glossary"&gt;glossary&lt;/a&gt; if you want to understand deeper what information Promnesia is extracting.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="datasources"&gt;&lt;a class="headerlink" href="#datasources"&gt;¶&lt;/a&gt;Data sources&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
Promnesia ships with some builtin sources. It supports:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
data exports from online services: Reddit/Twitter/Hackernews/Telegram/Messenger/Hypothesis/Pocket/Instapaper, etc.
&lt;/p&gt;
&lt;p&gt;
It heavily benefits from &lt;a href="https://github.com/karlicoss/HPI"&gt;HPI&lt;/a&gt; package to access the data.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Google Takeout/Activity backups&lt;/li&gt;
&lt;li&gt;Markdown/org-mode/HTML or any other plaintext on your disk&lt;/li&gt;
&lt;li&gt;in general, anything that can be parsed in some way&lt;/li&gt;
&lt;li&gt;you can also add &lt;a href="https://github.com/karlicoss/promnesia/blob/master/doc/SOURCES.org#extending"&gt;your own custom sources&lt;/a&gt;, Promnesia is extensible&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
See &lt;a href="https://github.com/karlicoss/promnesia/blob/master/doc/SOURCES.org"&gt;SOURCES&lt;/a&gt; for more information.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="dataflow"&gt;&lt;a class="headerlink" href="#dataflow"&gt;¶&lt;/a&gt;Data flow&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
Here's a diagram, which would hopefully help to understand how data flows through Promnesia.
&lt;/p&gt;
&lt;p&gt;
See HPI &lt;a href="https://github.com/karlicoss/HPI/blob/master/doc/SETUP.org#data-flow"&gt;section on data flow&lt;/a&gt; for more information on HPI modules and data flow.
&lt;/p&gt;
&lt;p&gt;
Also check out my &lt;a href="https://beepb00p.xyz/myinfra.html#promnesia"&gt;infrastructure map&lt;/a&gt;, which is more detailed!
&lt;/p&gt;
&lt;pre class="example"&gt;┌─────────────────────────────────┐ ┌────────────────────────────┐ ┌─────────────────┐
│ 💾       HPI sources            │ │  💾    plaintext files      │ │  other sources  │
│ (twitter, reddit, pocket, etc.) │ │ (org-mode, markdown, etc.) │ │ (user-defined)  │
└─────────────────────────────────┘ └────────────────────────────┘ └─────────────────┘
                                ⇘⇘              ⇓⇓               ⇙⇙
                                 ⇘⇘             ⇓⇓              ⇙⇙
                                 ┌──────────────────────────────┐
                                 │ 🔄    promnesia indexer      │
                                 |        (runs regularly)      │
                                 └──────────────────────────────┘
                                                ⇓⇓
                                 ┌──────────────────────────────┐
                                 │ 💾    visits database        │
                                 │       (promnesia.sqlite)     │
                                 └──────────────────────────────┘
                                                ⇓⇓
                                 ┌──────────────────────────────┐
                                 │ 🔗    promnesia server       │
                                 |       (always running)       |
                                 └──────────────────────────────┘
                                                ⇣⇣
                                 ┌─────────────────────────────────┐
         ┌───────────────────────┤  🌐      web browser            ├────────────────────┐
         │  💾 browser bookmarks ⇒      (promnesia extension)      ⇐  💾 browser history |
         └───────────────────────┴─────────────────────────────────┴────────────────────┘
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="how_to_use"&gt;&lt;a class="headerlink" href="#how_to_use"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;7&lt;/span&gt; How can you use Promnesia?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Here I'll describe some specific scenarios for which I find Promnesia extremely useful.
&lt;a href="https://github.com/karlicoss/promnesia#readme"&gt;README&lt;/a&gt; also has screenshots and short screencasts which elaborate on the features.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
Finding new information
&lt;/p&gt;
&lt;p&gt;
Example: I run into an &lt;a href="https://nautil.us/issue/66/clockwork/haunted-by-his-brother-he-revolutionized-physics-rp"&gt;article&lt;/a&gt; on Twitter. I enjoyed it, and the website looks kind of familiar.
&lt;/p&gt;
&lt;p&gt;
When I jump on &lt;a href="https://nautil.us"&gt;https://nautil.us&lt;/a&gt;, the Promnesia sidebar shows me that I've visited and even annotated other articles on this site before!
&lt;/p&gt;
&lt;p&gt;
I am repeatedly stumbling upon this site, and it's got high quality content, so I subscribe to it through my RSS reader.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Exploring people and communities

&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
How often have I engaged with a certain blog in the past?
&lt;/p&gt;
&lt;p&gt;
Which posts have I already seen or read? Did I like them?
Should I dive deeper?
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;Same questions, but for twitter accounts, subreddits, youtube channels or anything similar&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Processing large amounts of information
&lt;/p&gt;
&lt;p&gt;
For example:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://pinboard.in/popular"&gt;Pinboard popular&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://wiki.lesswrong.com/wiki/How_To_Actually_Change_Your_Mind"&gt;link compilations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://posobin.com/hn_classics"&gt;Hackernews 'classics'&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Display annotations and highlights from &lt;b&gt;any&lt;/b&gt; service (e.g. Instapaper/Pocket), within the webpage&lt;/li&gt;
&lt;li&gt;Personal digital archaeology and external memory

&lt;ul class="org-ul"&gt;
&lt;li&gt;Why did I bookmark this youtube video? Who sent it to me?&lt;/li&gt;
&lt;li&gt;How did I get on this forgotten tab?&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
I'm sometimes annoyed by &lt;code class="inline"&gt;@&amp;lt;account&amp;gt;&lt;/code&gt; tweets. Should I unfollow them?
&lt;/p&gt;
&lt;p&gt;
I.e. why did I follow them in the first place? Are they worth following overall? Do I like their tweets often or bookmark their links?
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Integrating with your knowledge base
&lt;/p&gt;
&lt;p&gt;
Promnesia can handle your private wiki whether it's plaintext, or a web service, which would help you instantly find and jump to the relevant information.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Integrating with others' knowledge bases
&lt;/p&gt;
&lt;p&gt;
I find it intriguing to think about this as tapping into each other's brains!
&lt;/p&gt;
&lt;p&gt;
See: &lt;a href="myinfra-roam.html#promnesia"&gt;demo&lt;/a&gt; integrating Promnesia with a Roam Research database.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Unified browser history
&lt;/p&gt;
&lt;p&gt;
I'm listing it last because the benefits of this only become apparent when you start using your data, not while it just sits on your disk.
&lt;/p&gt;
&lt;p&gt;
As you collect more and more detailed history, the whole system becomes more and more useful.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="future"&gt;&lt;a class="headerlink" href="#future"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;8&lt;/span&gt; Future of Promnesia&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Promnesia was a lot of work, especially in terms of sharing it with other people and documenting.
If fact, &lt;b&gt;most writing on my blog have been slowly building up to this post&lt;/b&gt;.
On my &lt;a href="myinfra.html#promnesia"&gt;infrastructure map&lt;/a&gt;, Promnesia is a leaf node!
&lt;/p&gt;
&lt;p&gt;
As much as I am proud of my work, and how rewarding it is when other people find it useful… I'm already thinking how to break Promnesia apart and perhaps even sunset it.
I would be happy if:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;I can raise the demand and awareness for data liberation and interoperability&lt;/li&gt;
&lt;li&gt;I can inspire other people to implement something similar (and better!)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
As I &lt;a class="link-up" href="#promnesia_metagoals"&gt;previously&lt;/a&gt; mentioned, one of the meta-goals is modularity, so parts of Promnesia can be plugged in other tools.
There is still some unused potential for integrating with other open source projects, so I want to take this even further and to the extreme:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
URL indexers/data sources
&lt;/p&gt;
&lt;p&gt;
Promnesia modules are very slim when it comes to the URL extraction, many of them are just 30 lines of code.
Most of the boring and tedious stuff (like data normalization) is encapsulated in &lt;a href="https://github.com/karlicoss/HPI#readme"&gt;HPI&lt;/a&gt; package, which can be used with other tools.
&lt;/p&gt;
&lt;p&gt;
It would be interesting to see if these data sources can be integrated with Worldbrain Memex.
&lt;a class="link-up" href="#worldbrain_memex"&gt;Before&lt;/a&gt; I mentioned that at the moment Memex is a silo, but they also realize it!
Very recently, WorldBrain announced &lt;a href="https://github.com/WorldBrain/storex-hub"&gt;Storex Hub&lt;/a&gt;, which seems like a potential means of integration.
&lt;/p&gt;
&lt;p&gt;
It's likely that Promnesia backend can be rebased on top of it.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
URL normalization algorithm
&lt;/p&gt;
&lt;p&gt;
At the moment, Promnesia uses a &lt;a href="https://github.com/karlicoss/promnesia/blob/master/src/promnesia/cannon.py"&gt;hacky set of rules&lt;/a&gt;, which does the right thing for the most websites I'm using.
However, it's not sustainable for one person to maintain, and it feels worthy of extraction to a separate project/public database.
I imagine it to be something similar to &lt;samp class="inline"&gt;tzdata&lt;/samp&gt;, just think how much frustration we all save by using the same library for timezone information.
&lt;/p&gt;
&lt;p&gt;
This would be something many projects could benefit from: Polar Bookshelf, &lt;a href="https://web.hypothes.is"&gt;Hypothesis&lt;/a&gt;, Worldbrain Memex, and I'm sure there are many more I don't even know of!
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Highlighting and anchoring annotations
&lt;/p&gt;
&lt;p&gt;
One the one hand, even a very primitive algorithm for matching annotations against the page works pretty well in 90% of cases.
On the other hand, the remaining 10% is the bit which is pretty hard to get right, and not an easy task.
&lt;/p&gt;
&lt;p&gt;
It would be cool to reuse &lt;a href="https://web.hypothes.is/blog/fuzzy-anchoring/#a-new-approach"&gt;fuzzy anchoring&lt;/a&gt; by Hypothesis, compare it with whatever Worldbrain is using,
and figure out how much of it is worth sharing. I'd rather help these projects maintain their code, than reinvent my own wheel.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Other features
&lt;/p&gt;
&lt;p&gt;
Again, it feels that most of Promnesia's existing (and future!) features make sense to within Worldbrain Memex, or as plugins.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
As you can see there is some significant overlap with Worldbrain Memex, and they already have a mature and impressive product. So I can see Promnesia as a plugin on top of it, or even as a part of it!
This collaboration is something I'll look at in the near future.
&lt;/p&gt;
&lt;p&gt;
In the meantime, Promnesia is completely usable on its own, and as long as I use it, I'll be supporting it!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="fin"&gt;&lt;a class="headerlink" href="#fin"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;9&lt;/span&gt; ---&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
I've always expected my gadgets to extend my ability to think and process information.
Promnesia is a step I've taken to bring that future closer.
&lt;/p&gt;
&lt;p&gt;
Want to join me? Check out the &lt;a href="https://github.com/karlicoss/promnesia"&gt;repository&lt;/a&gt;, which contains more screenshots, demos, and the setup manual.
&lt;/p&gt;
&lt;p&gt;
If you think of cool features, useful data sources, or any related thoughts feel free to use &lt;a href="https://github.com/karlicoss/promnesia/issues"&gt;github issues&lt;/a&gt;
or reach me by some other means.
&lt;/p&gt;
&lt;p&gt;
Even better if you want to help and contribute!
I'm happy to help you with any Python quirks or web extension specifics.
&lt;/p&gt;
&lt;p&gt;
Related links:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;IndieWeb wiki on &lt;a href="https://indieweb.org/silo"&gt;silos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cloudflare blog: &lt;a href="https://blog.cloudflare.com/the-history-of-the-url"&gt;The History of the URL&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://utcc.utoronto.ca/~cks/space/blog/web/URLSAreTerriblePermanentIDs"&gt;"URLs are terrible permanent identifiers for things"&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://news.ycombinator.com/item?id=23227186"&gt;HN: WorldBrain's Memex: Bookmarking for the power users of the web&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="hpi.html"&gt;Human Programming Interface&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="sad-infra.html"&gt;The sad state of personal data and infrastructure&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;Credits:&lt;/b&gt; thanks to &lt;a href="https://jborichevskiy.com/about"&gt;Jonathan&lt;/a&gt;, &lt;a href="http://awesomesauce.name"&gt;Andrew&lt;/a&gt; and &lt;a href="https://petr-tik.github.io"&gt;Petr&lt;/a&gt; for the valuable feedback on the post.
Thanks to &lt;a href="https://twitter.com/_bepolymathe_"&gt;Emmanuel&lt;/a&gt; for trying out the project and suggestions on making it easier to set up!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    &lt;/section&gt;

    
    &lt;section id="post-footer"&gt;
        &lt;div class="post-tags"&gt;
            &lt;a class="post-tag tag-inactive" href="./tags.html"&gt;#promnesia&lt;/a&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#pkm"&gt;#pkm&lt;/a&gt;
        &lt;/div&gt;
        &lt;time datetime="2020-05-30T00:00:00"&gt;30 May 2020&lt;/time&gt;
    &lt;/section&gt;
    

    

    &lt;section id="post-comments"&gt;
    &lt;script data-isso="https://beepb00p.xyz/comments/" data-isso-reply-to-self="true" src="https://beepb00p.xyz/comments/js/embed.min.js"&gt;
&lt;/script&gt;

&lt;section data-isso-id="isso_promnesia" id="isso-thread"&gt;&lt;/section&gt;
    &lt;/section&gt;
&lt;/article&gt;
    &lt;/main&gt;

    &lt;footer id="bottomfooter"&gt;
        &lt;a href="https://twitter.com/karlicoss"&gt;🐦 me @twitter&lt;/a&gt;
        &lt;a href="https://github.com/karlicoss"&gt;💻 me @github&lt;/a&gt;
        &lt;a href="http://creativecommons.org/licenses/by/4.0" style="margin-left:auto"&gt;CC BY 4.0&lt;/a&gt;&lt;/footer&gt;

&lt;/body&gt;&lt;/html&gt;</description>
      <guid isPermaLink="true">https://beepb00p.xyz/promnesia.html</guid>
      <pubDate>Sat, 30 May 2020 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Extending my personal infrastructure with a data source</title>
      <link>https://beepb00p.xyz/myinfra-roam.html</link>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang="en" prefix="og: http://ogp.me/ns#"&gt;&lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;meta content="width=device-width, initial-scale=1" name="viewport"/&gt;

    &lt;title&gt;Extending my personal infrastructure with a data source | beepb00p&lt;/title&gt;
    &lt;link href="https://beepb00p.xyz/myinfra-roam.html" rel="canonical"/&gt;
    &lt;meta content="infra hpi orger promnesia" name="keywords"/&gt;
    &lt;!-- TODO concat with keywords tags; also need to make comma separated? --&gt;

    &lt;!-- can test it with https://telegram.me/webpagebot --&gt;
    &lt;!-- or https://developers.facebook.com/tools/debug --&gt;
    &lt;meta content="website" property="og:type"/&gt;
    &lt;meta content="https://beepb00p.xyz/myinfra-roam.html" property="og:url"/&gt; &lt;!-- todo base? --&gt;
    &lt;meta content="Extending my personal infrastructure with a data source | beepb00p" property="og:title"/&gt;
    &lt;meta content="Featuring Roam Research" property="og:description"/&gt;
    &lt;!-- ugh. why is image necessary??? otherwise other parts aren't working or I get lots of 404s --&gt;
    &lt;!-- ugh. Facebook really wants jpg, but whatever --&gt;
    &lt;!-- also Facebook displays it with black background, but whatever, fuck it. --&gt;
    &lt;!-- svg does't work on  --&gt;
    &lt;meta content="https://beepb00p.xyz/assets/favicon.png" property="og:image"/&gt;

    &lt;!-- Icon made by Twitter --&gt;
    &lt;!-- https://twemoji.twitter.com/content/twemoji-twitter/en.html --&gt;
    &lt;!-- todo replace with svg favicon? most browsers support it --&gt;
    &lt;link href="./assets/favicon.png" rel="icon"/&gt;

    &lt;meta content="https://github.com/karlicoss/beepb00p" name="generator"/&gt;
    &lt;meta content="English" name="language"/&gt;

    &lt;!-- TODO get rid of google font. probably Georgia or Garamond? sadly they aren't available in Ubuntu by default.. --&gt;
    &lt;link href="https://fonts.gstatic.com" rel="preconnect"/&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&amp;amp;display=swap" rel="stylesheet"/&gt;

    &lt;link href="./assets/css/default.css" rel="stylesheet"/&gt;
    &lt;!-- TODO make conditional?? --&gt;
    &lt;link href="./assets/css/posts-list.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/links.css" rel="stylesheet"/&gt;

    &lt;!-- &lt;link rel="stylesheet" href="/assets/css/org.css" /&gt; --&gt;
    &lt;link href="./assets/css/htmlize.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-default.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-extra.css" rel="stylesheet"/&gt;
    &lt;script&gt;
    const TID = 'settings-timestamps';
function timestampsCheckbox() {
    return document.getElementById(TID)
}

window.onload = () =&gt; {
    const box = timestampsCheckbox()
    function setState(state) {
        box.checked = state
        const dd = state ? 'initial' : 'none'
        Array.from(document.querySelectorAll('.timestamp-wrapper, .property.CREATED')).map(x =&gt; {
            x.style.display = dd
        })
        localStorage.setItem(TID, JSON.stringify(state))
    }

    let state = localStorage.getItem(TID)
    if (state != null) {
        state = JSON.parse(state)
    } else {
        state = true
    }
    // todo a bit annoying that it glitches this way.. but whatever
    setState(state)
    // user click
    box.addEventListener('change', (event) =&gt; {
        setState(box.checked)
    })
}&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;!-- TODO not sure what to do on mobile devices? --&gt;
    &lt;!-- https://www.gwern.net/ --&gt;
    &lt;!-- could use position: fix so it's displayed  --&gt;
    &lt;div id="settings" style="position:fixed; top: 0; right:0; opacity: 0.3"&gt;
        &lt;!-- TODO headerlinks etc? --&gt;
        settings:
        &lt;div&gt;show timestamps&lt;input id="settings-timestamps" type="checkbox"/&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;nav id="topnav"&gt;
        &lt;a href="./"&gt;Home&lt;/a&gt;
        &lt;a href="./ideas.html"&gt;Ideas&lt;/a&gt;
        &lt;a href="./exobrain"&gt;Exobrain&lt;/a&gt;
        &lt;a href="./tags.html"&gt;Tags&lt;/a&gt;

        &lt;a href="./feed.html" style="margin-left:auto"&gt;Feed&lt;/a&gt;
        &lt;!-- margin-left aligns the rest to the right in flex layout --&gt;
        &lt;a href="./site.html"&gt;Site&lt;/a&gt;
        &lt;a href="./me.html"&gt;Me&lt;/a&gt;

        &lt;span style="font-size: 0.4em;"&gt;
            &lt;a href="https://twitter.com/karlicoss" style="display:block;"&gt;@twitter&lt;/a&gt;
            &lt;a href="https://github.com/karlicoss" style="display:block;"&gt;@github&lt;/a&gt;
        &lt;/span&gt;
    &lt;/nav&gt;

    &lt;!-- main contains the stuff which is not repeated across the site --&gt;
    &lt;main&gt;
        &lt;article&gt;
    
    &lt;section id="post-title"&gt;
    &lt;h1&gt;
        Extending my personal infrastructure with a data source
        &lt;a href="./blog-graph.html#myinfra_roam" style="font-size: 1rem;vertical-align: super;" title="See this post within the blog graph, and how it's connected to other posts"&gt;[see within blog graph]&lt;/a&gt;
    &lt;/h1&gt;
    &lt;div class="summary"&gt;Featuring Roam Research
    &lt;/div&gt;&lt;/section&gt;
    &lt;!-- are sections appropriate for that? --&gt;

    &lt;section id="post-content"&gt;
    &lt;p&gt;
I have a &lt;a href="sad-infra.html"&gt;frustration&lt;/a&gt; around the fact that our personal data is scattered, siloed and incredibly hard
to use for any purposes, not anticipated by the original developers.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="my-data.html"&gt;One of my big efforts&lt;/a&gt; is unifying all of this scattered data into a system that makes it easier
to oversee, combine, interact with and build &lt;b&gt;new tools&lt;/b&gt; around it.
&lt;/p&gt;
&lt;p&gt;
In this post I want to illustrate how to integrate a new data source in the system, with &lt;a href="https://roamresearch.com"&gt;Roam Research&lt;/a&gt; data as an example.
&lt;/p&gt;
&lt;p&gt;
I've chosen Roam for this post because:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;it's a cool, useful and rich data source&lt;/li&gt;
&lt;li&gt;it hasn't been integrated before &lt;a href="myinfra.html"&gt;in my system&lt;/a&gt;, so it's easy to follow and document all the steps necessary&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Throughout the post, I will link to my previous writing on building the &lt;a class="post-tag" href="./tags.html#infra"&gt;#infra&lt;/a&gt;, so I won't go into explaining every tiny detail and technical rationales here.
But if you have some questions, feel free to ask anyway!
&lt;/p&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#what_is_roam"&gt;1. What is Roam Research?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#export"&gt;2. Export raw data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#automate"&gt;3. Automate export&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#dal"&gt;4. Adapt the data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#orger"&gt;5. Use Orger for org-mode mirror&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#promnesia"&gt;6. Promnesia: integrate Roam with your browser&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#fin"&gt;7. --&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="what_is_roam"&gt;&lt;a class="headerlink" href="#what_is_roam"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; What is Roam Research?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;a href="https://roamresearch.com"&gt;Roam&lt;/a&gt; is a new note taking/thinking tool.
If you're an org-mode user, you can think of it as having a web app with a directory of org files with the main focus (as I see it) on:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;easy note capture&lt;/li&gt;
&lt;li&gt;markup and &lt;a href="https://orgmode.org/manual/Internal-Links.html"&gt;internal links&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://roamresearch.com/#/app/help/page/ihYVODd74"&gt;bidirectional links&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
This is pretty unique to Roam, and the nearest org-mode analogy is probably tags or &lt;a href="https://orgmode.org/manual/Custom-Agenda-Views.html"&gt;custom agendas&lt;/a&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
You can learn more about Roam &lt;a href="https://roamresearch.com/#/app/help/page/1wnq-ZAAN"&gt;here&lt;/a&gt;, which is a welcome page and a sandbox at the same time (very cool!).
&lt;/p&gt;
&lt;p&gt;
If you want to get a glimpse of Org-mode &lt;b&gt;workflow&lt;/b&gt; without having to use Emacs, Roam is probably &lt;b&gt;the&lt;/b&gt; tool you should try.
&lt;/p&gt;
&lt;p&gt;
So, let's say you've been using Roam and want to use its data outside of the web app, for some other purpose. What do you do?
&lt;/p&gt;
&lt;p&gt;
For this demo, I'll be using a &lt;b&gt;public&lt;/b&gt; &lt;a href="https://roamresearch.com/#/app/covid19/graph"&gt;covid19 Roam database&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="export"&gt;&lt;a class="headerlink" href="#export"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; Export raw data&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
The first step is figuring out how to get the raw data.
&lt;/p&gt;
&lt;p&gt;
Roam doesn't have a public API yet, but they let you export a JSON from the web interface, which is good enough for us.
How to proceed with this knowledge? I apply the principles from &lt;a href="exports.html#export_layer"&gt;"Building data liberation infrastructure"&lt;/a&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
use an existing library to fetch the data
&lt;/p&gt;
&lt;p&gt;
It is &lt;b&gt;counterproductive&lt;/b&gt; to reimplement this all over again.
Luckily, there is one, &lt;a href="https://github.com/MatthieuBizien/roam-to-git"&gt;MatthieuBizien/roam-to-git&lt;/a&gt;! It's very decent and does all the heavy lifting like browser automation.
&lt;/p&gt;
&lt;p&gt;
The only thing I had to do is implementing a &lt;a href="https://github.com/karlicoss/exports/blob/master/roamresearch.py"&gt;wrapper&lt;/a&gt; to call it and extract the JSON from the archive.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
keep the raw data intact
&lt;/p&gt;
&lt;p&gt;
I simply store the &lt;b&gt;JSON without any changes&lt;/b&gt; on my filesystem.
There is not much point trying to squeeze inherently hierarchical Roam data into a database.
If performance ever becomes an issue, a transparent &lt;a href="unnecessary-db.html#cachew"&gt;caching layer&lt;/a&gt; can always be added.
&lt;/p&gt;
&lt;p&gt;
Roam is under active development, so it's likely that the export format will change.
It would be pretty sad if it breaks exports, and keeping the data unchanged means I always have a recent version on my disk.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="automate"&gt;&lt;a class="headerlink" href="#automate"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; Automate export&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Ok, now we can get a snapshot of Roam data with a single script run: &lt;code class="inline"&gt;./roamresearch.py &amp;gt; export.json&lt;/code&gt;. What's next?
&lt;/p&gt;
&lt;p&gt;
The idea is that we run it &lt;b&gt;periodically&lt;/b&gt;, for example, few times a day. It does mean that the data on your disk is lagging behind slightly, but that gives you 90% of the benefits without all the downsides of
implementing a realtime synchronization. You also need an API for two-way synchronization anyway (unless you want to poll the service like crazy).
&lt;/p&gt;
&lt;p&gt;
Running it manually is not much fun, and there are several tools that can aid us in it.
I've done an overview in &lt;a href="scheduler.html"&gt;this post&lt;/a&gt;, and personally, I'm using an experimental tool, &lt;a href="https://github.com/karlicoss/dron"&gt;dron&lt;/a&gt;, which is basically a nice Systemd frontend.
But it really doesn't matter what exactly to use, so the simplest is a good old &lt;b&gt;cron job&lt;/b&gt;:
&lt;/p&gt;
&lt;pre class="example"&gt;00 05 * * * /soft/export-scripts/roamresearch.py &amp;gt; /exports/roamresearch/data.json
&lt;/pre&gt;
&lt;p&gt;
This will export your data every day at 5:00 and save it to a JSON file. The file will be used by other tools and scripts to get &lt;b&gt;the most recent snapshot&lt;/b&gt; of the data.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
For me the command looks a bit more sophisticated:
&lt;/p&gt;
&lt;pre class="example"&gt;/soft/arctee/arctee.py /exports/roamresearch/roamresearch_{utcnow}.json -- /soft/export-scripts/roamresearch.py
&lt;/pre&gt;
&lt;p&gt;
This keeps every export along with a timestamp, ensures atomic writing to minimize concurrency issues and retries automatically.
I elaborate more on it &lt;a href="exports.html#arctee"&gt;here&lt;/a&gt;, but it's not super crucial for Roam, more of a nice-to-have thing.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Once you automate JSON exports, you also get Roam &lt;b&gt;data backups for free&lt;/b&gt; (you back up your disk, right?).
&lt;/p&gt;
&lt;p&gt;
There is a problem though. Working with JSON is okay for a one-off thing, but if you want to truly benefit from using the data for different applications, you better off having some abstract interface
for it.
While Roam's JSON export is fairly reasonable (unlike many other services), it's pretty annoying to figure out the schema
&lt;/p&gt;
&lt;p&gt;
Take a look at the &lt;a href="https://github.com/MatthieuBizien/roam-to-git-demo/blob/27e5fdace2de47dd810caa10e7fb366a8c661a57/json/roam-to-git-demo.json#L123-L143"&gt;raw data&lt;/a&gt;. It's clear, that you'll need
(at least) to:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;convert integer timestamps into datetime objects&lt;/li&gt;
&lt;li&gt;keep track of optional and required fields&lt;/li&gt;
&lt;li&gt;deconstruct the hierarchy&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
This is annoying, boring and error-prone to do all over again.
We need some central way to encapsulate and adapt raw JSON data for easier programmatic use.
Say hello to the &lt;a href="exports.html#dal"&gt;data access layer&lt;/a&gt;!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="dal"&gt;&lt;a class="headerlink" href="#dal"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; Adapt the data&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
The data access layer is responsible for deserializing and converting raw (i.e. JSON/sqlite) format into abstract objects, easy to work in your code.
&lt;/p&gt;
&lt;p&gt;
Normally I'd try to use existing data bindings, but Roam is pretty new and I haven't found any, so I implemented my own.
The data adapter is integrated into &lt;a href="https://github.com/karlicoss/HPI"&gt;HPI&lt;/a&gt; package, which is a central entry point for all of my data access.
&lt;/p&gt;
&lt;p&gt;
The whole thing is contained within a single &lt;a href="https://github.com/karlicoss/HPI/pull/26/files"&gt;pull request&lt;/a&gt; and takes about 100 LOC.
&lt;/p&gt;
&lt;p&gt;
If you browse through the code you can also see the importance of raw data encapsulation: for example,
&lt;a href="https://github.com/karlicoss/HPI/blob/96a850faf94c781be2fdc24f01699cba9edf580e/my/roamresearch.py#L36-L54"&gt;&lt;code class="inline"&gt;created&lt;/code&gt;&lt;/a&gt; or
&lt;a href="https://github.com/karlicoss/HPI/blob/96a850faf94c781be2fdc24f01699cba9edf580e/my/roamresearch.py#L75-L82"&gt;&lt;code class="inline"&gt;permalink&lt;/code&gt;&lt;/a&gt; properties.
You really don't want to reimplement this all over again.
&lt;/p&gt;
&lt;p&gt;
To link HPI package with your private data, you add a small section to your private config in &lt;samp class="inline"&gt;~/.config/my/my/config/__init__.py&lt;/samp&gt;:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;class&lt;/span&gt; &lt;span class="org-type"&gt;roamresearch&lt;/span&gt;:
    &lt;span class="org-variable-name"&gt;export_path&lt;/span&gt; = &lt;span class="org-string"&gt;'/exports/roamresearch/'&lt;/span&gt;
    &lt;span class="org-variable-name"&gt;username&lt;/span&gt; = &lt;span class="org-string"&gt;'covid19'&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
After this, you get IDE help when working with Roam data. For example, &lt;samp class="inline"&gt;mypy&lt;/samp&gt; will remind me that &lt;samp class="inline"&gt;title&lt;/samp&gt; is optional, so I won't have &lt;samp class="inline"&gt;None&lt;/samp&gt; related issues.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="interactive"&gt;&lt;a class="headerlink" href="#interactive"&gt;¶&lt;/a&gt;Interactive queries&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
At this stage, you can play with the data &lt;b&gt;interactively&lt;/b&gt; in your Python interpreter. For example:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
"what's the most active note in my database?"
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;import&lt;/span&gt; my.roamresearch &lt;span class="org-keyword"&gt;as&lt;/span&gt; RR
&lt;span class="org-variable-name"&gt;roam&lt;/span&gt; = RR.roam()
&lt;span class="org-variable-name"&gt;note&lt;/span&gt; = &lt;span class="org-builtin"&gt;max&lt;/span&gt;(roam.notes, key=&lt;span class="org-keyword"&gt;lambda&lt;/span&gt; n: &lt;span class="org-builtin"&gt;len&lt;/span&gt;(n.children))
&lt;span class="org-keyword"&gt;print&lt;/span&gt;(note)
&lt;/pre&gt;
&lt;/div&gt;
&lt;pre class="example"&gt;Node(created=2020-02-27 02:29:22.725000+00:00, title=Worst-Case Scenario Planning, body=None)
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
"what's the most 'dangling' link in my database"
&lt;/p&gt;
&lt;p&gt;
This could be useful to organize it, and fill frequently occurring references with more context.
&lt;/p&gt;
&lt;p&gt;
The code is very straightforward:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;import&lt;/span&gt; my.roamresearch &lt;span class="org-keyword"&gt;as&lt;/span&gt; RR
&lt;span class="org-variable-name"&gt;roam&lt;/span&gt; = RR.roam()

&lt;span class="org-keyword"&gt;import&lt;/span&gt; re
&lt;span class="org-keyword"&gt;def&lt;/span&gt; &lt;span class="org-function-name"&gt;all_internal_links&lt;/span&gt;():
    &lt;span class="org-keyword"&gt;for&lt;/span&gt; note &lt;span class="org-keyword"&gt;in&lt;/span&gt; roam.traverse(): &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;go recursively through all Roam outlines&lt;/span&gt;
        &lt;span class="org-variable-name"&gt;links&lt;/span&gt; = re.findall(r&lt;span class="org-string"&gt;'\[\[(.*?)\]\]'&lt;/span&gt;, note.body &lt;span class="org-keyword"&gt;or&lt;/span&gt; &lt;span class="org-string"&gt;''&lt;/span&gt;) &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;extract the [[links]]&lt;/span&gt;
        &lt;span class="org-keyword"&gt;yield&lt;/span&gt; &lt;span class="org-keyword"&gt;from&lt;/span&gt; links

&lt;span class="org-variable-name"&gt;existing&lt;/span&gt; = { &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;figure out which links already have meaningful pages for them&lt;/span&gt;
    n.title &lt;span class="org-keyword"&gt;for&lt;/span&gt; n &lt;span class="org-keyword"&gt;in&lt;/span&gt; roam.traverse()
    &lt;span class="org-keyword"&gt;if&lt;/span&gt; &lt;span class="org-keyword"&gt;not&lt;/span&gt; n.empty()
}
&lt;span class="org-variable-name"&gt;missing&lt;/span&gt; = [
    link &lt;span class="org-keyword"&gt;for&lt;/span&gt; link &lt;span class="org-keyword"&gt;in&lt;/span&gt; all_internal_links()
    &lt;span class="org-keyword"&gt;if&lt;/span&gt; link &lt;span class="org-keyword"&gt;not&lt;/span&gt; &lt;span class="org-keyword"&gt;in&lt;/span&gt; existing
]

&lt;span class="org-keyword"&gt;from&lt;/span&gt; collections &lt;span class="org-keyword"&gt;import&lt;/span&gt; Counter
&lt;span class="org-keyword"&gt;print&lt;/span&gt;(Counter(missing).most_common(5))
&lt;/pre&gt;
&lt;/div&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-left"/&gt;
&lt;col class="org-right"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;slider&lt;/td&gt;
&lt;td class="org-right"&gt;22&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;China&lt;/td&gt;
&lt;td class="org-right"&gt;12&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;Open Questions&lt;/td&gt;
&lt;td class="org-right"&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;Travel&lt;/td&gt;
&lt;td class="org-right"&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;COVID-19&lt;/td&gt;
&lt;td class="org-right"&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
&lt;samp class="inline"&gt;[[slider]]&lt;/samp&gt; is a just a parsing artifact, but you can see that perhaps it's a good time to add some content on the "China" page!
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
This is cool because you don't have to wait till developers add new features or come up with a query language (which is also really hard!).
You can use a powerful programming language you already know.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="orger"&gt;&lt;a class="headerlink" href="#orger"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;5&lt;/span&gt; Use Orger for org-mode mirror&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Now that accessing the data is a matter of &lt;code class="inline"&gt;import my.roamresearch&lt;/code&gt;, we can enjoy using it!
&lt;/p&gt;
&lt;p&gt;
One very useful tool for interacting with my data is &lt;a href="orger.html"&gt;Orger&lt;/a&gt;.
Orger is a library that helps you generate an org-mode representation of your data.
&lt;/p&gt;
&lt;p&gt;
I won't go into the Orger module implementation details – you can check out the code here: &lt;a href="https://github.com/karlicoss/orger/blob/master/modules/roamresearch.py"&gt;&lt;code class="inline"&gt;roamresearch.py&lt;/code&gt;&lt;/a&gt;.
There are also &lt;a href="https://github.com/karlicoss/orger/blob/master/modules"&gt;more&lt;/a&gt; modules for other services like Twitter, Reddit, Instapaper, etc.
&lt;/p&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
We will use Orger to generate a &lt;b&gt;read-only&lt;/b&gt; mirror of the Roam &lt;a href="https://roamresearch.com/#/app/covid19/graph"&gt;database&lt;/a&gt;.
The idea is that you run Orger script periodically to get a reasonably up-to-date representation of your Roam data.
You'll still use Roam web app to modify your notes.

&lt;/span&gt;&lt;aside class="sidenote"&gt;note, this makes it different from what &lt;a href="https://github.com/jethrokuan/org-roam"&gt;org-roam&lt;/a&gt; offers&lt;/aside&gt;&lt;/div&gt;
&lt;p&gt;
Of course, it would be cool to have proper bidirectional sync, so your modifications to the org-mode file are reflected in Roam.
But it's a &lt;b&gt;much&lt;/b&gt; harder problem, especially without an API.
&lt;/p&gt;
&lt;p&gt;
But even having a read-only replica enables you to do lots of cool things!
I invite you to &lt;a href="https://www.youtube.com/watch?v=ib_PDJpTh-Q"&gt;watch a short &lt;b&gt;demo&lt;/b&gt;&lt;/a&gt; I recorded, and I'll highlight some features here in writing.
&lt;/p&gt;
&lt;p&gt;
You benefit from &lt;b&gt;the existing infrastructure and tooling&lt;/b&gt; around org-mode:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
the org-mode markup and text editor integration
&lt;/p&gt;
&lt;p&gt;
Roam markup maps naturally into org-mode (perhaps not very surprising).
&lt;/p&gt;
&lt;p&gt;
So you can use outlines/colors/bold/italic/linka/code blocks/whatnot. As a bonus, you get all the associated Emacs customizations.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
the Emacs navigation features
&lt;/p&gt;
&lt;p&gt;
You can use your favorite keybindings &lt;b&gt;with no need to learn new hotkeys&lt;/b&gt; hardcoded by the developers. For example:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;editor specific: with &lt;samp class="inline"&gt;evil-mode&lt;/samp&gt; you can just use Vim navigation (&lt;code class="inline"&gt;hjkl&lt;/code&gt; , &lt;code class="inline"&gt;$&lt;/code&gt; / &lt;code class="inline"&gt;w&lt;/code&gt; / &lt;code class="inline"&gt;b&lt;/code&gt; / etc.)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
org-mode specific: folding/unfolding (&lt;code class="inline"&gt;Shift+Tab/Tab&lt;/code&gt;), outline navigation (&lt;code class="inline"&gt;{&lt;/code&gt; , &lt;code class="inline"&gt;}&lt;/code&gt;), jumping to the heading (&lt;code class="inline"&gt;gh&lt;/code&gt;)
&lt;/p&gt;
&lt;p&gt;
Again, if you're an &lt;samp class="inline"&gt;evil&lt;/samp&gt; person, just check out &lt;a href="https://github.com/Somelauw/evil-org-mode/blob/master/doc/keythemes.org"&gt;&lt;samp class="inline"&gt;evil-org-mode&lt;/samp&gt;&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Link navigation: you can use &lt;a href="https://github.com/noctuid/link-hint.el#readme"&gt;link-hint&lt;/a&gt; to quickly navigate links with your keyboard (&lt;code class="inline"&gt;SPC s l&lt;/code&gt; in Doom Emacs)
&lt;/p&gt;
&lt;p&gt;
This is similar to web browser extensions like vimperator,
&lt;a href="https://www.pakstech.com/blog/browse-web-with-keyboard/#tridactyl"&gt;Tridactyl&lt;/a&gt; and
&lt;a href="https://www.pakstech.com/blog/browse-web-with-keyboard/#surfingkeys"&gt;Surfingkeys&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Navigating in your text editor is very fast and you never experience network latency or backend hiccups.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;if you need to edit the notes, you can jump back into the Roam web interface by following the permalink&lt;/li&gt;
&lt;li&gt;&lt;code class="inline"&gt;[[Internal Links]]&lt;/code&gt; in Roam also have first-class support in org-mode, so you can jump within the file&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
the Emacs search modules
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;regular plaintext search (&lt;code class="inline"&gt;/&lt;/code&gt; if you're a Vim person)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;samp class="inline"&gt;helm-swoop&lt;/samp&gt;: shows you the search results &lt;b&gt;and&lt;/b&gt;  the context in which each result occurred.
&lt;/p&gt;
&lt;p&gt;
It's probably easier if you check out the &lt;a href="https://github.com/emacsorphanage/helm-swoop#readme"&gt;demo gif&lt;/a&gt; than to put it in words.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;samp class="inline"&gt;helm-ripgrep&lt;/samp&gt;: I'm using it for a global incremental search (a &lt;a href="pkm-search.html#snippet_other"&gt;single keybinding&lt;/a&gt; away) over &lt;a href="pkm-search.html#other"&gt;&lt;b&gt;all&lt;/b&gt;&lt;/a&gt; of my personal data.
&lt;/p&gt;
&lt;p&gt;
And if you're still not using &lt;a href="https://github.com/BurntSushi/ripgrep"&gt;ripgrep&lt;/a&gt;, you should seriously give it a try.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;Typically&lt;/b&gt;, web apps provide a pretty &lt;a href="sad-infra.html#why_search"&gt;pathetic&lt;/a&gt; search experience.
Sometimes it's just not unavailable.
When it is, it's slow, the results are paginated, ranked by some magic algorithm and the scope is often restricted
for performance reasons.
Roam actually stands out because unlike most, it &lt;b&gt;does have&lt;/b&gt; an incremental search within the notes.
&lt;/p&gt;
&lt;p&gt;
Searching in Emacs is an incredibly pleasant experience.
The search is incremental, updates results as fast as you type, and you can configure it as you wish.
&lt;/p&gt;
&lt;p&gt;
Warning: once you get used to a fast incremental search in Emacs, you will struggle to go back.
You'll end up grumpy and as frustrated about web apps as me. Think twice.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
And some extra things I haven't mentioned in the video:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
you get (read-only) offline mode for free
&lt;/p&gt;
&lt;p&gt;
Roam does offer offline mode in the browser, but however talented Roam engineers are, a plain text file will always be more reliable.
&lt;/p&gt;
&lt;p&gt;
Fun fact: during the first attempt to record the demo, Roam web app wasn't loading :P
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
you get mobile access
&lt;/p&gt;
&lt;p&gt;
Roam doesn't have first-class mobile support yet, so with an org-mode mirror, you can benefit from the existing org-mode apps for your phone.
&lt;/p&gt;
&lt;p&gt;
Again, Roam specifically might implement it in the future, but the point is that you can be &lt;b&gt;ahead of the developers&lt;/b&gt; and do it yourself.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="why_roam"&gt;&lt;a class="headerlink" href="#why_roam"&gt;¶&lt;/a&gt;if org-mode is so cool why not just use it &lt;b&gt;instead&lt;/b&gt; of Roam?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Better ask someone who actively uses Roam, because I'm a stubborn org-mode user!
If you're like me, you probably tend to stay away from web apps.
&lt;/p&gt;
&lt;p&gt;
In that case, perhaps, check out &lt;a href="https://github.com/jethrokuan/org-roam"&gt;jethrokuan/org-roam&lt;/a&gt;, which implements a workflow similar to Roam, but within Emacs.
&lt;/p&gt;
&lt;p&gt;
But even I can come up with some objective (I hope) reasons to avoid Emacs:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
entry barrier
&lt;/p&gt;
&lt;p&gt;
I won't lie, I spent a while grasping and learning Emacs and I &lt;b&gt;still&lt;/b&gt; struggle at times.
&lt;/p&gt;
&lt;p&gt;
But also, most of the frustrations are when I'm trying to implement things that wouldn't even be possible in other apps and editors without
modifying their source code or self-hosting.
With a reasonable config, like &lt;a href="https://github.com/hlissner/doom-emacs"&gt;doom emacs&lt;/a&gt;, you can get very far just on the defaults.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
cloud sync
&lt;/p&gt;
&lt;p&gt;
As with all cloud apps, this a curse and a blessing at the same time.
&lt;/p&gt;
&lt;p&gt;
The "blessing" bit will be especially evident if Roam adds real-time collaboration (and I bet it's &lt;b&gt;more "when" than "if"&lt;/b&gt;).
&lt;/p&gt;
&lt;p&gt;
I have to admit, to my knowledge, org-mode gang doesn't have much to offer here.
&lt;span style="color:darkorange"&gt;&lt;strong&gt;I think this is a very important problem and needs solving.&lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
easier integration with web
&lt;/p&gt;
&lt;p&gt;
For example, you can embed tweets in Roam, and there is lots of potential for dynamic features.
&lt;span style="color:darkorange"&gt;&lt;strong&gt;A browser frontend for Emacs might actually be a good idea.&lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Org-mode mirror can &lt;b&gt;complement&lt;/b&gt; your Roam database and serve as an &lt;b&gt;additional&lt;/b&gt; interface and a means of learning org-mode,
without having to fully succumb to it.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="promnesia"&gt;&lt;a class="headerlink" href="#promnesia"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;6&lt;/span&gt; Promnesia: integrate Roam with your browser&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;a href="https://github.com/karlicoss/promnesia"&gt;Promnesia&lt;/a&gt; is an extension for enhancing your browser history.
It unifies the browsing history, which is siloed in various apps and services; and lets you explore the history in context, showing the information on where and how you've encountered the links.
If you want to learn more about it, check out &lt;a href="https://github.com/karlicoss/promnesia#demos"&gt;demos&lt;/a&gt;, here I'll only concentrate on demonstrating Roam.
&lt;/p&gt;
&lt;p&gt;
To use Roam data in Promnesia, all you need is to add a small bit to the &lt;a href="https://github.com/karlicoss/promnesia/blob/master/doc/config.py"&gt;config&lt;/a&gt;:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;from&lt;/span&gt; promnesia.sources &lt;span class="org-keyword"&gt;import&lt;/span&gt; roamresearch
&lt;span class="org-variable-name"&gt;SOURCES&lt;/span&gt; = [
   ...,
   Source(roamresearch.index, name=&lt;span class="org-string"&gt;'roam'&lt;/span&gt;),
   ...,
]
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
And that's it! This enables Roam Research module &lt;a href="https://github.com/karlicoss/promnesia/blob/master/src/promnesia/sources/roamresearch.py"&gt;(40 lines of code)&lt;/a&gt;, which consumes the data from &lt;a class="link-up" href="#dal"&gt;HPI&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
You can also index others' public Roam databases. If Roam is a second brain, this can be a way of &lt;b&gt;interfacing with others' second brains&lt;/b&gt;!
&lt;/p&gt;
&lt;p&gt;
I've &lt;a href="https://www.youtube.com/watch?v=wyJI96AH91o"&gt;recorded a demo&lt;/a&gt;, showing various workflows for your Roam data, which are enabled by Promnesia.
&lt;/p&gt;
&lt;p&gt;
Here's a text summary of the features, demonstrated in the video:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
the sidebar
&lt;/p&gt;
&lt;p&gt;
Shows your browsing history for the &lt;b&gt;current page&lt;/b&gt; along with the source, timestamp, and the &lt;b&gt;context&lt;/b&gt;, in which the link occurred.
&lt;/p&gt;
&lt;p&gt;
Clicking on the permalink brings us straight to the outline within the Roam Research web app.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
what are the &lt;b&gt;github repositories&lt;/b&gt; saved in this Roam database?
&lt;/p&gt;
&lt;p&gt;
If you open the sidebar on &lt;samp class="inline"&gt;github.com&lt;/samp&gt;, you can see the subpages along with the contexts, in particular,
links to all the github repositories saved in Roam.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
what are the &lt;b&gt;tweets&lt;/b&gt; saved in this Roam database
&lt;/p&gt;
&lt;p&gt;
Similarly, if you open &lt;samp class="inline"&gt;twitter.com&lt;/samp&gt;, you can see all the tweets in your browsing history.
If you open a specific Twitter profile, you get to see all the tweets from a specific person.
&lt;/p&gt;
&lt;p&gt;
I find it extremely useful to recall when you've engaged with the content from a specific person,
for example, to figure out whether you should follow them.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;full text search&lt;/b&gt; over your browsing history&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;b&gt;how did I get on this page&lt;/b&gt;?
&lt;/p&gt;
&lt;p&gt;
You can trace through all of your history to remember why you bookmarked a page.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
what links on this page have I already visited?
&lt;/p&gt;
&lt;p&gt;
When you press 'mark visited', Promnesia highlights the links you've already visited so you can explore new information more efficiently.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
There is some room for improvement, especially in terms of the UI (e.g. markup handling could be better), but these are easy to fix.
&lt;/p&gt;
&lt;p&gt;
These workflows aren't unique to Roam, and possible with many other data sources.
Promnesia already supports &lt;a href="https://github.com/karlicoss/promnesia/tree/master/src/promnesia/sources"&gt;many&lt;/a&gt;, and adding new is very easy.
You can find find more links, screenshots, and demos in the &lt;a href="https://github.com/karlicoss/promnesia#demos"&gt;repository&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Thanks for watching, check it out, and let me know if you can think of other cool features!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="fin"&gt;&lt;a class="headerlink" href="#fin"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;7&lt;/span&gt; --&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Happy to hear your feedback or help you set up the tools I mention!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    &lt;/section&gt;

    
    &lt;section id="post-footer"&gt;
        &lt;div class="post-tags"&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#infra"&gt;#infra&lt;/a&gt;
            &lt;a class="post-tag tag-inactive" href="./tags.html"&gt;#hpi&lt;/a&gt;
            &lt;a class="post-tag tag-inactive" href="./tags.html"&gt;#orger&lt;/a&gt;
            &lt;a class="post-tag tag-inactive" href="./tags.html"&gt;#promnesia&lt;/a&gt;
        &lt;/div&gt;
        &lt;time datetime="2020-04-20T00:00:00"&gt;20 April 2020&lt;/time&gt;
    &lt;/section&gt;
    

    

    &lt;section id="post-comments"&gt;
    &lt;script data-isso="https://beepb00p.xyz/comments/" data-isso-reply-to-self="true" src="https://beepb00p.xyz/comments/js/embed.min.js"&gt;
&lt;/script&gt;

&lt;section data-isso-id="isso_myinfra_roam" id="isso-thread"&gt;&lt;/section&gt;
    &lt;/section&gt;
&lt;/article&gt;
    &lt;/main&gt;

    &lt;footer id="bottomfooter"&gt;
        &lt;a href="https://twitter.com/karlicoss"&gt;🐦 me @twitter&lt;/a&gt;
        &lt;a href="https://github.com/karlicoss"&gt;💻 me @github&lt;/a&gt;
        &lt;a href="http://creativecommons.org/licenses/by/4.0" style="margin-left:auto"&gt;CC BY 4.0&lt;/a&gt;&lt;/footer&gt;

&lt;/body&gt;&lt;/html&gt;</description>
      <guid isPermaLink="true">https://beepb00p.xyz/myinfra-roam.html</guid>
      <pubDate>Mon, 20 Apr 2020 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Your configs suck? Try a real programming language.</title>
      <link>https://beepb00p.xyz/configs-suck.html</link>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang="en" prefix="og: http://ogp.me/ns#"&gt;&lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;meta content="width=device-width, initial-scale=1" name="viewport"/&gt;

    &lt;title&gt;Your configs suck? Try a real programming language. | beepb00p&lt;/title&gt;
    &lt;link href="https://beepb00p.xyz/configs-suck.html" rel="canonical"/&gt;
    &lt;meta content="plt python" name="keywords"/&gt;
    &lt;!-- TODO concat with keywords tags; also need to make comma separated? --&gt;

    &lt;!-- can test it with https://telegram.me/webpagebot --&gt;
    &lt;!-- or https://developers.facebook.com/tools/debug --&gt;
    &lt;meta content="website" property="og:type"/&gt;
    &lt;meta content="https://beepb00p.xyz/configs-suck.html" property="og:url"/&gt; &lt;!-- todo base? --&gt;
    &lt;meta content="Your configs suck? Try a real programming language. | beepb00p" property="og:title"/&gt;
    &lt;meta content="Or yet another rant about YAML" property="og:description"/&gt;
    &lt;!-- ugh. why is image necessary??? otherwise other parts aren't working or I get lots of 404s --&gt;
    &lt;!-- ugh. Facebook really wants jpg, but whatever --&gt;
    &lt;!-- also Facebook displays it with black background, but whatever, fuck it. --&gt;
    &lt;!-- svg does't work on  --&gt;
    &lt;meta content="https://beepb00p.xyz/assets/favicon.png" property="og:image"/&gt;

    &lt;!-- Icon made by Twitter --&gt;
    &lt;!-- https://twemoji.twitter.com/content/twemoji-twitter/en.html --&gt;
    &lt;!-- todo replace with svg favicon? most browsers support it --&gt;
    &lt;link href="./assets/favicon.png" rel="icon"/&gt;

    &lt;meta content="https://github.com/karlicoss/beepb00p" name="generator"/&gt;
    &lt;meta content="English" name="language"/&gt;

    &lt;!-- TODO get rid of google font. probably Georgia or Garamond? sadly they aren't available in Ubuntu by default.. --&gt;
    &lt;link href="https://fonts.gstatic.com" rel="preconnect"/&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&amp;amp;display=swap" rel="stylesheet"/&gt;

    &lt;link href="./assets/css/default.css" rel="stylesheet"/&gt;
    &lt;!-- TODO make conditional?? --&gt;
    &lt;link href="./assets/css/posts-list.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/links.css" rel="stylesheet"/&gt;

    &lt;!-- &lt;link rel="stylesheet" href="/assets/css/org.css" /&gt; --&gt;
    &lt;link href="./assets/css/htmlize.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-default.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-extra.css" rel="stylesheet"/&gt;
    &lt;script&gt;
    const TID = 'settings-timestamps';
function timestampsCheckbox() {
    return document.getElementById(TID)
}

window.onload = () =&gt; {
    const box = timestampsCheckbox()
    function setState(state) {
        box.checked = state
        const dd = state ? 'initial' : 'none'
        Array.from(document.querySelectorAll('.timestamp-wrapper, .property.CREATED')).map(x =&gt; {
            x.style.display = dd
        })
        localStorage.setItem(TID, JSON.stringify(state))
    }

    let state = localStorage.getItem(TID)
    if (state != null) {
        state = JSON.parse(state)
    } else {
        state = true
    }
    // todo a bit annoying that it glitches this way.. but whatever
    setState(state)
    // user click
    box.addEventListener('change', (event) =&gt; {
        setState(box.checked)
    })
}&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;!-- TODO not sure what to do on mobile devices? --&gt;
    &lt;!-- https://www.gwern.net/ --&gt;
    &lt;!-- could use position: fix so it's displayed  --&gt;
    &lt;div id="settings" style="position:fixed; top: 0; right:0; opacity: 0.3"&gt;
        &lt;!-- TODO headerlinks etc? --&gt;
        settings:
        &lt;div&gt;show timestamps&lt;input id="settings-timestamps" type="checkbox"/&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;nav id="topnav"&gt;
        &lt;a href="./"&gt;Home&lt;/a&gt;
        &lt;a href="./ideas.html"&gt;Ideas&lt;/a&gt;
        &lt;a href="./exobrain"&gt;Exobrain&lt;/a&gt;
        &lt;a href="./tags.html"&gt;Tags&lt;/a&gt;

        &lt;a href="./feed.html" style="margin-left:auto"&gt;Feed&lt;/a&gt;
        &lt;!-- margin-left aligns the rest to the right in flex layout --&gt;
        &lt;a href="./site.html"&gt;Site&lt;/a&gt;
        &lt;a href="./me.html"&gt;Me&lt;/a&gt;

        &lt;span style="font-size: 0.4em;"&gt;
            &lt;a href="https://twitter.com/karlicoss" style="display:block;"&gt;@twitter&lt;/a&gt;
            &lt;a href="https://github.com/karlicoss" style="display:block;"&gt;@github&lt;/a&gt;
        &lt;/span&gt;
    &lt;/nav&gt;

    &lt;!-- main contains the stuff which is not repeated across the site --&gt;
    &lt;main&gt;
        &lt;article&gt;
    
    &lt;section id="post-title"&gt;
    &lt;h1&gt;
        Your configs suck? Try a real programming language.
        &lt;a href="./blog-graph.html#python_configs" style="font-size: 1rem;vertical-align: super;" title="See this post within the blog graph, and how it's connected to other posts"&gt;[see within blog graph]&lt;/a&gt;
    &lt;/h1&gt;
    &lt;div class="summary"&gt;Or yet another rant about YAML
    &lt;/div&gt;&lt;/section&gt;
    &lt;!-- are sections appropriate for that? --&gt;

    &lt;section id="post-content"&gt;
    &lt;p&gt;
In this post, I'll try to explain why I find most config formats frustrating to use and
suggest that using a real programming language (i.e. general purpose one, like Python) is often (but &lt;a class="link-down" href="#cons"&gt;&lt;b&gt;not always&lt;/b&gt;&lt;/a&gt;) a feasible and more pleasant alternative for writing configs.
&lt;/p&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#configs_suck"&gt;1. Most modern config formats suck&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#workarounds"&gt;2. Workarounds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#real_language"&gt;3. Use a real programming language&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#cons"&gt;Downsides&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#why_python"&gt;Why Python?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#who_else"&gt;Who else does it?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#what_if_i_have_to"&gt;4. What if you don't have a choice?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#links"&gt;5. Extra links&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#fin"&gt;6. --&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#ps"&gt;7. &lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2020-04-11]&lt;/span&gt;&lt;/span&gt; P.S.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="configs_suck"&gt;&lt;a class="headerlink" href="#configs_suck"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; Most modern config formats suck&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
In this section, I'm mostly referring to JSON/YAML/TOML/ini files, which are the most common config formats I encounter.
&lt;/p&gt;
&lt;p&gt;
I'll refer to such configs as &lt;b&gt;&lt;span style="color:green"&gt;plain configs&lt;/span&gt;&lt;/b&gt;. Not sure if there is a better name for it, please let me know!
&lt;/p&gt;
&lt;p&gt;
An incomplete list of my frustrations:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;JSON &lt;b&gt;doesn't have comments&lt;/b&gt;, &lt;a href="https://stackoverflow.com/a/33963845/706389"&gt;by design&lt;/a&gt; 🤯&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
bits of configs &lt;b&gt;can't be reused&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
For example, while YAML, in theory, supports reusing/including bits of the config (they call it &lt;a href="https://confluence.atlassian.com/bitbucket/yaml-anchors-960154027.html"&gt;anchors&lt;/a&gt;),
some software like &lt;a href="https://github.community/t5/GitHub-Actions/Support-for-YAML-anchors/td-p/30336/page/3"&gt;Github Actions&lt;/a&gt; doesn't support it
&lt;/p&gt;
&lt;p&gt;
Usually, you just don't have any means of reusing parts of your config and have to copy-paste.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;code class="inline"&gt;.gitconfig&lt;/code&gt; uses a &lt;a href="https://git-scm.com/docs/git-config#_includes"&gt;custom syntax&lt;/a&gt; for merging the configs&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
can't contain &lt;b&gt;any logic&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
This is considered as a positive by many, but I would argue that when you can't define temporary variables, helper functions, substitute strings or concatenate lists, it's a bit fucked up.
&lt;/p&gt;
&lt;p&gt;
The workarounds (if present) are usually pretty horrible and impose cognitive overhead. Programming language constructs are &lt;b&gt;reinvented from scratch&lt;/b&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;variables and string interpolation

&lt;ul class="org-ul"&gt;
&lt;li&gt;Ansible uses &lt;a href="https://docs.ansible.com/ansible/latest/user_guide/playbooks_templating.html"&gt;Jinja templates&lt;/a&gt; (!) for variable manipulations.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Github Actions use a &lt;a href="https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions"&gt;custom syntax&lt;/a&gt; for that
&lt;/p&gt;
&lt;p&gt;
In addition, they've got &lt;a href="https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#functions"&gt;their own&lt;/a&gt; set of functions to manipulate the variables.
Have fun learning a new language you never wanted to!
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
scoping
&lt;/p&gt;
&lt;p&gt;
I.e. there are several custom scopes for &lt;a href="https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#env"&gt;&lt;samp class="inline"&gt;env&lt;/samp&gt; directive&lt;/a&gt; in Github Actions.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;control flow

&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;code class="inline"&gt;for&lt;/code&gt; loop: build matrices and 'excludes' always give me a headache&lt;/li&gt;
&lt;li&gt;&lt;code class="inline"&gt;if&lt;/code&gt; statement: e.g. &lt;a href="https://circleci.com/docs/2.0/configuration-reference/#the-when-step-requires-version-21"&gt;&lt;samp class="inline"&gt;when&lt;/samp&gt;&lt;/a&gt; in CircleCI&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;a href="https://blog.atomist.com/in-defense-of-yaml"&gt;"This is not structured data. This is programming masquerading as configuration."&lt;/a&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
can't be validated
&lt;/p&gt;
&lt;p&gt;
You can validate the config syntax itself (i.e. check JSON for correctness), but if you want more sophisticated semantic checks, you need to spend extra effort.
&lt;/p&gt;
&lt;p&gt;
This is kind of a consequence of not having logic in the config files.
Typically you'll have to write a supplementary program to check your configs and remember to call it before passing to a program.
&lt;/p&gt;
&lt;p&gt;
Very few programs bother with that. Usually, your program crashes because of something that would be &lt;b&gt;trivial to catch with any simple type system&lt;/b&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
YAML simply stands out with its implicit conversions and portability issues (e.g. "The NOrway Problem")
&lt;/p&gt;
&lt;p&gt;
There are enough rants about it, so I'll just leave a link to a good one: &lt;a href="https://www.arp242.net/yaml-config.html"&gt;"YAML: probably not so great after all"&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Summary: we spend time learning &lt;b&gt;useless syntax and reinventing programming constructs, instead of productive work&lt;/b&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="workarounds"&gt;&lt;a class="headerlink" href="#workarounds"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; Workarounds&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
So what happens when people encounter these problems?
Often they end up using a 'real' (i.e. general purpose, Turing complete) programming language anyway:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;you write a program to filter out custom comment syntax&lt;/li&gt;
&lt;li&gt;you write a program to merge configs or use a templating engine&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
you write a program that 'evaluates' the config
&lt;/p&gt;
&lt;p&gt;
Often, you &lt;b&gt;end up reimplementing an interpreter&lt;/b&gt; for a simple functional language in the process.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
you write a program to validate the config
&lt;/p&gt;
&lt;p&gt;
For the most part, it's boilerplate for type checking. You're not only working on a solved problem but in addition, end up with mediocre error messages as a result.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
All this stuff is unpleasant and distracts you from your main objective.
&lt;/p&gt;
&lt;p&gt;
Perhaps you can see where I'm coming with this.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="real_language"&gt;&lt;a class="headerlink" href="#real_language"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; Use a real programming language&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
The idea is to write your config in your target programming language.
I'll have Python in mind here, but the same idea can be applied to &lt;b&gt;any dynamic enough language&lt;/b&gt; (e.g. Javascript/Ruby).
&lt;/p&gt;
&lt;p&gt;
Then, you simply import/evaluate your config file and voila – you're done. That's it.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
Toy example:
&lt;/p&gt;
&lt;p&gt;
&lt;samp class="inline"&gt;config.py&lt;/samp&gt;
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;from&lt;/span&gt; typing &lt;span class="org-keyword"&gt;import&lt;/span&gt; NamedTuple

&lt;span class="org-keyword"&gt;class&lt;/span&gt; &lt;span class="org-type"&gt;Person&lt;/span&gt;(NamedTuple):
    name: &lt;span class="org-builtin"&gt;str&lt;/span&gt;
    age: &lt;span class="org-builtin"&gt;int&lt;/span&gt;

&lt;span class="org-variable-name"&gt;PEOPLE&lt;/span&gt; = [
    Person(&lt;span class="org-string"&gt;'Ann'&lt;/span&gt;  , 22),
    Person(&lt;span class="org-string"&gt;'Roger'&lt;/span&gt;, 15),
    Person(&lt;span class="org-string"&gt;'Judy'&lt;/span&gt; , 49),
]
&lt;/pre&gt;
&lt;/div&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
Using the config: 
&lt;/span&gt;&lt;aside class="sidenote"&gt;see &lt;a href="https://lobste.rs/s/qyhvhc/your_configs_suck_try_real_programming#c_0btczk"&gt;this&lt;/a&gt; if you're wondering why I use &lt;code class="inline"&gt;exec&lt;/code&gt; , not &lt;code class="inline"&gt;import&lt;/code&gt;.&lt;/aside&gt;&lt;/div&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;from&lt;/span&gt; pathlib &lt;span class="org-keyword"&gt;import&lt;/span&gt; Path

&lt;span class="org-variable-name"&gt;config&lt;/span&gt; = {}
&lt;span class="org-keyword"&gt;exec&lt;/span&gt;(Path(&lt;span class="org-string"&gt;'config.py'&lt;/span&gt;).read_text(), config)
&lt;span class="org-variable-name"&gt;people&lt;/span&gt; = config[&lt;span class="org-string"&gt;'PEOPLE'&lt;/span&gt;]

&lt;span class="org-keyword"&gt;print&lt;/span&gt;(people)
&lt;/pre&gt;
&lt;/div&gt;
&lt;pre class="example"&gt;[Person(name='Ann', age=22), Person(name='Roger', age=15), Person(name='Judy', age=49)]
&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I find it pretty neat.
Let's see how it helps us with the problems I described:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;comments: duh&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
includes: trivial, use imports
&lt;/p&gt;
&lt;p&gt;
You can even import the very package you're configuring.
So you can define a DSL for configuration, which will be imported and used in the config file.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
logic
&lt;/p&gt;
&lt;p&gt;
You have your language's syntax and libraries available to use.
For example, something like &lt;a href="https://docs.python.org/3/library/pathlib.html"&gt;&lt;samp class="inline"&gt;pathlib&lt;/samp&gt;&lt;/a&gt; alone can save you massive amounts of config duplication.
&lt;/p&gt;
&lt;p&gt;
Of course, one could go crazy and make it incomprehensible.
But personally I'd rather accept potential for abusing the power of the language rather than being restricted.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
validation
&lt;/p&gt;
&lt;p&gt;
You can keep validation logic right in the config, so it would be checked at the time of loading.
Mature static analysis tools (i.e. JS flow/eslint/pylint/mypy) can be used to aid you.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="cons"&gt;&lt;a class="headerlink" href="#cons"&gt;¶&lt;/a&gt;Downsides&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Are there any problems with that approach? Sure:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
interoperability
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
Okay, maybe if your program is in Python it makes sense. But what if it isn't, or you'll rewrite it to another language (i.e. compiled, like c++) later.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
If you'll be running your software somewhere without an interpreter, then sure, good point.
Modern &lt;a href="https://en.wikipedia.org/wiki/Foreign_function_interface"&gt;FFI&lt;/a&gt; is tedious and linking against your config is going to be pretty tricky.
&lt;/p&gt;
&lt;p&gt;
In case of Python specifically, it's present in most modern OS distributions. So you might get away with the following:
&lt;/p&gt;
&lt;ol class="org-ol"&gt;
&lt;li&gt;make your Python config executable&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
in the &lt;samp class="inline"&gt;main()&lt;/samp&gt; function, build the config, convert to JSON and dump to the stdout
&lt;/p&gt;
&lt;p&gt;
This step is possible with no boilerplate due to Python's dynamic nature.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;in your c++ code, execute the Python config (i.e. use &lt;code class="inline"&gt;popen()&lt;/code&gt;), read the raw JSON and process&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Yep, you will still have to manually deserialize config in the c++ code. But I think that's at least &lt;b&gt;not worse&lt;/b&gt; than only using JSON and editing it manually.
&lt;/p&gt;
&lt;p&gt;
Obviously that has a performance hit (i.e. milliseconds taken to run the Python interpreter). Make your own judgment whether it's acceptable for you.
If the tool you're configuring is running for hours, you're probably going to be fine, or you can always generate the config in advance/cache.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
general-purpose programming languages are &lt;b&gt;harder to reason about&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
This is somewhat subjective. Personally, I'd be more likely overwhelmed by an overly verbose plain config. I'd always prefer a neat and compact DSL.
&lt;/p&gt;
&lt;p&gt;
A large factor here is code style: I'm sure you can make your config file readable in almost any programming language,
even for people not familiar with the language at all.
&lt;/p&gt;
&lt;p&gt;
However, I appreciate that my experience is different from other engineers (i.e. sysadmins) who would not trade off flexibility for the increase of configuration complexity.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
general-purpose languages are &lt;b&gt;hard to modify programmatically&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
To some extent it overlaps with the previous point.
For example, &lt;samp class="inline"&gt;git config&lt;/samp&gt; commands manipulates the &lt;samp class="inline"&gt;.git/config&lt;/samp&gt; file.
It's easy to modify an INI file, because it's basically a dictionary, so you only have to locate the key in the config file and change a single line.
&lt;/p&gt;
&lt;p&gt;
If the config is (say) a Python program, the model can be much more complicated than a dictionary, and it might be tricky to modify settings programmatically.
Most likely, you'll have to resort to only appending new code to the config, which may not always be enough.
&lt;/p&gt;
&lt;p&gt;
To me, it's a very strong point against code as a config. As counter-points:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;not many programs have (or need) TUI/GUI for editing settings&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
the settings that belong to the UI are usually very simple, and possible to adjust by appending only
&lt;/p&gt;
&lt;p&gt;
For example, Emacs customization interface is &lt;a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Customizations.html"&gt;backed by an Elisp config&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;a id="security"&gt;&lt;/a&gt;The most serious issues are probably security and termination checking:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
security
&lt;/p&gt;
&lt;p&gt;
I.e. if your config executes arbitrary code, then it may steal your passwords or format your hard drive.
&lt;/p&gt;
&lt;p&gt;
Whether security is actually something you need to think about &lt;b&gt;depends on your threat model&lt;/b&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;if your configs are supplied by third parties you don't trust, then I agree that plain configs are safer.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
however, often, especially for end-user software, it's not the case
&lt;/p&gt;
&lt;p&gt;
Often the user controls their own config, and the program runs under the same permissions.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In addition, this is something that can be potentially solved by sandboxing. Whether it's worth the effort depends on the nature of your project, but for something like CI executor &lt;b&gt;you need a sandbox anyway&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
Also, note that using a plain config format doesn't necessarily save you from trouble. See &lt;a href="https://www.arp242.net/yaml-config.html#insecure-by-default"&gt;"YAML: insecure by default"&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
termination checking
&lt;/p&gt;
&lt;p&gt;
Even if you don't care about security, you don't want your config to hang the program.
&lt;/p&gt;
&lt;p&gt;
Personally, I've never run into such issues, but here are some potential workarounds for that:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;explicit timeout for loading the config&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
using a subset of the language might help, for example, &lt;a href="https://docs.bazel.build/versions/master/skylark/language.html#differences-with-python"&gt;Skylark&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Anyone knows examples of /conservative/static analysis tools that check for termination in general purpose languages?
&lt;/p&gt;
&lt;p&gt;
Note this is not the same as the &lt;a href="https://en.wikipedia.org/wiki/Halting_problem"&gt;Halting problem&lt;/a&gt;. You don't want to determine whether &lt;b&gt;any&lt;/b&gt; program terminates, you want to figure out a
&lt;b&gt;reasonable subset of the language&lt;/b&gt; that terminates.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Even if your config language is Turing incomplete, you might have to resort to using timeouts anyway:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
your config can take &lt;b&gt;very&lt;/b&gt; long time to evaluate, while taking finite time to complete in theory
&lt;/p&gt;
&lt;p&gt;
See &lt;a href="http://www.haskellforall.com/2020/01/why-dhall-advertises-absence-of-turing.html"&gt;"Why Dhall advertises the absence of Turing-completeness"&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
While an &lt;a href="https://gist.github.com/Gabriel439/77f715350ecc0443eed5fa613ac6b78e"&gt;Ackermann&lt;/a&gt; function is a contrived example,
that means that if you truly care about malicious inputs, you want to sandbox anyway.
If your configs support some form of including, you can &lt;a href="https://lobste.rs/s/qyhvhc/your_configs_suck_try_real_programming#c_rtbmnp"&gt;very likely&lt;/a&gt; construct an input that will inflate it
exponentially.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Note that using a plain config doesn't mean it won't loop infinitely:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;See &lt;a href="https://www.gwern.net/Turing-complete#accidentally-turing-complete"&gt;"Accidentally Turing complete"&lt;/a&gt; for an excellent overview&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="why_python"&gt;&lt;a class="headerlink" href="#why_python"&gt;¶&lt;/a&gt;Why Python?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Some reasons I find Python specifically enjoyable for writing config files:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;Python is present on almost all modern operating systems&lt;/li&gt;
&lt;li&gt;Python syntax is considered simple (not a bad thing!), so hopefully Python configs aren't much harder to understand than plain configs&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/library/dataclasses.html"&gt;data classes&lt;/a&gt;, functions and generators form a basis for a compact DSL&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/library/typing.html"&gt;typing annotations&lt;/a&gt; serve as documentation and validation at the same time&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
However, you can achieve a similarly pleasant experience in &lt;b&gt;most modern programming languages&lt;/b&gt; (provided they are dynamic enough).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="who_else"&gt;&lt;a class="headerlink" href="#who_else"&gt;¶&lt;/a&gt;Who else does it?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Some projects that allow for using code as configuration:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://webpack.js.org/configuration"&gt;Webpack&lt;/a&gt;, web asset bundler, uses a Javascript as a config&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://setuptools.readthedocs.io/en/latest/setuptools.html#basic-use"&gt;setuptools&lt;/a&gt;, the standard way of installing Python packages
&lt;/p&gt;
&lt;p&gt;
Allows using &lt;b&gt;both&lt;/b&gt; &lt;samp class="inline"&gt;setup.cfg&lt;/samp&gt; and &lt;samp class="inline"&gt;setup.py&lt;/samp&gt; files.
That way if you can't achieve something solely with plain config, you can fix this in &lt;samp class="inline"&gt;setup.py&lt;/samp&gt;, which gives you a balance between declarative and flexible.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://jupyter.org"&gt;Jupiter&lt;/a&gt;, interactive computing tool
&lt;/p&gt;
&lt;p&gt;
Uses a &lt;a href="https://github.com/jupyter/jupyter_core/blob/master/jupyter_core/tests/dotipython_empty/profile_default/ipython_nbconvert_config.py"&gt;python file&lt;/a&gt; to configure the export.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://www.gnu.org/software/emacs"&gt;Emacs&lt;/a&gt;: famously uses Elisp for its configuration
&lt;/p&gt;
&lt;p&gt;
While I'm not a fan of Elisp at all, it does make Emacs very flexible and it's possible to achieve any configuration you want.
&lt;/p&gt;
&lt;p&gt;
On the other hand, if you've ever read other people's Emacs setups, you can see it also demonstrates how things can get out of hand when you allow
a general purpose language for configuration.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/brookhong/Surfingkeys#edit-your-own-settings"&gt;Surfingkeys&lt;/a&gt; browser extension: uses a Javascript DSL for configuration&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_scripts_are_code"&gt;Gradle&lt;/a&gt; provides Groovy and Kotlin DSLs for writing build files&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://github.com/Fizzadar/pyinfra#readme"&gt;Pyinfra&lt;/a&gt; automates configuration/infrastructure deployment and uses standard Python
&lt;/p&gt;
&lt;p&gt;
I'm personally using it for some of my own infrastructure – and it's a massive relief after Ansible and its yaml crap.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="https://github.com/Fizzadar/pyinfra/blob/18a61dd5b5ec22d74ca9a3806bcd5f3b34aaaf68/examples/server.py"&gt;Here&lt;/a&gt; is an example of its DSL.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://awesomewm.org"&gt;Awesome Window Manager&lt;/a&gt; uses Lua for configuration&lt;/li&gt;
&lt;li&gt;&lt;a href="https://guix.gnu.org"&gt;Guix&lt;/a&gt; package manager: uses &lt;a href="https://www.gnu.org/software/guile"&gt;Guile Scheme&lt;/a&gt; for configuration&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/getpelican/pelican"&gt;Pelican&lt;/a&gt; static site generator: uses &lt;a href="https://raw.githubusercontent.com/getpelican/pelican/master/samples/pelican.conf.py"&gt;Python&lt;/a&gt; for configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Some languages are designed specifically for configuration:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://docs.bazel.build/versions/master/skylark/language.html#differences-with-python"&gt;&lt;del&gt;Bazel&lt;/del&gt; Skylark&lt;/a&gt; uses a subset of Python for describing build rules
&lt;/p&gt;
&lt;p&gt;
While it's deliberately restricted to ensure termination checking and determinism, configuring Bazel is orders of magnitude more pleasant than any other build system I've used.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mesonbuild.com/Syntax.html"&gt;Meson build system&lt;/a&gt;: borrows the syntax from Python&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://nixos.wiki/wiki/Nix_Expression_Language"&gt;Nix&lt;/a&gt;: language designed specifically for the Nix package manager
&lt;/p&gt;
&lt;p&gt;
While a completely new language feels like an overkill, it's still nicer to work with than plain configs.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://dhall-lang.org"&gt;Dhall&lt;/a&gt;: language designed specifically for config files
&lt;/p&gt;
&lt;p&gt;
Dhall advertises itself as "JSON + functions + types + imports". And indeed, it looks great, and solves most of the issues I listed.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://jsonnet.org"&gt;Jsonnet&lt;/a&gt;: JSON + variables + control flow
&lt;/p&gt;
&lt;p&gt;
See &lt;a href="https://jsonnet.org/articles/comparisons.html"&gt;comparison&lt;/a&gt; with other configuration languages
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Downsides of such languages is that they aren't widespread yet. If you don't have bindings for your target language, you'd end up parsing JSON again.
However, at least it makes writing configs pleasant.
&lt;/p&gt;
&lt;p&gt;
But again, if your program is written in Javascript and doesn't interact with other languages, why don't you just make the config Javascript?
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="what_if_i_have_to"&gt;&lt;a class="headerlink" href="#what_if_i_have_to"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; What if you don't have a choice?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Some ways I've found to minimize the frustration while using plain configs:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
write as little in config files as possible
&lt;/p&gt;
&lt;p&gt;
This typically applies to CI pipeline configs (i.e. Gitlab/Circle/Github Actions) or Dockerfiles.
&lt;/p&gt;
&lt;p&gt;
Often such configs are &lt;b&gt;bloated with shell commands&lt;/b&gt;, which makes it impossible to run locally without copying line by line.
And yeah, there &lt;a href="https://circleci.com/docs/2.0/local-cli"&gt;are&lt;/a&gt; &lt;a href="https://github.com/nektos/act"&gt;ways&lt;/a&gt; to debug, but they have a pretty slow feedback loop.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;use tools that are better suited to set up local virtual environments, like &lt;a href="https://github.com/tox-dev/tox"&gt;tox-dev/tox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
prefer helper shell scripts and call them from your pipeline
&lt;/p&gt;
&lt;p&gt;
It is a bit frustrating since it introduces indirection and scatters code around.
But, as an upside, you can lint (e.g. &lt;a href="https://www.shellcheck.net"&gt;shellcheck&lt;/a&gt;) your pipeline scripts, and make it easier to run locally.
&lt;/p&gt;
&lt;p&gt;
Sometimes you can get away if your pipeline is short, so use your own judgment.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Let the CI only handle setting up a VM/container for you, caching the dependencies, and publishing artifacts.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
generate the config instead of writing manually
&lt;/p&gt;
&lt;p&gt;
The downside is that the generated config may diverge if edited manually.
&lt;/p&gt;
&lt;p&gt;
You can add the warning comment that the config is autogenerated with the link to the generator, and make the config file read-only to discourage manual editing.
&lt;/p&gt;
&lt;p&gt;
In addition, if you're running CI, you can make the consistency check a part of the pipeline itself.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="links"&gt;&lt;a class="headerlink" href="#links"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;5&lt;/span&gt; Extra links&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://www.arp242.net/flags-config.html"&gt;(commandline) flags are great for configuration&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Overall, I agree, but there are still cases when using flags isn't feasible.
&lt;/p&gt;
&lt;p&gt;
It's also prone to leaking secrets (keys/tokens/passwords) – both in your shell history and via &lt;samp class="inline"&gt;ps&lt;/samp&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://wiki.archlinux.org/index.php/Xmonad#Configuration"&gt;Xmonad&lt;/a&gt;: config &lt;b&gt;is&lt;/b&gt; the executable
&lt;/p&gt;
&lt;p&gt;
Interesting approach, but not always feasible, e.g. you might not have the compiler installed.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/magefile/mage#about"&gt;Mage&lt;/a&gt;: a tool for writing makefiles in Go&lt;/li&gt;
&lt;li&gt;Dhall wiki: &lt;a href="https://github.com/dhall-lang/dhall-lang/wiki/Programmable-configuration-files"&gt;Programmable configuration files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://news.ycombinator.com/item?id=19108787"&gt;Why are we templating YAML? (HN)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;Updates&lt;/b&gt; from the comments (thanks everyone!):
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://www.lua.org/history.html"&gt;The evolution of an extension language: a history of Lua&lt;/a&gt;: apparently Lua has started as a config language&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://news.ycombinator.com/item?id=20847943"&gt;Cue&lt;/a&gt;:  A language for defining, generating, and validating data
&lt;/p&gt;
&lt;p&gt;
I've &lt;b&gt;really&lt;/b&gt; struggled to find a code example on the website, so &lt;a href="https://github.com/cuelang/cue/blob/master/doc/tutorial/kubernetes/README.md"&gt;here you go&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://news.ycombinator.com/item?id=14298715"&gt;The configuration complexity clock&lt;/a&gt;: a case for hard-coding&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="fin"&gt;&lt;a class="headerlink" href="#fin"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;6&lt;/span&gt; --&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
A followup question, which I don't have an answer for: why is it that way?
I'm sure Ansible/CircleCI or Github Actions are developed by talented engineers who have considered pros and cons of using YAML.
Do the pros really outweigh the cons?
&lt;/p&gt;
&lt;p&gt;
Open to all feedback, and feel free to share your config pain and how are you solving it!
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Updates&lt;/b&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2020-04-11]&lt;/span&gt;&lt;/span&gt; Added P.S. section&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="ps"&gt;&lt;a class="headerlink" href="#ps"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;7&lt;/span&gt; &lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2020-04-11]&lt;/span&gt;&lt;/span&gt; P.S.&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Thanks everyone for the discussions and comments!
&lt;/p&gt;
&lt;p&gt;
There were some polar opinions involved, so I'd like to clarify the most common objections here:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
"Programs as a config are a security nightmare"
&lt;/p&gt;
&lt;p&gt;
I admit that I have a programmer's mindset (as opposed to sysadmin's), and very likely underestimate the security risks.
&lt;/p&gt;
&lt;p&gt;
But again, &lt;a class="link-up" href="#security"&gt;I agree&lt;/a&gt; that executable configs are &lt;b&gt;not always&lt;/b&gt; a good idea.
You can still have the best of both worlds by providing a DSL for generating a plain config and consuming the plain config.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
"If your config is a program, it might end up arbitrarily complex and incomprehensible"
&lt;/p&gt;
&lt;p&gt;
Sure, but again, it largely depends on the discipline. You can also make a plain config incomprehensible and hard to modify.
&lt;/p&gt;
&lt;p&gt;
The best compromise here is probably configuration languages like Dhall.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
"What happens in 20 years, when there is no &amp;lt;insert programming language&amp;gt; around"
&lt;/p&gt;
&lt;p&gt;
That's a good point, but languages don't disappear in an eye blink. There will be plenty of time to adapt.
In addition, if your software and config are written in the same language, the software will need to be rewritten anyway, which is a bigger problem.
&lt;/p&gt;
&lt;p&gt;
Also even plain config formats come and go. 20 years ago XML was common for configuration; how many times you've seen it lately?
Does your programming language even include XML parser in the standard library?
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
"If your config is so complex you need a DSL, your design has gone wrong and your software sucks"
&lt;/p&gt;
&lt;p&gt;
Frankly, I've found many of such comments as very opinionated and not constructive, but I'll try to respond.
&lt;/p&gt;
&lt;p&gt;
Software comes in very different shapes and while having the simplest configuration possible is desirable (ideally, none!),
 sometimes it would change the very nature of the thing you're trying to develop. Sure, you can stop calling it 'software' and start calling a 'library'
 at this point, but I don't feel it changes the point of the discussion.
&lt;/p&gt;
&lt;p&gt;
Perhaps, my constructive takeaways from this argument would be:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
think how flexible your configuration might have to be, and whether you need to give up on plain configs early
&lt;/p&gt;
&lt;p&gt;
A good example of this would be some mail filtering systems, that started simple and ended as Turing complete.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
in the rapid development phase, resort to having a flexible config
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;When/if&lt;/b&gt; your software matures, think about supporting plain configs or/and using a special configuration language.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

    &lt;/section&gt;

    
    &lt;section id="post-footer"&gt;
        &lt;div class="post-tags"&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#plt"&gt;#plt&lt;/a&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#python"&gt;#python&lt;/a&gt;
        &lt;/div&gt;
        &lt;time datetime="2020-04-05T00:00:00"&gt;05 April 2020&lt;/time&gt;
    &lt;/section&gt;
    

    
    &lt;section id="post-discussion"&gt;
    &lt;br/&gt;
    &lt;div&gt;Discussion:&lt;/div&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;a href="https://news.ycombinator.com/item?id=22787332"&gt;hackernews&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="https://lobste.rs/s/qyhvhc/your_configs_suck_try_real_programming"&gt;lobsters&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    

    &lt;section id="post-comments"&gt;
    &lt;script data-isso="https://beepb00p.xyz/comments/" data-isso-reply-to-self="true" src="https://beepb00p.xyz/comments/js/embed.min.js"&gt;
&lt;/script&gt;

&lt;section data-isso-id="isso_python_configs" id="isso-thread"&gt;&lt;/section&gt;
    &lt;/section&gt;
&lt;/section&gt;&lt;/article&gt;
    &lt;/main&gt;

    &lt;footer id="bottomfooter"&gt;
        &lt;a href="https://twitter.com/karlicoss"&gt;🐦 me @twitter&lt;/a&gt;
        &lt;a href="https://github.com/karlicoss"&gt;💻 me @github&lt;/a&gt;
        &lt;a href="http://creativecommons.org/licenses/by/4.0" style="margin-left:auto"&gt;CC BY 4.0&lt;/a&gt;&lt;/footer&gt;

&lt;/body&gt;&lt;/html&gt;</description>
      <guid isPermaLink="true">https://beepb00p.xyz/configs-suck.html</guid>
      <pubDate>Sun, 05 Apr 2020 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Human Programming Interface</title>
      <link>https://beepb00p.xyz/hpi.html</link>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang="en" prefix="og: http://ogp.me/ns#"&gt;&lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;meta content="width=device-width, initial-scale=1" name="viewport"/&gt;

    &lt;title&gt;Human Programming Interface | beepb00p&lt;/title&gt;
    &lt;link href="https://beepb00p.xyz/hpi.html" rel="canonical"/&gt;
    &lt;meta content="infra pkm quantifiedself hpi" name="keywords"/&gt;
    &lt;!-- TODO concat with keywords tags; also need to make comma separated? --&gt;

    &lt;!-- can test it with https://telegram.me/webpagebot --&gt;
    &lt;!-- or https://developers.facebook.com/tools/debug --&gt;
    &lt;meta content="website" property="og:type"/&gt;
    &lt;meta content="https://beepb00p.xyz/hpi.html" property="og:url"/&gt; &lt;!-- todo base? --&gt;
    &lt;meta content="Human Programming Interface | beepb00p" property="og:title"/&gt;
    &lt;meta content="My life in a Python package" property="og:description"/&gt;
    &lt;!-- ugh. why is image necessary??? otherwise other parts aren't working or I get lots of 404s --&gt;
    &lt;!-- ugh. Facebook really wants jpg, but whatever --&gt;
    &lt;!-- also Facebook displays it with black background, but whatever, fuck it. --&gt;
    &lt;!-- svg does't work on  --&gt;
    &lt;meta content="https://beepb00p.xyz/assets/favicon.png" property="og:image"/&gt;

    &lt;!-- Icon made by Twitter --&gt;
    &lt;!-- https://twemoji.twitter.com/content/twemoji-twitter/en.html --&gt;
    &lt;!-- todo replace with svg favicon? most browsers support it --&gt;
    &lt;link href="./assets/favicon.png" rel="icon"/&gt;

    &lt;meta content="https://github.com/karlicoss/beepb00p" name="generator"/&gt;
    &lt;meta content="English" name="language"/&gt;

    &lt;!-- TODO get rid of google font. probably Georgia or Garamond? sadly they aren't available in Ubuntu by default.. --&gt;
    &lt;link href="https://fonts.gstatic.com" rel="preconnect"/&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&amp;amp;display=swap" rel="stylesheet"/&gt;

    &lt;link href="./assets/css/default.css" rel="stylesheet"/&gt;
    &lt;!-- TODO make conditional?? --&gt;
    &lt;link href="./assets/css/posts-list.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/links.css" rel="stylesheet"/&gt;

    &lt;!-- &lt;link rel="stylesheet" href="/assets/css/org.css" /&gt; --&gt;
    &lt;link href="./assets/css/htmlize.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-default.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-extra.css" rel="stylesheet"/&gt;
    &lt;script&gt;
    const TID = 'settings-timestamps';
function timestampsCheckbox() {
    return document.getElementById(TID)
}

window.onload = () =&gt; {
    const box = timestampsCheckbox()
    function setState(state) {
        box.checked = state
        const dd = state ? 'initial' : 'none'
        Array.from(document.querySelectorAll('.timestamp-wrapper, .property.CREATED')).map(x =&gt; {
            x.style.display = dd
        })
        localStorage.setItem(TID, JSON.stringify(state))
    }

    let state = localStorage.getItem(TID)
    if (state != null) {
        state = JSON.parse(state)
    } else {
        state = true
    }
    // todo a bit annoying that it glitches this way.. but whatever
    setState(state)
    // user click
    box.addEventListener('change', (event) =&gt; {
        setState(box.checked)
    })
}&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;!-- TODO not sure what to do on mobile devices? --&gt;
    &lt;!-- https://www.gwern.net/ --&gt;
    &lt;!-- could use position: fix so it's displayed  --&gt;
    &lt;div id="settings" style="position:fixed; top: 0; right:0; opacity: 0.3"&gt;
        &lt;!-- TODO headerlinks etc? --&gt;
        settings:
        &lt;div&gt;show timestamps&lt;input id="settings-timestamps" type="checkbox"/&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;nav id="topnav"&gt;
        &lt;a href="./"&gt;Home&lt;/a&gt;
        &lt;a href="./ideas.html"&gt;Ideas&lt;/a&gt;
        &lt;a href="./exobrain"&gt;Exobrain&lt;/a&gt;
        &lt;a href="./tags.html"&gt;Tags&lt;/a&gt;

        &lt;a href="./feed.html" style="margin-left:auto"&gt;Feed&lt;/a&gt;
        &lt;!-- margin-left aligns the rest to the right in flex layout --&gt;
        &lt;a href="./site.html"&gt;Site&lt;/a&gt;
        &lt;a href="./me.html"&gt;Me&lt;/a&gt;

        &lt;span style="font-size: 0.4em;"&gt;
            &lt;a href="https://twitter.com/karlicoss" style="display:block;"&gt;@twitter&lt;/a&gt;
            &lt;a href="https://github.com/karlicoss" style="display:block;"&gt;@github&lt;/a&gt;
        &lt;/span&gt;
    &lt;/nav&gt;

    &lt;!-- main contains the stuff which is not repeated across the site --&gt;
    &lt;main&gt;
        &lt;article&gt;
    
    &lt;section id="post-title"&gt;
    &lt;h1&gt;
        Human Programming Interface
        &lt;a href="./blog-graph.html#mypkg" style="font-size: 1rem;vertical-align: super;" title="See this post within the blog graph, and how it's connected to other posts"&gt;[see within blog graph]&lt;/a&gt;
    &lt;/h1&gt;
    &lt;div class="summary"&gt;My life in a Python package
    &lt;/div&gt;&lt;/section&gt;
    &lt;!-- are sections appropriate for that? --&gt;

    &lt;section id="post-content"&gt;
    &lt;p&gt;
If you're in a hurry, feel free to jump straight to the &lt;a class="link-down" href="#usecases"&gt;demos&lt;/a&gt;.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;see &lt;a href="https://github.com/karlicoss/HPI/tree/master/doc/SETUP.org"&gt;SETUP&lt;/a&gt; for the &lt;b&gt;installation/configuration guide&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;see &lt;a href="https://github.com/karlicoss/HPI/tree/master/doc/DEVELOPMENT.org"&gt;DEVELOPMENT&lt;/a&gt; for the &lt;b&gt;development/extension guide&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;see &lt;a href="https://github.com/karlicoss/HPI/tree/master/doc/DESIGN.org"&gt;DESIGN&lt;/a&gt; for the &lt;b&gt;design goals&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;see &lt;a href="https://beepb00p.xyz/exobrain/projects/hpi.html"&gt;exobrain/HPI&lt;/a&gt; for some of my raw thoughts and todos on the project&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;TLDR&lt;/b&gt;: I'm using &lt;a href="https://github.com/karlicoss/HPI"&gt;HPI&lt;/a&gt; (Human Programming Interface) package as a means of unifying, accessing and interacting with all of my personal data.
&lt;/p&gt;
&lt;p&gt;
HPI is a Python package (named &lt;code class="inline"&gt;my&lt;/code&gt;), a collection of modules for:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;social networks: posts, comments, favorites&lt;/li&gt;
&lt;li&gt;reading: e-books and pdfs&lt;/li&gt;
&lt;li&gt;annotations: highlights and comments&lt;/li&gt;
&lt;li&gt;todos and notes&lt;/li&gt;
&lt;li&gt;health data: sleep, exercise, weight, heart rate, and other body metrics&lt;/li&gt;
&lt;li&gt;location&lt;/li&gt;
&lt;li&gt;photos &amp;amp; videos&lt;/li&gt;
&lt;li&gt;browser history&lt;/li&gt;
&lt;li&gt;instant messaging&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The package hides the &lt;a href="sad-infra.html#exports_are_hard"&gt;gory details&lt;/a&gt; of locating data, parsing, error handling and caching.
You simply 'import' your data and get to work with familiar Python types and data structures.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
Here's a short example to give you an idea: "which subreddits I find the most interesting?"
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;import&lt;/span&gt; my.reddit
&lt;span class="org-keyword"&gt;from&lt;/span&gt; collections &lt;span class="org-keyword"&gt;import&lt;/span&gt; Counter
&lt;span class="org-keyword"&gt;return&lt;/span&gt; Counter(s.subreddit &lt;span class="org-keyword"&gt;for&lt;/span&gt; s &lt;span class="org-keyword"&gt;in&lt;/span&gt; my.reddit.saved()).most_common(4)
&lt;/pre&gt;
&lt;/div&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-left"/&gt;
&lt;col class="org-right"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;orgmode&lt;/td&gt;
&lt;td class="org-right"&gt;62&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;emacs&lt;/td&gt;
&lt;td class="org-right"&gt;60&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;selfhosted&lt;/td&gt;
&lt;td class="org-right"&gt;51&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;QuantifiedSelf&lt;/td&gt;
&lt;td class="org-right"&gt;46&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
I consider my digital trace an important part of my identity. 
Usually the data is siloed, accessing it is inconvenient and borderline frustrating. This feels very wrong.
&lt;/span&gt;&lt;aside class="sidenote"&gt;&lt;a class="post-tag" href="./tags.html#extendedmind"&gt;#extendedmind&lt;/a&gt;&lt;/aside&gt;&lt;/div&gt;
&lt;p&gt;
In contrast, once the data is available as Python objects, I can easily plug it into existing tools, libraries and frameworks.
It makes building new tools considerably easier and opens up new ways of interacting with the data.
&lt;/p&gt;
&lt;p&gt;
I tried different things over the years and I think I'm getting to the point where other people can also benefit from my code by 'just' plugging in their data,
and that's why I'm sharing this.
&lt;/p&gt;
&lt;p&gt;
Imagine if all your life was reflected digitally and available at your fingertips.
This library is my attempt to achieve this vision.
&lt;/p&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#motivation"&gt;1. Why?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#package"&gt;2. How does a Python package help?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#database"&gt;Why don't you just put everything in a massive database?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#modules"&gt;3. What's inside?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#usecases"&gt;4. How do you use it?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#search"&gt;Instant search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#orger"&gt;orger&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#promnesia"&gt;promnesia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#timeline"&gt;timeline&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#interactive"&gt;5. Ad-hoc and interactive&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#lastfm"&gt;What were my music listening stats for 2018?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#hypothesis_stats"&gt;What are the most interesting Slate Star Codex posts I've read?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#exercise"&gt;Accessing exercise data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#kobo_progress"&gt;Book reading progress&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#messenger_stats"&gt;Messenger stats&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#roamresearch"&gt;Querying Roam Research database&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#input_data"&gt;6. How does it get input data?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#q_and_a"&gt;7. Q &amp;amp; A&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#why_python"&gt;Why Python?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#can_anyone_use_it"&gt;Can anyone use it?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#how_easy_to_use"&gt;How easy is it to use?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#privacy"&gt;What about privacy?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#should_i_use_it"&gt;But &lt;i&gt;should&lt;/i&gt; I use it?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#would_it_suit_me"&gt;Would it suit &lt;i&gt;me&lt;/i&gt;?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#what_it_isnt"&gt;What it isn't?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#links"&gt;8. Related links&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#fin"&gt;9. --&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="motivation"&gt;&lt;a class="headerlink" href="#motivation"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; Why?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
The main reason that led me to develop this is the dissatisfaction of the current situation:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
Our personal data is siloed and trapped across cloud services and various devices
&lt;/p&gt;
&lt;p&gt;
Even when it's possible to access it via the API, it's hardly useful, unless you're an experienced programmer, willing to invest your time and infrastructure.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
We have insane amounts of data scattered across the cloud, yet we're left at the mercy of those who collect it to provide something useful based on it
&lt;/p&gt;
&lt;p&gt;
Integrations of data across silo boundaries are almost non-existent. There is so much potential and it's all wasted.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
I'm not willing to wait till some vaporwave project reinvents the whole computing model from scratch
&lt;/p&gt;
&lt;p&gt;
As a programmer, I am in capacity to do something &lt;b&gt;right now&lt;/b&gt;, even though it's not necessarily perfect and consistent.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I've written a lot about it &lt;a href="sad-infra.html#why"&gt;here&lt;/a&gt;, so allow me to simply quote:
&lt;/p&gt;
&lt;blockquote&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;search and information access
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why can't I search over all of my personal chat history with a friend, whether it's ICQ logs from 2005 or Whatsapp logs from 2019?&lt;/li&gt;
&lt;li&gt;Why can't I have incremental search over my tweets? Or browser bookmarks? Or over everything I've ever typed/read on the Internet?&lt;/li&gt;
&lt;li&gt;Why can't I search across my watched youtube videos, even though most of them have subtitles hence allowing for full text search?&lt;/li&gt;
&lt;li&gt;Why can't I see the places my friends recommended me on Google maps (or any other maps app)?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;productivity
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why can't my Google Home add shopping list items to Google Keep? Let alone other todo-list apps.&lt;/li&gt;
&lt;li&gt;Why can't I create a task in my todo list or calendar from a conversation on Facebook Messenger/Whatsapp/VK.com/Telegram?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;journaling and history
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why do I have to lose all my browser history if I decide to switch browsers?&lt;/li&gt;
&lt;li&gt;Why can't I see all the places I traveled to on a single map and photos alongside?&lt;/li&gt;
&lt;li&gt;Why can't I see what my heart rate (i.e. excitement) and speed were side by side with the video I recorded on GoPro while skiing?&lt;/li&gt;
&lt;li&gt;Why can't I easily transfer all my books and metadata if I decide to switch from Kindle to PocketBook or vice versa?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;consuming digital content
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why can't I see stuff I highlighted on Instapaper as an overlay on top of web page?&lt;/li&gt;
&lt;li&gt;Why can't I have single 'read it later' list, unifying all things saved on Reddit/Hackernews/Pocket?&lt;/li&gt;
&lt;li&gt;Why can't I use my todo app instead of 'Watch later' playlist on youtube?&lt;/li&gt;
&lt;li&gt;Why can't I 'follow' some user on Hackernews?&lt;/li&gt;
&lt;li&gt;Why can't I see if I've run across a Youtube video because my friend sent me a link months ago?&lt;/li&gt;
&lt;li&gt;Why can't I have uniform music listening stats based on my Last.fm/iTunes/Bandcamp/Spotify/Youtube?&lt;/li&gt;
&lt;li&gt;Why am I forced to use Spotify's music recommendation algorithm and don't have an option to try something else?&lt;/li&gt;
&lt;li&gt;Why can't I easily see what were the books/music/art recommended by my friends or some specific Twitter/Reddit/Hackernews users?&lt;/li&gt;
&lt;li&gt;&lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2019-12-15 05:35]&lt;/span&gt;&lt;/span&gt; Why my otherwise perfect hackernews &lt;a href="https://play.google.com/store/apps/details?id=io.github.hidroh.materialistic"&gt;app for Android&lt;/a&gt; doesn't share saved posts/comments with the website?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;health and body maintenance
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why can't I tell if I was more sedentary than usual during the past week and whether I need to compensate by doing a bit more exercise?&lt;/li&gt;
&lt;li&gt;Why can't I see what's the impact of aerobic exercise on my resting HR?&lt;/li&gt;
&lt;li&gt;Why can't I have a dashboard for all of my health: food, exercise and sleep to see baselines and trends?&lt;/li&gt;
&lt;li&gt;Why can't I see the impact of temperature or CO2 concentration in room on my sleep?&lt;/li&gt;
&lt;li&gt;Why can't I see how holidays (as in, not going to work) impact my stress levels?&lt;/li&gt;
&lt;li&gt;Why can't I take my Headspace app data and see how/if meditation impacts my sleep?&lt;/li&gt;
&lt;li&gt;Why can't I run a short snippet of code and check some random health advice on the Internet against &lt;b&gt;my&lt;/b&gt; health data.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;personal finance
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why am I forced to manually copy transactions from different banking apps into a spreadsheet?&lt;/li&gt;
&lt;li&gt;Why can't I easily match my Amazon/Ebay orders with my bank transactions?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;why I can't do anything when I'm offline or have a wonky connection?&lt;/li&gt;
&lt;li&gt;tools for thinking and learning
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why when something like &lt;a href="https://en.wikipedia.org/wiki/Method_of_loci"&gt;'mind palace'&lt;/a&gt; is &lt;b&gt;literally possible&lt;/b&gt; with VR technology, we don't see any in use?&lt;/li&gt;
&lt;li&gt;Why can't I easily convert select Instapaper highlights or new foreign words I encountered on my Kindle into Anki flashcards?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;mediocre interfaces
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why do I have to suffer from poor management and design decisions in UI changes, even if the interface is not the main reason I'm using the product?&lt;/li&gt;
&lt;li&gt;Why can't I leave priorities and notes on my saved Reddit/Hackernews items?&lt;/li&gt;
&lt;li&gt;Why can't I leave private notes on Deliveroo restaurants/dishes, so I'd remember what to order/not to order next time?&lt;/li&gt;
&lt;li&gt;Why do people have to suffer from Google Inbox shutdown?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;communication and collaboration
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why can't I easily share my web or book highlights with a friend? Or just make highlights in select books public?&lt;/li&gt;
&lt;li&gt;Why can't I easily find out other person's expertise without interrogating them, just by looking what they read instead?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;backups
&lt;ul class="org-ul"&gt;
&lt;li&gt;Why do I have to think about it and actively invest time and effort?&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;I'm tired of having to use multiple different messengers and social networks&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
I'm tired of shitty bloated interfaces
&lt;/p&gt;
&lt;p&gt;
Why do we have to be at mercy of their developers, designers and product managers? If we had our data at hand, we could fine-tune interfaces for our needs.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
I'm tired of mediocre search experience
&lt;/p&gt;
&lt;p&gt;
Text search is something computers do &lt;b&gt;exceptionally&lt;/b&gt; well.
Yet, often it's not available offline, it's not incremental, everyone reinvents their own query language, and so on.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
I'm frustrated by poor information exploring and processing experience
&lt;/p&gt;
&lt;p&gt;
While for many people, services like Reddit or Twitter are simply time killers (and I don't judge), some want to use them efficiently, as a source of information/research.
Modern bookmarking experience makes it far from perfect.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
You can dismiss this as a list of first-world problems, and you would be right, they are.
But the major reason I want to solve these problems is to be better at learning and working with knowledge,
so I could be better at solving the real problems.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="package"&gt;&lt;a class="headerlink" href="#package"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; How does a Python package help?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
When I started solving some of these problems for myself, I've noticed a common pattern: the &lt;a href="sad-infra.html#exports_are_hard"&gt;hardest bit&lt;/a&gt; is actually getting your data in the first place.
It's inherently error-prone and frustrating.
&lt;/p&gt;
&lt;p&gt;
But once you have the data in a convenient representation, working with it is pleasant – you get to &lt;b&gt;explore and build instead of fighting with yet another stupid REST API&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
This package knows how to find data on your filesystem, deserialize it and normalize it to a convenient representation.
You have the full power of the programming language to transform the data and do whatever comes to your mind.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="database"&gt;&lt;a class="headerlink" href="#database"&gt;¶&lt;/a&gt;Why don't you just put everything in a massive database?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Glad you've asked! I wrote a whole &lt;a href="unnecessary-db.html"&gt;post&lt;/a&gt; about it.
&lt;/p&gt;
&lt;p&gt;
In short: while databases are efficient and easy to read from, often they aren't flexible enough to fit your data.
You're probably going to end up writing code anyway.
&lt;/p&gt;
&lt;p&gt;
While working with your data, you'll inevitably notice common patterns and code repetition, which you'll probably want to extract somewhere.
That's where a Python package comes in.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="modules"&gt;&lt;a class="headerlink" href="#modules"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; What's inside?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Here's the (incomplete) list of the modules:
&lt;/p&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-left"/&gt;
&lt;col class="org-left"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/arbtt.py"&gt;&lt;samp class="inline"&gt;my.arbtt&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/nomeata/arbtt#arbtt-the-automatic-rule-based-time-tracker"&gt;Arbtt&lt;/a&gt; time tracking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/bluemaestro.py"&gt;&lt;samp class="inline"&gt;my.bluemaestro&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://bluemaestro.com/products/product-details/bluetooth-environmental-monitor-and-logger"&gt;Bluemaestro&lt;/a&gt; temperature/humidity/pressure monitor&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/body/blood.py"&gt;&lt;samp class="inline"&gt;my.body.blood&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Blood tracking (manual org-mode entries)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/body/exercise/all.py"&gt;&lt;samp class="inline"&gt;my.body.exercise.all&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Combined exercise data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/body/exercise/cardio.py"&gt;&lt;samp class="inline"&gt;my.body.exercise.cardio&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Cardio data, filtered from various data sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/body/exercise/cross_trainer.py"&gt;&lt;samp class="inline"&gt;my.body.exercise.cross_trainer&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;My cross trainer exercise data, arbitrated from different sources (mainly, Endomondo and manual text notes)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/body/weight.py"&gt;&lt;samp class="inline"&gt;my.body.weight&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Weight data (manually logged)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/calendar/holidays.py"&gt;&lt;samp class="inline"&gt;my.calendar.holidays&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Holidays and days off work&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/coding/commits.py"&gt;&lt;samp class="inline"&gt;my.coding.commits&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Git commits data for repositories on your filesystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/demo.py"&gt;&lt;samp class="inline"&gt;my.demo&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Just a demo module for testing and documentation purposes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/emfit/__init__.py"&gt;&lt;samp class="inline"&gt;my.emfit&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://shop-eu.emfit.com/products/emfit-qs"&gt;Emfit QS&lt;/a&gt; sleep tracker&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/endomondo.py"&gt;&lt;samp class="inline"&gt;my.endomondo&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Endomondo exercise data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/fbmessenger.py"&gt;&lt;samp class="inline"&gt;my.fbmessenger&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Facebook Messenger messages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/foursquare.py"&gt;&lt;samp class="inline"&gt;my.foursquare&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Foursquare/Swarm checkins&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/github/all.py"&gt;&lt;samp class="inline"&gt;my.github.all&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Unified Github data (merged from GDPR export and periodic API updates)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/github/gdpr.py"&gt;&lt;samp class="inline"&gt;my.github.gdpr&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Github data (uses &lt;a href="https://github.com/settings/admin"&gt;official GDPR export&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/github/ghexport.py"&gt;&lt;samp class="inline"&gt;my.github.ghexport&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Github data: events, comments, etc. (API data)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/goodreads.py"&gt;&lt;samp class="inline"&gt;my.goodreads&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://www.goodreads.com"&gt;Goodreads&lt;/a&gt; statistics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/hypothesis.py"&gt;&lt;samp class="inline"&gt;my.hypothesis&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://hypothes.is"&gt;Hypothes.is&lt;/a&gt; highlights and annotations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/instapaper.py"&gt;&lt;samp class="inline"&gt;my.instapaper&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://www.instapaper.com"&gt;Instapaper&lt;/a&gt; bookmarks, highlights and annotations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/kobo.py"&gt;&lt;samp class="inline"&gt;my.kobo&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://uk.kobobooks.com/products/kobo-aura-one"&gt;Kobo&lt;/a&gt; e-ink reader: annotations and reading stats&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/lastfm.py"&gt;&lt;samp class="inline"&gt;my.lastfm&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Last.fm scrobbles&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/location/google.py"&gt;&lt;samp class="inline"&gt;my.location.google&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Location data from Google Takeout&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/location/home.py"&gt;&lt;samp class="inline"&gt;my.location.home&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Simple location provider, serving as a fallback when more detailed data isn't available&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/materialistic.py"&gt;&lt;samp class="inline"&gt;my.materialistic&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://play.google.com/store/apps/details?id=io.github.hidroh.materialistic"&gt;Materialistic&lt;/a&gt; app for Hackernews&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/orgmode.py"&gt;&lt;samp class="inline"&gt;my.orgmode&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Programmatic access and queries to org-mode files on the filesystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/pdfs.py"&gt;&lt;samp class="inline"&gt;my.pdfs&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;PDF documents and annotations on your filesystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/photos/main.py"&gt;&lt;samp class="inline"&gt;my.photos.main&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Photos and videos on your filesystem, their GPS and timestamps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/pinboard.py"&gt;&lt;samp class="inline"&gt;my.pinboard&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://pinboard.in"&gt;Pinboard&lt;/a&gt; bookmarks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/pocket.py"&gt;&lt;samp class="inline"&gt;my.pocket&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://getpocket.com"&gt;Pocket&lt;/a&gt; bookmarks and highlights&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/reading/polar.py"&gt;&lt;samp class="inline"&gt;my.reading.polar&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/burtonator/polar-bookshelf"&gt;Polar&lt;/a&gt; articles and highlights&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/reddit.py"&gt;&lt;samp class="inline"&gt;my.reddit&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Reddit data: saved items/comments/upvotes/etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/rescuetime.py"&gt;&lt;samp class="inline"&gt;my.rescuetime&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Rescuetime (phone activity tracking) data.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/roamresearch.py"&gt;&lt;samp class="inline"&gt;my.roamresearch&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://roamresearch.com"&gt;Roam&lt;/a&gt; data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/rss/all.py"&gt;&lt;samp class="inline"&gt;my.rss.all&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Unified RSS data, merged from different services I used historically&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/rss/feedbin.py"&gt;&lt;samp class="inline"&gt;my.rss.feedbin&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Feedbin RSS reader&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/rss/feedly.py"&gt;&lt;samp class="inline"&gt;my.rss.feedly&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Feedly RSS reader&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/rtm.py"&gt;&lt;samp class="inline"&gt;my.rtm&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://rememberthemilk.com"&gt;Remember The Milk&lt;/a&gt; tasks and notes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/runnerup.py"&gt;&lt;samp class="inline"&gt;my.runnerup&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/jonasoreland/runnerup"&gt;Runnerup&lt;/a&gt; exercise data (TCX format)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/smscalls.py"&gt;&lt;samp class="inline"&gt;my.smscalls&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Phone calls and SMS messages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/stackexchange/gdpr.py"&gt;&lt;samp class="inline"&gt;my.stackexchange.gdpr&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Stackexchange data (uses &lt;a href="https://stackoverflow.com/legal/gdpr/request"&gt;official GDPR export&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/stackexchange/stexport.py"&gt;&lt;samp class="inline"&gt;my.stackexchange.stexport&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Stackexchange data (uses API via &lt;a href="https://github.com/karlicoss/stexport"&gt;stexport&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/taplog.py"&gt;&lt;samp class="inline"&gt;my.taplog&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;a href="https://play.google.com/store/apps/details?id=com.waterbear.taglog"&gt;Taplog&lt;/a&gt; app data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/time/tz/main.py"&gt;&lt;samp class="inline"&gt;my.time.tz.main&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Timezone data provider, used to localize timezone-unaware timestamps for other modules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/time/tz/via_location.py"&gt;&lt;samp class="inline"&gt;my.time.tz.via_location&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Timezone data provider, guesses timezone based on location data (e.g. GPS)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/twitter/all.py"&gt;&lt;samp class="inline"&gt;my.twitter.all&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Unified Twitter data (merged from the archive and periodic updates)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/twitter/archive.py"&gt;&lt;samp class="inline"&gt;my.twitter.archive&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Twitter data (uses &lt;a href="https://help.twitter.com/en/managing-your-account/how-to-download-your-twitter-archive"&gt;official twitter archive export&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/twitter/twint.py"&gt;&lt;samp class="inline"&gt;my.twitter.twint&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;Twitter data (tweets and favorites). Uses &lt;a href="https://github.com/twintproject/twint"&gt;Twint&lt;/a&gt; data export.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;&lt;a href="https://github.com/karlicoss/HPI/tree/master/my/vk/vk_messages_backup.py"&gt;&lt;samp class="inline"&gt;my.vk.vk_messages_backup&lt;/samp&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;VK data (exported by &lt;a href="https://github.com/Totktonada/vk_messages_backup"&gt;Totktonada/vk&lt;sub&gt;messages&lt;/sub&gt;&lt;sub&gt;backup&lt;/sub&gt;&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
Some modules are private, and need a bit of cleanup before merging:
&lt;/p&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-left"/&gt;
&lt;col class="org-left"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;my.workouts&lt;/td&gt;
&lt;td class="org-left"&gt;Exercise activity, from Endomondo and manual logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;my.sleep.manual&lt;/td&gt;
&lt;td class="org-left"&gt;Subjective sleep data, manually logged&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;my.nutrition&lt;/td&gt;
&lt;td class="org-left"&gt;Food and drink consumption data, logged manually from different sources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;my.money&lt;/td&gt;
&lt;td class="org-left"&gt;Expenses and shopping data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;my.webhistory&lt;/td&gt;
&lt;td class="org-left"&gt;Browsing history (part of &lt;a href="https://github.com/karlicoss/promnesia"&gt;promnesia&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div id="usecases"&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="usecases"&gt;&lt;a class="headerlink" href="#usecases"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; How do you use it?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Mainly I use it as a data provider for my scripts, tools, and dashboards.
&lt;/p&gt;
&lt;p&gt;
Also, check out &lt;a href="myinfra.html#mypkg"&gt;my infrastructure map&lt;/a&gt;. It might be helpful for understanding what's my vision on HPI.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="search"&gt;&lt;a class="headerlink" href="#search"&gt;¶&lt;/a&gt;Instant search&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Typical search interfaces make me unhappy as they are &lt;b&gt;siloed, slow, awkward to use and don't work offline&lt;/b&gt;.
So I built my own ways around it! I write about it in detail &lt;a href="./pkm-search.html#personal_information"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
In essence, I'm mirroring most of my online data like chat logs, comments, etc., as plaintext.
I can overview it in any text editor, and incrementally search over &lt;b&gt;all of it&lt;/b&gt; in a single keypress.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="orger"&gt;&lt;a class="headerlink" href="#orger"&gt;¶&lt;/a&gt;orger&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;a href="https://github.com/karlicoss/orger"&gt;orger&lt;/a&gt; is a tool that helps you generate an org-mode representation of your data.
&lt;/p&gt;
&lt;p&gt;
It lets you benefit from the existing tooling and infrastructure around org-mode, the most famous being Emacs.
&lt;/p&gt;
&lt;p&gt;
I'm using it for:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;searching, overviewing and navigating the data&lt;/li&gt;
&lt;li&gt;creating tasks straight from the apps (e.g. Reddit/Telegram)&lt;/li&gt;
&lt;li&gt;spaced repetition via &lt;a href="https://orgmode.org/worg/org-contrib/org-drill.html"&gt;org-drill&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Orger comes with some existing &lt;a href="https://github.com/karlicoss/orger/tree/master/modules"&gt;modules&lt;/a&gt;, but it should be easy to adapt your own data source if you need something else.
&lt;/p&gt;
&lt;p&gt;
I write about it in detail &lt;a href="./orger.html"&gt;here&lt;/a&gt;and &lt;a href="./orger-todos.html"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="promnesia"&gt;&lt;a class="headerlink" href="#promnesia"&gt;¶&lt;/a&gt;promnesia&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;a href="https://github.com/karlicoss/promnesia#demo"&gt;promnesia&lt;/a&gt; is a browser extension I'm working on to escape silos by &lt;b&gt;unifying annotations and browsing history&lt;/b&gt; from different data sources.
&lt;/p&gt;
&lt;p&gt;
I've been using it for more than a year now and working on final touches to properly release it for other people.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="dashboard"&gt;&lt;a class="headerlink" href="#dashboard"&gt;¶&lt;/a&gt;dashboard&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
As a big fan of &lt;a class="post-tag" href="./tags.html#quantified-self"&gt;#quantified-self&lt;/a&gt;, I'm working on personal health, sleep and exercise dashboard, built from various data sources.
&lt;/p&gt;
&lt;p&gt;
I'm working on making it public, you can see some screenshots &lt;a href="https://www.reddit.com/r/QuantifiedSelf/comments/cokt4f/what_do_you_all_do_with_your_data/ewmucgk"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="timeline"&gt;&lt;a class="headerlink" href="#timeline"&gt;¶&lt;/a&gt;timeline&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Timeline is a &lt;a class="post-tag" href="./tags.html#lifelogging"&gt;#lifelogging&lt;/a&gt; project I'm working on.
&lt;/p&gt;
&lt;p&gt;
I want to see all my digital history, search in it, filter, easily jump at a specific point in time and see the context when it happened.
That way it works as a sort of external memory.
&lt;/p&gt;
&lt;p&gt;
Ideally, it would look similar to Andrew Louis's &lt;a href="https://hyfen.net/memex"&gt;Memex&lt;/a&gt;, or might even reuse his interface if
he open sources it. I highly recommend watching his talk for inspiration.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="interactive"&gt;&lt;a class="headerlink" href="#interactive"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;5&lt;/span&gt; Ad-hoc and interactive&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;span id="examples" style="visibility:hidden"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="lastfm"&gt;&lt;a class="headerlink" href="#lastfm"&gt;¶&lt;/a&gt;What were my music listening stats for 2018?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Single import away from getting tracks you listened to:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;from&lt;/span&gt; my.lastfm &lt;span class="org-keyword"&gt;import&lt;/span&gt; scrobbles
&lt;span class="org-builtin"&gt;list&lt;/span&gt;(scrobbles())[200: 205]
&lt;/pre&gt;
&lt;/div&gt;
&lt;pre class="example"&gt;[Scrobble(raw={'album': 'Nevermind', 'artist': 'Nirvana', 'date': '1282488504', 'name': 'Drain You'}),
 Scrobble(raw={'album': 'Dirt', 'artist': 'Alice in Chains', 'date': '1282489764', 'name': 'Would?'}),
 Scrobble(raw={'album': 'Bob Dylan: The Collection', 'artist': 'Bob Dylan', 'date': '1282493517', 'name': 'Like a Rolling Stone'}),
 Scrobble(raw={'album': 'Dark Passion Play', 'artist': 'Nightwish', 'date': '1282493819', 'name': 'Amaranth'}),
 Scrobble(raw={'album': 'Rolled Gold +', 'artist': 'The Rolling Stones', 'date': '1282494161', 'name': "You Can't Always Get What You Want"})]
&lt;/pre&gt;
&lt;p&gt;
Or, as a pretty Pandas frame:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;import&lt;/span&gt; pandas &lt;span class="org-keyword"&gt;as&lt;/span&gt; pd
&lt;span class="org-variable-name"&gt;df&lt;/span&gt; = pd.DataFrame([{
    &lt;span class="org-string"&gt;'dt'&lt;/span&gt;: s.dt,
    &lt;span class="org-string"&gt;'track'&lt;/span&gt;: s.track,
} &lt;span class="org-keyword"&gt;for&lt;/span&gt; s &lt;span class="org-keyword"&gt;in&lt;/span&gt; scrobbles()]).set_index(&lt;span class="org-string"&gt;'dt'&lt;/span&gt;)
df[200: 205]
&lt;/pre&gt;
&lt;/div&gt;
&lt;pre class="example"&gt;                                                                       track
dt                                                                          
2010-08-22 14:48:24+00:00                                Nirvana — Drain You
2010-08-22 15:09:24+00:00                           Alice in Chains — Would?
2010-08-22 16:11:57+00:00                   Bob Dylan — Like a Rolling Stone
2010-08-22 16:16:59+00:00                               Nightwish — Amaranth
2010-08-22 16:22:41+00:00  The Rolling Stones — You Can't Always Get What...
&lt;/pre&gt;
&lt;p&gt;
We can use &lt;a href="https://github.com/martijnvermaat/calmap"&gt;calmap&lt;/a&gt; library to plot a github-style music listening activity heatmap:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;import&lt;/span&gt; matplotlib.pyplot &lt;span class="org-keyword"&gt;as&lt;/span&gt; plt
plt.figure(figsize=(10, 2.3))

&lt;span class="org-keyword"&gt;import&lt;/span&gt; calmap
&lt;span class="org-variable-name"&gt;df&lt;/span&gt; = df.set_index(df.index.tz_localize(&lt;span class="org-constant"&gt;None&lt;/span&gt;)) &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;calmap expects tz-unaware dates&lt;/span&gt;
calmap.yearplot(df[&lt;span class="org-string"&gt;'track'&lt;/span&gt;], how=&lt;span class="org-string"&gt;'count'&lt;/span&gt;, year=2018)

plt.tight_layout()
plt.title(&lt;span class="org-string"&gt;'My music listening activity for 2018'&lt;/span&gt;)
&lt;span class="org-variable-name"&gt;plot_file&lt;/span&gt; = &lt;span class="org-string"&gt;'hpi_files/lastfm_2018.png'&lt;/span&gt;
plt.savefig(plot_file)
plot_file
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img alt="lastfm_2018.png" src="hpi_files/lastfm_2018.png"/&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
This isn't necessarily very insightful data, but fun to look at now and then!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="hypothesis_stats"&gt;&lt;a class="headerlink" href="#hypothesis_stats"&gt;¶&lt;/a&gt;What are the most interesting Slate Star Codex posts I've read?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
My friend asked me if I could recommend them posts I found interesting on &lt;a href="https://slatestarcodex.com"&gt;Slate Star Codex&lt;/a&gt;.
With few lines of Python I can quickly recommend them posts I engaged most with, i.e. the ones I annotated most on &lt;a href="https://hypothes.is"&gt;Hypothesis&lt;/a&gt;.
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;from&lt;/span&gt; my.hypothesis &lt;span class="org-keyword"&gt;import&lt;/span&gt; pages
&lt;span class="org-keyword"&gt;from&lt;/span&gt; collections &lt;span class="org-keyword"&gt;import&lt;/span&gt; Counter
&lt;span class="org-variable-name"&gt;cc&lt;/span&gt; = Counter({(p.title + &lt;span class="org-string"&gt;' '&lt;/span&gt; + p.url): &lt;span class="org-builtin"&gt;len&lt;/span&gt;(p.highlights) &lt;span class="org-keyword"&gt;for&lt;/span&gt; p &lt;span class="org-keyword"&gt;in&lt;/span&gt; pages() &lt;span class="org-keyword"&gt;if&lt;/span&gt; &lt;span class="org-string"&gt;'slatestarcodex'&lt;/span&gt; &lt;span class="org-keyword"&gt;in&lt;/span&gt; p.url})
&lt;span class="org-keyword"&gt;return&lt;/span&gt; cc.most_common(10)
&lt;/pre&gt;
&lt;/div&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-left"/&gt;
&lt;col class="org-right"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;The Anti-Reactionary FAQ &lt;a href="http://slatestarcodex.com/2013/10/20/the-anti-reactionary-faq/"&gt;http://slatestarcodex.com/2013/10/20/the-anti-reactionary-faq/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;32&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;Reactionary Philosophy In An Enormous, Planet-Sized Nutshell &lt;a href="https://slatestarcodex.com/2013/03/03/reactionary-philosophy-in-an-enormous-planet-sized-nutshell/"&gt;https://slatestarcodex.com/2013/03/03/reactionary-philosophy-in-an-enormous-planet-sized-nutshell/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;17&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;The Toxoplasma Of Rage &lt;a href="http://slatestarcodex.com/2014/12/17/the-toxoplasma-of-rage/"&gt;http://slatestarcodex.com/2014/12/17/the-toxoplasma-of-rage/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;What Universal Human Experiences Are You Missing Without Realizing It? &lt;a href="https://slatestarcodex.com/2014/03/17/what-universal-human-experiences-are-you-missing-without-realizing-it/"&gt;https://slatestarcodex.com/2014/03/17/what-universal-human-experiences-are-you-missing-without-realizing-it/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;Meditations On Moloch &lt;a href="http://slatestarcodex.com/2014/07/30/meditations-on-moloch/"&gt;http://slatestarcodex.com/2014/07/30/meditations-on-moloch/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;12&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;Universal Love, Said The Cactus Person &lt;a href="http://slatestarcodex.com/2015/04/21/universal-love-said-the-cactus-person/"&gt;http://slatestarcodex.com/2015/04/21/universal-love-said-the-cactus-person/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;11&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;Untitled &lt;a href="http://slatestarcodex.com/2015/01/01/untitled/"&gt;http://slatestarcodex.com/2015/01/01/untitled/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;11&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;Considerations On Cost Disease &lt;a href="https://slatestarcodex.com/2017/02/09/considerations-on-cost-disease/"&gt;https://slatestarcodex.com/2017/02/09/considerations-on-cost-disease/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;In Defense of Psych Treatment for Attempted Suicide &lt;a href="http://slatestarcodex.com/2013/04/25/in-defense-of-psych-treatment-for-attempted-suicide/"&gt;http://slatestarcodex.com/2013/04/25/in-defense-of-psych-treatment-for-attempted-suicide/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-left"&gt;I Can Tolerate Anything Except The Outgroup &lt;a href="https://slatestarcodex.com/2014/09/30/i-can-tolerate-anything-except-the-outgroup/"&gt;https://slatestarcodex.com/2014/09/30/i-can-tolerate-anything-except-the-outgroup/&lt;/a&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="exercise"&gt;&lt;a class="headerlink" href="#exercise"&gt;¶&lt;/a&gt;Accessing exercise data&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;span id="workouts" style="visibility:hidden"&gt;&lt;/span&gt; E.g. see use of &lt;code class="inline"&gt;my.workouts&lt;/code&gt; &lt;a href="./heartbeats_vs_kcals.html"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="kobo_progress"&gt;&lt;a class="headerlink" href="#kobo_progress"&gt;¶&lt;/a&gt;Book reading progress&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
I publish my reading stats on &lt;a href="https://www.goodreads.com/user/show/22191391-dima-gerasimov"&gt;Goodreads&lt;/a&gt; so other people can see what I'm reading/have read, but Kobo &lt;a href="https://beepb00p.xyz/ideas.html#kobo2goodreads"&gt;lacks integration&lt;/a&gt; with Goodreads.
I'm using &lt;a href="https://github.com/karlicoss/kobuddy"&gt;kobuddy&lt;/a&gt; to access my my Kobo data, and I've got a regular task that reminds me to sync my progress once a month.
&lt;/p&gt;
&lt;p&gt;
The task looks like this:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-org"&gt;&lt;span class="org-org-level-1"&gt;* &lt;/span&gt;&lt;span class="org-org-todo"&gt;TODO&lt;/span&gt;&lt;span class="org-org-level-1"&gt; &lt;/span&gt;&lt;span class="org-org-priority"&gt;[#C]&lt;/span&gt;&lt;span class="org-org-level-1"&gt; sync &lt;/span&gt;&lt;span class="org-org-link"&gt;&lt;a href="https://goodreads.com"&gt;reading progress&lt;/a&gt;&lt;/span&gt;&lt;span class="org-org-level-1"&gt; with kobo&lt;/span&gt;
  &lt;span class="org-org-special-keyword"&gt;DEADLINE:&lt;/span&gt; &lt;span class="org-org-date"&gt;&amp;lt;2019-11-24 Sun .+4w -0d&amp;gt;&lt;/span&gt;
&lt;span class="org-org-link"&gt;&lt;a href="eshell: python3 -c 'import my.kobo; my.kobo.print_progress()'"&gt;eshell: python3 -c 'import my.kobo; my.kobo.print_progress()'&lt;/a&gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
With a single Enter keypress on the inlined &lt;samp class="inline"&gt;eshell:&lt;/samp&gt; command I can print the progress and fill in the completed books on Goodreads, e.g.:
&lt;/p&gt;
&lt;pre class="example"&gt;
A_Mathematician's_Apology by G. H. Hardy
Started : 21 Aug 2018 11:44
Finished: 22 Aug 2018 12:32

Fear and Loathing in Las Vegas: A Savage Journey to the Heart of the American Dream (Vintage) by Thompson, Hunter S.
Started : 06 Sep 2018 05:54
Finished: 09 Sep 2018 12:21

Sapiens: A Brief History of Humankind by Yuval Noah Harari
Started : 09 Sep 2018 12:22
Finished: 16 Sep 2018 07:25

Inadequate Equilibria: Where and How Civilizations Get Stuck by Eliezer Yudkowsky
Started : 31 Jul 2018 22:54
Finished: 16 Sep 2018 07:25

Albion Dreaming by Andy Roberts
Started : 20 Aug 2018 21:16
Finished: 16 Sep 2018 07:26
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="messenger_stats"&gt;&lt;a class="headerlink" href="#messenger_stats"&gt;¶&lt;/a&gt;Messenger stats&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How much do I chat on Facebook Messenger?
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;from&lt;/span&gt; my.fbmessenger &lt;span class="org-keyword"&gt;import&lt;/span&gt; messages

&lt;span class="org-keyword"&gt;import&lt;/span&gt; pandas &lt;span class="org-keyword"&gt;as&lt;/span&gt; pd
&lt;span class="org-keyword"&gt;import&lt;/span&gt; matplotlib.pyplot &lt;span class="org-keyword"&gt;as&lt;/span&gt; plt

&lt;span class="org-variable-name"&gt;df&lt;/span&gt; = pd.DataFrame({&lt;span class="org-string"&gt;'dt'&lt;/span&gt;: m.dt, &lt;span class="org-string"&gt;'messages'&lt;/span&gt;: 1} &lt;span class="org-keyword"&gt;for&lt;/span&gt; m &lt;span class="org-keyword"&gt;in&lt;/span&gt; messages())
df.set_index(&lt;span class="org-string"&gt;'dt'&lt;/span&gt;, inplace=&lt;span class="org-constant"&gt;True&lt;/span&gt;)

&lt;span class="org-variable-name"&gt;df&lt;/span&gt; = df.resample(&lt;span class="org-string"&gt;'M'&lt;/span&gt;).&lt;span class="org-builtin"&gt;sum&lt;/span&gt;() &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;by month&lt;/span&gt;
&lt;span class="org-variable-name"&gt;df&lt;/span&gt; = df.loc[&lt;span class="org-string"&gt;'2016-01-01'&lt;/span&gt;:&lt;span class="org-string"&gt;'2019-01-01'&lt;/span&gt;] &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;past subset for determinism&lt;/span&gt;

&lt;span class="org-variable-name"&gt;fig&lt;/span&gt;, &lt;span class="org-variable-name"&gt;ax&lt;/span&gt; = plt.subplots(figsize=(15, 5))
df.plot(kind=&lt;span class="org-string"&gt;'bar'&lt;/span&gt;, ax=ax)

&lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;todo wonder if that vvv can be less verbose...&lt;/span&gt;
&lt;span class="org-variable-name"&gt;x_labels&lt;/span&gt; = df.index.strftime(&lt;span class="org-string"&gt;'%Y %b'&lt;/span&gt;)
ax.set_xticklabels(x_labels)

&lt;span class="org-variable-name"&gt;plot_file&lt;/span&gt; = &lt;span class="org-string"&gt;'hpi_files/messenger_2016_to_2019.png'&lt;/span&gt;
plt.tight_layout()
plt.savefig(plot_file)
&lt;span class="org-keyword"&gt;return&lt;/span&gt; plot_file
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img alt="messenger_2016_to_2019.png" src="hpi_files/messenger_2016_to_2019.png"/&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="roamresearch"&gt;&lt;a class="headerlink" href="#roamresearch"&gt;¶&lt;/a&gt;Querying Roam Research database&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
I've got some code examples &lt;a href="myinfra-roam.html#interactive"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="input_data"&gt;&lt;a class="headerlink" href="#input_data"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;6&lt;/span&gt; How does it get input data?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
If you're curious about any specific data sources I'm using, I've written it up &lt;a href="https://beepb00p.xyz/my-data.html"&gt;in detail&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Also see &lt;a href="https://github.com/karlicoss/HPI/blob/master/doc/SETUP.org#data-flow"&gt;"Data flow"&lt;/a&gt; documentation with some nice diagrams explaining on specific examples.
&lt;/p&gt;
&lt;p&gt;
In short:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
The data is &lt;a href="myinfra.html#exports"&gt;periodically synchronized&lt;/a&gt; from the services (cloud or not) locally, on the filesystem
&lt;/p&gt;
&lt;p&gt;
As a result, you get &lt;a href="myinfra.html#fs"&gt;JSONs/sqlite&lt;/a&gt; (or other formats, depending on the service) on your disk.
&lt;/p&gt;
&lt;p&gt;
Once you have it, it's trivial to back it up and synchronize to other computers/phones, if necessary.
&lt;/p&gt;
&lt;p&gt;
To schedule periodic sync, I'm using &lt;a href="scheduler.html#cron"&gt;cron&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;samp class="inline"&gt;my.&lt;/samp&gt; package only accesses the data on the filesystem
&lt;/p&gt;
&lt;p&gt;
That makes it extremely fast, reliable, and fully offline capable.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
As you can see, in such a setup, the data is lagging behind the 'realtime'.
I consider it a necessary sacrifice to make everything fast and resilient.
&lt;/p&gt;
&lt;p&gt;
In theory, it's possible to make the system almost realtime by having a service that sucks in data continuously (rather than periodically), but it's harder as well.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="q_and_a"&gt;&lt;a class="headerlink" href="#q_and_a"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;7&lt;/span&gt; Q &amp;amp; A&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="why_python"&gt;&lt;a class="headerlink" href="#why_python"&gt;¶&lt;/a&gt;Why Python?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
I don't consider Python unique as a language suitable for such a project.
It just happens to be the one I'm most comfortable with.
I do have some reasons that I think make it &lt;i&gt;specifically&lt;/i&gt; good, but explaining them is out of this post's scope.
&lt;/p&gt;
&lt;p&gt;
In addition, Python offers a &lt;a href="https://github.com/karlicoss/awesome-python#data-analysis"&gt;very rich ecosystem&lt;/a&gt; for data analysis, which we can use to our benefit.
&lt;/p&gt;
&lt;p&gt;
That said, I've never seen anything similar in other programming languages, and I would be really interested in, so please send me links if you know some.
I've heard LISPs are great for data? ;)
&lt;/p&gt;
&lt;p&gt;
Overall, I wish &lt;a href="https://en.wikipedia.org/wiki/Foreign_function_interface"&gt;FFIs&lt;/a&gt; were a bit more mature, so we didn't have to think about specific programming languages at all.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="can_anyone_use_it"&gt;&lt;a class="headerlink" href="#can_anyone_use_it"&gt;¶&lt;/a&gt;Can anyone use it?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Yes!
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;you can plug in &lt;b&gt;your own data&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;most modules are isolated, so you can only use the ones that you want to&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
everything is easily &lt;b&gt;extensible&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
Starting from simply adding new modules to any dynamic hackery you can possibly imagine within Python.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="how_easy_to_use"&gt;&lt;a class="headerlink" href="#how_easy_to_use"&gt;¶&lt;/a&gt;How easy is it to use?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
The whole setup requires some basic programmer literacy:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;installing/running and potentially modifying Python code&lt;/li&gt;
&lt;li&gt;using symlinks&lt;/li&gt;
&lt;li&gt;potentially running Cron jobs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
If you have any ideas on making the setup simpler, please let me know!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="privacy"&gt;&lt;a class="headerlink" href="#privacy"&gt;¶&lt;/a&gt;What about privacy?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
The modules contain &lt;b&gt;no data, only code&lt;/b&gt; to operate on the data.
&lt;/p&gt;
&lt;p&gt;
Everything is &lt;a href="./tags.html#offline"&gt;&lt;b&gt;local first&lt;/b&gt;&lt;/a&gt;, the input data is on your filesystem.
If you're truly paranoid, you can even wrap it in a Docker container.
&lt;/p&gt;
&lt;p&gt;
There is still a question of whether you trust yourself at even keeping all the data on your disk, but it is out of the scope of this post.
&lt;/p&gt;
&lt;p&gt;
If you'd rather keep some code private too, it's also trivial to achieve with a private subpackage.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="should_i_use_it"&gt;&lt;a class="headerlink" href="#should_i_use_it"&gt;¶&lt;/a&gt;But &lt;i&gt;should&lt;/i&gt; I use it?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;blockquote&gt;
&lt;p&gt;
Sure, maybe you can achieve a perfect system where you can instantly find and recall anything that you've done. Do you really want it?
Wouldn't that, like, make you less human?
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
I'm not a gatekeeper of what it means to be human, but I don't think that the shortcomings of the human brain are what makes us such.
&lt;/p&gt;
&lt;p&gt;
So I can't answer that for you. I certainly want it though.
I'm &lt;a href="./tags.html#pkm"&gt;quite open&lt;/a&gt; about my goals – I'd happily get merged/augmented with a computer to enhance my thinking and analytical abilities.
&lt;/p&gt;
&lt;p&gt;
While at the moment &lt;a href="https://en.wikipedia.org/wiki/Hard_problem_of_consciousness"&gt;we don't even remotely understand&lt;/a&gt; what would such merging or "mind uploading" entail exactly,
I can clearly delegate some tasks, like long term memory, information lookup, and data processing to a computer. They can already handle it really well.
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
What about these people who have perfect recall and wish they hadn't.
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
Sure, maybe it sucks. At the moment though, my recall is far from perfect, and this only annoys me.
I want to have a choice at least, and digital tools give me this choice.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="would_it_suit_me"&gt;&lt;a class="headerlink" href="#would_it_suit_me"&gt;¶&lt;/a&gt;Would it suit &lt;i&gt;me&lt;/i&gt;?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Probably, at least to some extent.
&lt;/p&gt;
&lt;p&gt;
First, our lives are different, so our APIs might be different too.
This is more of a demonstration of what's I'm using, although I did spend effort towards making it as modular and extensible as possible, so other people could use it too.
It's easy to modify code, add extra methods and modules. You can even keep all your modifications private.
&lt;/p&gt;
&lt;p&gt;
But after all, we've all sharing many similar activities and using the same products, so there is a huge overlap.
I'm not sure how far we can stretch it and keep modules generic enough to be used by multiple people. But let's give it a try perhaps? :)
&lt;/p&gt;
&lt;p&gt;
Second, interacting with your data through the code is the central idea of the project.
That kind of cuts off people without technical skills, and even many people capable of coding,
who dislike the idea of writing code outside of work.
&lt;/p&gt;
&lt;p&gt;
It might be possible to expose some &lt;a href="https://en.wikipedia.org/wiki/No-code_development_platform"&gt;no-code&lt;/a&gt; interfaces,
but I still feel that wouldn't be enough.
&lt;/p&gt;
&lt;p&gt;
I'm not sure whether it's a solvable problem at this point, but happy to hear any suggestions!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="what_it_isnt"&gt;&lt;a class="headerlink" href="#what_it_isnt"&gt;¶&lt;/a&gt;What it isn't?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
It's not vaporwave
&lt;/p&gt;
&lt;p&gt;
The project is a little crude, but it's real and working. I've been using it for a long time now, and find it fairly sustainable to keep using for the foreseeable future.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
It's not going to be another silo
&lt;/p&gt;
&lt;p&gt;
While I don't have anything against commercial use (and I believe any work in this area will benefit all of us), I'm not planning to build a product out of it.
&lt;/p&gt;
&lt;p&gt;
I really hope it can grow into or inspire some mature open source system.
&lt;/p&gt;
&lt;p&gt;
Please take my ideas and code and build something cool from it!
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="links"&gt;&lt;a class="headerlink" href="#links"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;8&lt;/span&gt; Related links&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Similar projects:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://hyfen.net/memex"&gt;Memex&lt;/a&gt; by Andrew Louis&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/novoid/Memacs"&gt;Memacs&lt;/a&gt; by Karl Voit&lt;/li&gt;
&lt;li&gt;&lt;a href="https://news.ycombinator.com/item?id=9615901"&gt;Me API - turn yourself into an open API (HN)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/markwk/qs_ledger"&gt;QS ledger&lt;/a&gt; from Mark Koester&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dogsheep.github.io"&gt;Dogsheep&lt;/a&gt;: a collection of tools for personal analytics using SQLite and Datasette&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/tehmantra/my"&gt;tehmantra/my&lt;/a&gt;: directly inspired by this package&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/bcongdon/bolero"&gt;bcongdon/bolero&lt;/a&gt;: exposes your personal data as a REST API&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Solid_(web_decentralization_project)#Design"&gt;Solid project&lt;/a&gt;: personal data pod, which websites pull data from&lt;/li&gt;
&lt;li&gt;&lt;a href="https://remotestorage.io"&gt;remoteStorage&lt;/a&gt;: open protocol for apps to write data to your own storage&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Other links:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;NetOpWibby: &lt;a href="https://news.ycombinator.com/item?id=21684949"&gt;A Personal API (HN)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="sad-infra.html"&gt;The sad state of personal data and infrastructure&lt;/a&gt;: here I am going into motivation and difficulties arising in the implementation&lt;/li&gt;
&lt;li&gt;&lt;a href="myinfra-roam.html"&gt;Extending my personal infrastructure&lt;/a&gt;: a followup, where I'm demonstrating how to integrate a new data source (Roam Research)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="fin"&gt;&lt;a class="headerlink" href="#fin"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;9&lt;/span&gt; --&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Open to any feedback and thoughts!
&lt;/p&gt;
&lt;p&gt;
Also, don't hesitate to raise an issue, or reach me personally if you want to try using it, and find the instructions confusing. Your questions would help me to make it simpler!
&lt;/p&gt;
&lt;p&gt;
In some near future I will write more about:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;specific technical decisions and patterns&lt;/li&gt;
&lt;li&gt;challenges I had so solve&lt;/li&gt;
&lt;li&gt;more use-cases and demos – it's impossible to fit everything in one post!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
, but happy to answer any questions on these topics now!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    &lt;/section&gt;

    
    &lt;section id="post-footer"&gt;
        &lt;div class="post-tags"&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#infra"&gt;#infra&lt;/a&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#pkm"&gt;#pkm&lt;/a&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#quantifiedself"&gt;#quantifiedself&lt;/a&gt;
            &lt;a class="post-tag tag-inactive" href="./tags.html"&gt;#hpi&lt;/a&gt;
        &lt;/div&gt;
        &lt;time datetime="2020-03-15T00:00:00"&gt;15 March 2020&lt;/time&gt;
    &lt;/section&gt;
    

    
    &lt;section id="post-discussion"&gt;
    &lt;br/&gt;
    &lt;div&gt;Discussion:&lt;/div&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;a href="https://www.reddit.com/r/coolgithubprojects/comments/fo28ok/human_programming_interface_your_digital_life_in"&gt;/r/coolgithubprojects&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="https://lobste.rs/s/vzkb7a/human_programming_interface_python"&gt;lobsters&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    

    &lt;section id="post-comments"&gt;
    &lt;script data-isso="https://beepb00p.xyz/comments/" data-isso-reply-to-self="true" src="https://beepb00p.xyz/comments/js/embed.min.js"&gt;
&lt;/script&gt;

&lt;section data-isso-id="isso_mypkg" id="isso-thread"&gt;&lt;/section&gt;
    &lt;/section&gt;
&lt;/section&gt;&lt;/article&gt;
    &lt;/main&gt;

    &lt;footer id="bottomfooter"&gt;
        &lt;a href="https://twitter.com/karlicoss"&gt;🐦 me @twitter&lt;/a&gt;
        &lt;a href="https://github.com/karlicoss"&gt;💻 me @github&lt;/a&gt;
        &lt;a href="http://creativecommons.org/licenses/by/4.0" style="margin-left:auto"&gt;CC BY 4.0&lt;/a&gt;&lt;/footer&gt;

&lt;/body&gt;&lt;/html&gt;</description>
      <guid isPermaLink="true">https://beepb00p.xyz/hpi.html</guid>
      <pubDate>Sun, 15 Mar 2020 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Building data liberation infrastructure</title>
      <link>https://beepb00p.xyz/exports.html</link>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang="en" prefix="og: http://ogp.me/ns#"&gt;&lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;meta content="width=device-width, initial-scale=1" name="viewport"/&gt;

    &lt;title&gt;Building data liberation infrastructure | beepb00p&lt;/title&gt;
    &lt;link href="https://beepb00p.xyz/exports.html" rel="canonical"/&gt;
    &lt;meta content="infra dataliberation" name="keywords"/&gt;
    &lt;!-- TODO concat with keywords tags; also need to make comma separated? --&gt;

    &lt;!-- can test it with https://telegram.me/webpagebot --&gt;
    &lt;!-- or https://developers.facebook.com/tools/debug --&gt;
    &lt;meta content="website" property="og:type"/&gt;
    &lt;meta content="https://beepb00p.xyz/exports.html" property="og:url"/&gt; &lt;!-- todo base? --&gt;
    &lt;meta content="Building data liberation infrastructure | beepb00p" property="og:title"/&gt;
    &lt;meta content="How to export, access and own your personal data with minimal effort" property="og:description"/&gt;
    &lt;!-- ugh. why is image necessary??? otherwise other parts aren't working or I get lots of 404s --&gt;
    &lt;!-- ugh. Facebook really wants jpg, but whatever --&gt;
    &lt;!-- also Facebook displays it with black background, but whatever, fuck it. --&gt;
    &lt;!-- svg does't work on  --&gt;
    &lt;meta content="https://beepb00p.xyz/assets/favicon.png" property="og:image"/&gt;

    &lt;!-- Icon made by Twitter --&gt;
    &lt;!-- https://twemoji.twitter.com/content/twemoji-twitter/en.html --&gt;
    &lt;!-- todo replace with svg favicon? most browsers support it --&gt;
    &lt;link href="./assets/favicon.png" rel="icon"/&gt;

    &lt;meta content="https://github.com/karlicoss/beepb00p" name="generator"/&gt;
    &lt;meta content="English" name="language"/&gt;

    &lt;!-- TODO get rid of google font. probably Georgia or Garamond? sadly they aren't available in Ubuntu by default.. --&gt;
    &lt;link href="https://fonts.gstatic.com" rel="preconnect"/&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&amp;amp;display=swap" rel="stylesheet"/&gt;

    &lt;link href="./assets/css/default.css" rel="stylesheet"/&gt;
    &lt;!-- TODO make conditional?? --&gt;
    &lt;link href="./assets/css/posts-list.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/links.css" rel="stylesheet"/&gt;

    &lt;!-- &lt;link rel="stylesheet" href="/assets/css/org.css" /&gt; --&gt;
    &lt;link href="./assets/css/htmlize.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-default.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-extra.css" rel="stylesheet"/&gt;
    &lt;script&gt;
    const TID = 'settings-timestamps';
function timestampsCheckbox() {
    return document.getElementById(TID)
}

window.onload = () =&gt; {
    const box = timestampsCheckbox()
    function setState(state) {
        box.checked = state
        const dd = state ? 'initial' : 'none'
        Array.from(document.querySelectorAll('.timestamp-wrapper, .property.CREATED')).map(x =&gt; {
            x.style.display = dd
        })
        localStorage.setItem(TID, JSON.stringify(state))
    }

    let state = localStorage.getItem(TID)
    if (state != null) {
        state = JSON.parse(state)
    } else {
        state = true
    }
    // todo a bit annoying that it glitches this way.. but whatever
    setState(state)
    // user click
    box.addEventListener('change', (event) =&gt; {
        setState(box.checked)
    })
}&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;!-- TODO not sure what to do on mobile devices? --&gt;
    &lt;!-- https://www.gwern.net/ --&gt;
    &lt;!-- could use position: fix so it's displayed  --&gt;
    &lt;div id="settings" style="position:fixed; top: 0; right:0; opacity: 0.3"&gt;
        &lt;!-- TODO headerlinks etc? --&gt;
        settings:
        &lt;div&gt;show timestamps&lt;input id="settings-timestamps" type="checkbox"/&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;nav id="topnav"&gt;
        &lt;a href="./"&gt;Home&lt;/a&gt;
        &lt;a href="./ideas.html"&gt;Ideas&lt;/a&gt;
        &lt;a href="./exobrain"&gt;Exobrain&lt;/a&gt;
        &lt;a href="./tags.html"&gt;Tags&lt;/a&gt;

        &lt;a href="./feed.html" style="margin-left:auto"&gt;Feed&lt;/a&gt;
        &lt;!-- margin-left aligns the rest to the right in flex layout --&gt;
        &lt;a href="./site.html"&gt;Site&lt;/a&gt;
        &lt;a href="./me.html"&gt;Me&lt;/a&gt;

        &lt;span style="font-size: 0.4em;"&gt;
            &lt;a href="https://twitter.com/karlicoss" style="display:block;"&gt;@twitter&lt;/a&gt;
            &lt;a href="https://github.com/karlicoss" style="display:block;"&gt;@github&lt;/a&gt;
        &lt;/span&gt;
    &lt;/nav&gt;

    &lt;!-- main contains the stuff which is not repeated across the site --&gt;
    &lt;main&gt;
        &lt;article&gt;
    
    &lt;section id="post-title"&gt;
    &lt;h1&gt;
        Building data liberation infrastructure
        &lt;a href="./blog-graph.html#exports" style="font-size: 1rem;vertical-align: super;" title="See this post within the blog graph, and how it's connected to other posts"&gt;[see within blog graph]&lt;/a&gt;
    &lt;/h1&gt;
    &lt;div class="summary"&gt;How to export, access and own your personal data with minimal effort
    &lt;/div&gt;&lt;/section&gt;
    &lt;!-- are sections appropriate for that? --&gt;

    &lt;section id="post-content"&gt;
    &lt;p&gt;
Our personal data is siloed, held hostage, and very hard to access for various technical and business reasons.
I wrote and vented a lot about it in the &lt;a href="sad-infra.html"&gt;previous post&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
People suggest a whole spectrum of possible solutions to these issues, starting from proposals on dismantling capitalism and ending with high tech vaporwavy stuff like &lt;a href="https://en.wikipedia.org/wiki/Urbit"&gt;urbit&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I, however, want my data &lt;b&gt;here and now&lt;/b&gt;. I'm also fortunate to be a software engineer so I can bring this closer to reality by myself.
&lt;/p&gt;
&lt;p&gt;
As a pragmatic intermediate solution, feasible with existing technology and infrastructure without reinventing everything from scratch, 
I suggested a &lt;a href="sad-infra.html#data_mirror"&gt;&lt;b&gt;'data mirror'&lt;/b&gt;&lt;/a&gt;, a piece of software that continuously syncs/mirrors user's personal data.
&lt;/p&gt;
&lt;p&gt;
So, as I promised, this post will be somewhat more &lt;del&gt;boring&lt;/del&gt; specific.
&lt;/p&gt;
&lt;p&gt;
You can treat this as a tutorial on liberating your data from any service. I'll be explaining some technical decisions and guidelines on:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;how to reliably export your data from the cloud (and other silos), locally&lt;/li&gt;
&lt;li&gt;how to organize it for easy and fast access&lt;/li&gt;
&lt;li&gt;how to keep it up to date without constant maintenance&lt;/li&gt;
&lt;li&gt;how to make the infrastructure modular, so other people could use only parts they find necessary and extend it&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In hindsight, some things feel so obvious, they hardly deserve mention, but I hope they might be helpful anyway!
&lt;/p&gt;
&lt;p&gt;
I will be presenting and elaborating on different technical decisions, patterns and tricks I figured out while developing data mirrors by myself.
&lt;/p&gt;
&lt;p&gt;
I will &lt;a href="myinfra.html"&gt;link&lt;/a&gt; to my &lt;span style="color:darkgreen; font-weight: bolder"&gt;infrastructure map&lt;/span&gt; throughout the post, hopefully you'll enjoy exploring it. Links will point at specific clusters of the map and highlight them, so hopefully it will be helpful in communicating the design decisions.
&lt;/p&gt;
&lt;p&gt;
I'm also &lt;b&gt;very open&lt;/b&gt; for questions like "Why didn't you do Y instead of X?". 
It's quite possible that I'm slipping in extra complexity somewhere and I would be very happy to eliminate it.
&lt;/p&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#design"&gt;1. Design principles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#retrieve"&gt;2. Retrieving data&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#api_public"&gt;public API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#api_private"&gt;private API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#export_scrape"&gt;scraping&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#export_manual"&gt;manual export (GDPR/takeout)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#export_phone"&gt;phone apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#export_devices"&gt;devices&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#types"&gt;3. Types of exports: a high-level view&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#full"&gt;full export&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#incremental"&gt;incremental export&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#synthetic"&gt;synthetic export&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#export_layer"&gt;4. Export layer&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#bindings"&gt;use existing bindings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#keep_raw"&gt;don't mess with the raw data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#defensive"&gt;don't  be too defensive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#credentials"&gt;allow reading credentials from a file&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#storage"&gt;5. How to store it: organizing data&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#timestamps"&gt;naming and timestamping&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#backups"&gt;backups&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sync"&gt;synchronizing between computers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#disk_space"&gt;disk space concerns&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#dal"&gt;6. Data access layer (DAL)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#dal_performance"&gt;performance concerns&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#dal_examples"&gt;examples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#automatic_exports"&gt;7. Automating exports&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#scheduling"&gt;scheduling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#arctee"&gt;arctee&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#fin"&gt;8. --&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="design"&gt;&lt;a class="headerlink" href="#design"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; Design principles&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Just as a reminder: the idea of the data mirror is having personal data &lt;b&gt;continuously/periodically synchronized&lt;/b&gt; to the file system, and having &lt;b&gt;programmatic access&lt;/b&gt; to it.
&lt;/p&gt;
&lt;p&gt;
It might not be that hard to achieve for one particular data source, but when you want to use &lt;a href="my-data.html"&gt;ten or more&lt;/a&gt;,
each of which with its own quirks it becomes quite painful to implement and maintain over time.
While there are many reasons to make it simple, generic, reliable and flexible at the same time, it is not an easy goal.
&lt;/p&gt;
&lt;p&gt;
The main principles of my design are modularity, separation of concerns and keeping things as simple as possible.
This allows making it easy to hook onto any layer to allow for different ways of using the data.
&lt;/p&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
Most of my pipelines for data liberation consist of the following layers

&lt;/span&gt;&lt;aside class="sidenote"&gt;please don't be terrified of the word 'layer', typically these are just single scripts&lt;/aside&gt;&lt;/div&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
&lt;a class="link-down" href="#export_layer"&gt;export layer&lt;/a&gt;: knows how to get your data from the silos
&lt;/p&gt;
&lt;p&gt;
The purpose of the export layer is to reliably fetch and serialize raw data on your disk. It roughly corresponds to the concept of the &lt;a href="sad-infra.html#data_mirror"&gt;'data mirror app'&lt;/a&gt;. 
&lt;/p&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
Export scripts deal with the tedious business of authorization, pagination, being tolerant of network errors, etc.

&lt;/span&gt;&lt;aside class="sidenote"&gt;&lt;span style="color:darkgreen;font-weight:bold"&gt;map&lt;/span&gt;: &lt;a href="myinfra.html#exports"&gt;exports&lt;/a&gt;&lt;/aside&gt;&lt;/div&gt;
&lt;p&gt;
Example: the export layer for &lt;a href="https://github.com/karlicoss/endoexport/blob/e322b44ca1e6e5a779b4e7ea49564ba60d425bfe/export.py#L10-L15"&gt;Endomondo data&lt;/a&gt; 
is simply fetching exercise data from the API (using existing library bindings) and prints the JSON out. That's all it does.
&lt;/p&gt;
&lt;p&gt;
In theory, this layer is the only essential one; merely having raw data on your disk enables you to use other tools to explore and analyze your data.
However, long term you'll find yourself doing the same manipulations all over again, which is why we also need:
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a class="link-down" href="#dal"&gt;data access layer (DAL)&lt;/a&gt;: knows how to read your data
&lt;/p&gt;
&lt;p&gt;
For brevity, I'll refer to it as &lt;b&gt;DAL&lt;/b&gt; (Data Abstraction/Access Layer).
&lt;/p&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
The purpose of DAL is simply to deserialize whatever the export script dumped and provide minimalistic data bindings.
It shouldn't worry about tokens, network errors, etc., once you have your data on the disk DAL should be able to handle it even when you're offline.

&lt;/span&gt;&lt;aside class="sidenote"&gt;&lt;span style="color:darkgreen;font-weight:bold"&gt;map&lt;/span&gt;: &lt;a href="myinfra.html#dal"&gt;data access layer&lt;/a&gt;&lt;/aside&gt;&lt;/div&gt;
&lt;p&gt;
It's not meant to be too high level; otherwise, you might lose the generality and restrict the bindings in such ways that they leave some users out.
&lt;/p&gt;
&lt;p&gt;
I think it's very reasonable to keep both the export and DAL code close as you don't want serializing and deserializing to go out of sync, so that's what I'm doing in my export tools.
&lt;/p&gt;
&lt;div class="noop" id="dal_messenger"&gt;
&lt;p&gt;
Example: &lt;a href="https://github.com/karlicoss/fbmessengerexport/blob/a8f65a259dfa36ab6d175461994356947ded142a/model.py#L27-L47"&gt;DAL for Facebook Messenger&lt;/a&gt; knows how to read messages from the database on your disk, access certain fields (e.g. message body) and how to handle obscure details like converting timestamps to &lt;samp class="inline"&gt;datetime&lt;/samp&gt; objects. 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;it's &lt;b&gt;not&lt;/b&gt; trying to get messages from Facebook, which makes it way faster and more reliable to interact with data&lt;/li&gt;
&lt;li&gt;it's &lt;b&gt;not&lt;/b&gt; trying to do anything fancy beyond providing access to the data, which allows keeping it simple and resilient&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
downstream data consumers
&lt;/p&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
You could also count it as the third layer, although the boundaries are not very well defined at this stage.

&lt;/span&gt;&lt;aside class="sidenote"&gt;&lt;span style="color:darkgreen;font-weight:bold"&gt;map&lt;/span&gt;: &lt;a href="myinfra.html#mypkg"&gt;my.&lt;/a&gt;&lt;/aside&gt;&lt;/div&gt;
&lt;p&gt;
As an input it takes abstract (i.e. non-raw) data from the DAL and actually does interesting things with it: analysis, visualizations, interactions across different data sources, etc.
&lt;/p&gt;
&lt;p&gt;
For me, it's manifested as &lt;a href="sad-infra.html#mypkg"&gt;a Python package&lt;/a&gt;. I can simply import it in any Python script, and it knows how to read and access any of my data.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Next, I'm going to elaborate on implementing the export layer.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="retrieve"&gt;&lt;a class="headerlink" href="#retrieve"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; Retrieving data&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
The first step in exporting and liberating your data is figuring out what and how are you actually supposed to fetch.
&lt;/p&gt;
&lt;p&gt;
I'll mostly refer to Python libraries (since that's what I'm using and most familiar with), but I'm quite sure there are analogs in other languages.
&lt;/p&gt;
&lt;p&gt;
Also remember, this is just to fetch the data! If you get a regular file on your disk as a result, you can use any other programming language you like to access it.
That's the beauty of decoupling.
&lt;/p&gt;
&lt;p&gt;
Here, I won't elaborate much on potential difficulties during exports, as I wrote about them &lt;a href="sad-infra.html#exports_are_hard"&gt;before&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="api_public"&gt;&lt;a class="headerlink" href="#api_public"&gt;¶&lt;/a&gt;public API&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
You register your app, authorize it, get a token, and you are free to call various endpoints and fetch whatever you want.   
&lt;/p&gt;
&lt;p&gt;
I won't really elaborate on this as if you're reading this you probably have some idea how to use it.
Otherwise, I'm sure there are tutorials out there that would help you.
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:darkorange"&gt;&lt;strong&gt;if anyone knows of decent ones, please let me know and I'll add links!&lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
Examples: thankfully, most services out there offer public API to some extent
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="api_private"&gt;&lt;a class="headerlink" href="#api_private"&gt;¶&lt;/a&gt;private API&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Sometimes a service doesn't offer an API. 
But from the service developer's perspective, it's still very reasonable to have one if you've got backend/frontend communication.
&lt;/p&gt;
&lt;p&gt;
So chances are the service just isn't exposing it, but you can spy on the token/cookies in your browser devtools and use them to access the API.
&lt;/p&gt;
&lt;p&gt;
You can read more about handling such data sources here:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://willschenk.com/articles/2019/reverse_engineering_apis_using_chrome"&gt;Reverse engineering APIs using Chrome Developer Tools&lt;/a&gt;: an extremely comprehensive and beginner-friendly tutorial&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.freecodecamp.org/news/how-i-used-python-to-find-interesting-people-on-medium-be9261b924b0"&gt;"How I used Python to find interesting people to follow on Medium"&lt;/a&gt;: an example of reverse engineering Medium API and using devtools&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.tendigi.com/starbucks-should-really-make-their-apis-public-6b64a1c2e923"&gt;Starbucks should really make their API public&lt;/a&gt;: demo of reverse engineering Starbucks Android app, featuring using proxy and forging the signature&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Some examples:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;for &lt;a href="https://github.com/karlicoss/fbmessengerexport"&gt;exporting Messenger data&lt;/a&gt;, I'm using &lt;a href="https://fbchat.readthedocs.io/en/stable"&gt;fbchat&lt;/a&gt; library. It works by tricking Facebook into believing it's a browser and interacting with private API.&lt;/li&gt;
&lt;li&gt;even though Pocket has an API, to get highlights from it you need to &lt;a href="https://github.com/karlicoss/pockexport#setting-up"&gt;spy on the API key&lt;/a&gt; they use in the web app&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="export_scrape"&gt;&lt;a class="headerlink" href="#export_scrape"&gt;¶&lt;/a&gt;scraping&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Sometimes a service doesn't offer an API, doesn't use it even internally and serves HTML pages directly instead.
Or, reverse engineering the API is so painful scraping becomes a more attractive option.
&lt;/p&gt;
&lt;p&gt;
In addition to the same difficulties you would experience during API exports, there are some extra caveats here:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;authorization is harder: you definitely need username/password and potentially even a 2FA token&lt;/li&gt;
&lt;li&gt;DDOS protection: captchas, Cloudflare, etc.&lt;/li&gt;
&lt;li&gt;or even deliberate anti-scraping measures&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
For Python the holy grail of scraping is &lt;a href="https://scrapy.org"&gt;scrapy&lt;/a&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="http://sangaline.com/post/advanced-web-scraping-tutorial"&gt;Advanced Web Scraping Tutorial&lt;/a&gt;: bypassing "403 Forbidden", captchas, and more&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/alecxe/fc1527d6d9492b59c610"&gt;self-contained minimum example script to run scrapy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I'm pretty sure there are similar libraries for other languages, perhaps you could start with &lt;a href="https://github.com/lorien/awesome-web-scraping"&gt;awesome-web-scraping repo&lt;/a&gt; or &lt;a href="https://news.ycombinator.com/item?id=15694118"&gt;Ask HN: What are best tools for web scraping?&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
For dealing with authorization, my personal experience is that using a persistent &lt;a href="https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.firefox.firefox_profile"&gt;profile directory&lt;/a&gt; in Selenium is sufficient in most cases: you can login once manually and, reuse the profile in your scripts.
&lt;/p&gt;
&lt;p&gt;
Examples:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;even though Hackernews has an &lt;a href="https://github.com/HackerNews/API"&gt;API for public data&lt;/a&gt;, there is no way of getting your upvotes/saves without scraping HTML.&lt;/li&gt;
&lt;li&gt;Amazon and Paypal have to be &lt;a href="https://github.com/jbms/finance-dl#supported-data-sources"&gt;scraped&lt;/a&gt; if you want your data.&lt;/li&gt;
&lt;li&gt;my bank, HSBC doesn't have an API. Not that I expected it from HSBC, I don't live in a fairy tale; but even their manual transactions exports are in PDF which I have to &lt;a href="https://github.com/karlicoss/hsbc-parser"&gt;parse&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="export_manual"&gt;&lt;a class="headerlink" href="#export_manual"&gt;¶&lt;/a&gt;manual export (GDPR/takeout)&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
It's great they exist, and it is the easiest way to get your data if you just want a backup.
However it doesn't really help in the long run:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;it's very manual: usually requires requesting and clicking on an email link&lt;/li&gt;
&lt;li&gt;it's slow and asynchronous: normally takes at least a few days&lt;/li&gt;
&lt;li&gt;the takeout format usually differs from the API format, &lt;a href="https://www.reddit.com/r/help/comments/8qr9hs/data_request_and_gdpr/e8acolt"&gt;sometimes&lt;/a&gt; ends up as something neither machine friendly nor human friendly&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
That said, with some effort it can potentially be automated as well.
&lt;/p&gt;
&lt;p&gt;
They can be useful to get the 'initial' bit of your data, past the &lt;a href="sad-infra.html#data_is_vanishing"&gt;API limits&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Examples:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://takeout.google.com"&gt;Google Takeout&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.twitter.com/en/managing-your-account/how-to-download-your-twitter-archive"&gt;Twitter Archive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.blog/2018-12-19-download-your-data"&gt;Github&lt;/a&gt; data export&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="export_phone"&gt;&lt;a class="headerlink" href="#export_phone"&gt;¶&lt;/a&gt;phone apps&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
I don't have an iPhone, so will only be referring to Android in this section, but I'd imagine the situation is similar.
&lt;/p&gt;
&lt;p&gt;
These days, a service might not even offer a desktop version at all and considering that scraping data off mobile apps is way harder getting it from the phone directly might be an easier option. The data is often kept as an sqlite database which in many ways is even more convenient than an API!
&lt;/p&gt;
&lt;p&gt;
On Android the story is simple: apps keep their data in &lt;samp class="inline"&gt;/data/data/&lt;/samp&gt; directory, which is not accessible unless you &lt;b&gt;root&lt;/b&gt; your phone.
These days, with &lt;a href="https://magiskmanager.com"&gt;magisk&lt;/a&gt; it's considerably easier; however, it's still definitely not something a typical Android user would be able to do. Rooting your phone can bring all sorts of trouble by triggering root detection (e.g. common in banking apps), so be careful. And of course, phones come unrooted for a reason, so do it at your own risk.
&lt;/p&gt;
&lt;p&gt;
Once you have root you can write a script to copy necessary files from &lt;samp class="inline"&gt;/data/data/&lt;/samp&gt; to your target directory, synchronized with your computer (e.g. via &lt;a href="https://play.google.com/store/apps/details?id=com.ttxapps.dropsync&amp;amp;hl=en_GB"&gt;Dropbox&lt;/a&gt; or &lt;a href="https://play.google.com/store/apps/details?id=com.github.catfriend1.syncthingandroid&amp;amp;hl=en_GB"&gt;Syncthing&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
Examples:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;you can export Whatsapp data by copying &lt;samp class="inline"&gt;/data/data/com.whatsapp/databases/msgstore.db&lt;/samp&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/karlicoss/promnesia/blob/master/scripts/backup-phone-history.sh"&gt;scripts&lt;/a&gt; for exporting mobile Chrome/Firefox browsing history&lt;/li&gt;
&lt;li&gt;exporting &lt;a href="https://bluemaestro.com"&gt;Bluemaestro&lt;/a&gt; environment sensor data&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="export_devices"&gt;&lt;a class="headerlink" href="#export_devices"&gt;¶&lt;/a&gt;devices&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Here I am referring to standalone specific-purpose gadgets like sleep trackers, e-ink readers, etc. The distinguishing thing is the device doesn't have Internet access or doesn't talk to any API.
&lt;/p&gt;
&lt;p&gt;
You've got some options here:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
the device is capable of synchronizing with your phone (e.g. via Bluetooth)
&lt;/p&gt;
&lt;p&gt;
It's probably easiest to rely on &lt;a class="link-up" href="#export_phone"&gt;phone app exports&lt;/a&gt; here.
If the sync has to be triggered manually, you can benefit from some &lt;a href="https://play.google.com/store/apps/details?id=com.llamalab.automate&amp;amp;hl=en"&gt;UI automation&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
the device is running Linux and has Internet access
&lt;/p&gt;
&lt;p&gt;
That's often the case with e-ink readers.
&lt;/p&gt;
&lt;p&gt;
You can potentially run the export script on the device itself and send the data somewhere else.
Another option is running an SSH server on the device and pulling data from it, but it's quite extreme.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
the device can mount to a computer
&lt;/p&gt;
&lt;p&gt;
Then, you can use &lt;a href="https://en.wikipedia.org/wiki/Udev"&gt;udev&lt;/a&gt; to trigger export when the device is plugged in.
If udev feels too complicated for you, even a cron script running every minute might be enough.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Examples:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;using &lt;a href="https://github.com/karlicoss/kobuddy#as-a-backup-tool"&gt;kobuddy&lt;/a&gt; for semiautomatic exports from Kobo e-ink reader&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="types"&gt;&lt;a class="headerlink" href="#types"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; Types of exports: a high-level view&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Hopefully, the previous section answered your questions about 'where do I get my data from'.
The next step is figuring out what you actually need to request and how to store it.
&lt;/p&gt;
&lt;p&gt;
Now, let's establish a bit of vocabulary here.
Since data exports by their nature are somewhat similar to &lt;a href="https://en.wikipedia.org/wiki/Backup#Backup_methods"&gt;backups&lt;/a&gt;, I'm borrowing some terminology.
&lt;/p&gt;
&lt;p&gt;
The way I see it, there are three styles of data exports:
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="full"&gt;&lt;a class="headerlink" href="#full"&gt;¶&lt;/a&gt;full export&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Every time you want your data, go exhaustively through all the endpoints and fetch the data.
The result is some sort of JSON file (reflecting the complete state of your data) which you can save to disk.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="full_summary"&gt;&lt;a class="headerlink" href="#full_summary"&gt;¶&lt;/a&gt;summary&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;advantages
&lt;ul class="org-ul"&gt;
&lt;li&gt;very straightforward to implement&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;disadvantages
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;might be impossible&lt;/b&gt; due to &lt;a href="sad-infra.html#data_is_vanishing"&gt;API restrictions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;takes &lt;b&gt;more resources&lt;/b&gt;, i.e. time/bandwidth/CPU&lt;/li&gt;
&lt;li&gt;takes &lt;b&gt;more space&lt;/b&gt; if you're keeping old versions&lt;/li&gt;
&lt;li&gt;might be &lt;b&gt;flaky&lt;/b&gt; due to excessive network requests&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="full_examples"&gt;&lt;a class="headerlink" href="#full_examples"&gt;¶&lt;/a&gt;examples&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
When would you use that kind of export?
When there isn't much data to retrieve and you can do it in one go.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://github.com/karlicoss/pockexport"&gt;Exporting Pocket data&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
There are no apparent API limitations preventing you from fetching everything, and it seems like a plausible option. Presumably, it's just a matter of transferring a few hundred kilobytes. YMMV though: if you are using it extremely heavily you might want to use a &lt;a class="link-down" href="#synthetic"&gt;synthetic export&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="incremental"&gt;&lt;a class="headerlink" href="#incremental"&gt;¶&lt;/a&gt;incremental export&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
'Incremental' means that rerunning an export starts from the last persisted point and only fetches missing data.
&lt;/p&gt;
&lt;p&gt;
Implementation wise, it looks like this:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;query previously exported data to determine the point (e.g. timestamp/message id) to continue from&lt;/li&gt;
&lt;li&gt;fetch missing data starting from that point&lt;/li&gt;
&lt;li&gt;merge it back with previously exported data, persist on disk&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="incremental_summary"&gt;&lt;a class="headerlink" href="#incremental_summary"&gt;¶&lt;/a&gt;summary&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;advantages
&lt;ul class="org-ul"&gt;
&lt;li&gt;takes less resources&lt;/li&gt;
&lt;li&gt;more resilient (if done right) as it needs fewer network operations&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;disadvantages
&lt;ul class="org-ul"&gt;
&lt;li&gt;potentially very error-prone, harder to implement
&lt;ul class="org-ul"&gt;
&lt;li&gt;if you're not careful with &lt;a href="sad-infra.html#pagination"&gt;pagination&lt;/a&gt; and misinterpret documentation you might never request some data&lt;/li&gt;
&lt;li&gt;if you're not careful with &lt;a href="sad-infra.html#consistency"&gt;transactional logic&lt;/a&gt;, you might leave your export in an inconsistent and corrupt state&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
Incremental exports are &lt;b&gt;always&lt;/b&gt; harder to program. Indeed, &lt;a class="link-up" href="#full"&gt;full export&lt;/a&gt; is just an edge case of an incremental one.

&lt;/span&gt;&lt;aside class="sidenote"&gt;Fun fact: most of your phone apps already implement incremental sync. It's a shame the logic can't be reused.&lt;/aside&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="incremental_examples"&gt;&lt;a class="headerlink" href="#incremental_examples"&gt;¶&lt;/a&gt;examples&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
If it's so tricky, why would you bother with exporting data incrementally?
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
too much data
&lt;/p&gt;
&lt;p&gt;
This doesn't even mean too much in terms of bandwidth/storage, more of 'too many entities'.
&lt;/p&gt;
&lt;p&gt;
E.g. imagine you want to export your Twitter timeline of 10000 tweets, which is about 1Mb of raw text data.
Even if you account for extra garbage and assume 10 Mb or even 100 Mb of data it's basically nothing if you're running it once a day.
&lt;/p&gt;
&lt;p&gt;
However, APIs usually impose pagination (e.g. 200 tweets per call), so to get these 10000 tweets you might have to do &lt;code class="inline"&gt;10000 / 200 = 50&lt;/code&gt; API calls. 
Suddenly the whole thing feels much less reliable, so you might want to make it incremental in order to minimize the number of network calls.
&lt;/p&gt;
&lt;p&gt;
For example:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://github.com/fabianonline/telegram_backup"&gt;Telegram&lt;/a&gt;/&lt;a href="https://github.com/karlicoss/fbmessengerexport"&gt;Messenger&lt;/a&gt;/Whatsapp – basically IM always means there's too much data to be exported at once&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
flaky/slow API
&lt;/p&gt;
&lt;p&gt;
If it's the case you want to minimize network interaction.
&lt;/p&gt;
&lt;p&gt;
For example:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-up" href="#export_scrape"&gt;web scraping&lt;/a&gt; is always somewhat slow; in addition, you might have to rate limit yourself so you don't get banned by DDOS prevention.
Also, it's even flakier than using APIs, so you might want to avoid extra work if possible.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shop-eu.emfit.com/products/emfit-qs"&gt;Emfit QS&lt;/a&gt; sleep data: API is a bit flaky, so I minimize network interaction by only fetching missing data.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="synthetic"&gt;&lt;a class="headerlink" href="#synthetic"&gt;¶&lt;/a&gt;synthetic export&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;div style="margin-top: 16px; margin-bottom: 16px"&gt;&lt;span class="before-aside"&gt;
This is a blend between full export and incremental export.   

&lt;/span&gt;&lt;aside class="sidenote"&gt;If someone thinks of a better term for describing this concept, please let me know!&lt;/aside&gt;&lt;/div&gt;
&lt;p&gt;
It's similar to a full export in the sense that there isn't that much data to retrieve: if you could, you would just fetch it in one go.
&lt;/p&gt;
&lt;p&gt;
What makes it similar to the incremental export is that you don't have all the data available at once - only the latest chunk.
The main motivation for a synthetic export is that no single export file will give you all of the data.
&lt;/p&gt;
&lt;p&gt;
There are various reasons for that:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
API restrictions
&lt;/p&gt;
&lt;p&gt;
Many APIs restrict the number of items you can retrieve through each endpoint for caching and performance reasons.
&lt;/p&gt;
&lt;p&gt;
Example: &lt;a href="https://github.com/karlicoss/rexport#limitations"&gt;Reddit&lt;/a&gt; limits your API queries to 1000 entries.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Limited memory
&lt;/p&gt;
&lt;p&gt;
Example: autonomous devices like HR monitors or temperature monitors are embedded systems with limited memory.
&lt;/p&gt;
&lt;p&gt;
Typically, they use some kind of &lt;a href="https://en.wikipedia.org/wiki/Circular_buffer"&gt;ring buffer&lt;/a&gt; so when you export data, you only get, say, the latest 10000 measurements.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Disagreement on the 'state' of the system
&lt;/p&gt;
&lt;p&gt;
Example: Kobo reader uses an &lt;a href="https://github.com/karlicoss/kobuddy"&gt;sqlite database&lt;/a&gt; for keeping metadata like highlights, which is awesome!
However, when you delete the book from your reader, it removes your annotations and highlights from the database too.
&lt;/p&gt;
&lt;p&gt;
There is absolutely no reason to do this: I delete the book because I don't need it on my reader, not because I want to get rid of the annotations.
So in order to have all of them my only option is having regular database snapshots and assembling the full database from these pieces.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Security
&lt;/p&gt;
&lt;p&gt;
Example: &lt;a href="https://docs.monzo.com/#list-transactions"&gt;Monzo bank API&lt;/a&gt;. 
&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;
After a user has authenticated, your client can fetch all of their transactions, and after 5 minutes, it can only sync the last 90 days of transactions. If you need the user’s entire transaction history, you should consider fetching and storing it right after authentication. 
&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;
So that means that unless you're happy with manually authorizing every time you export, you will only have access to the last 90 days of transactions.
&lt;/p&gt;
&lt;p&gt;
Note: I feel kind of sorry complaining at Monzo, considering they are the nicest guys out there in terms of being dev friendly; and I understand the security concerns.
But that's the only example of such behavior I've seen so far, and it does complicate things.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
One important difference from other types of exports is that you &lt;b&gt;have to&lt;/b&gt; do them regularly/often enough.
Otherwise you inevitably miss some data and in the best case scenario have to get it &lt;a class="link-up" href="#export_manual"&gt;manually&lt;/a&gt;, or in the worst case &lt;a href="./takeout-data-gone.html"&gt;lose it forever&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Now, you could deal with these complications the same way you would with incremental exports by retrieving the missing data only.
The &lt;b&gt;crucial difference&lt;/b&gt; is that if you do make a mistake in the logic, it's not just a matter of waiting to re-download everything. 
Some of the data might be gone &lt;b&gt;forever&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
So I take a hybrid approach instead:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
at &lt;a class="link-down" href="#export_layer"&gt;export time&lt;/a&gt;, retrieve all the data I can and keep it along with a timestamp, like a &lt;a class="link-up" href="#full"&gt;full export&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Basically, it makes it an 'append-only system', so there is no opportunity for losing data.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
at &lt;a class="link-down" href="#dal"&gt;data access time&lt;/a&gt;, we dynamically build (synthesize) the full state of the data
&lt;/p&gt;
&lt;p&gt;
We go through all exported data chunks and reconstruct the full state, similarly to &lt;a class="link-up" href="#incremental"&gt;incremental export&lt;/a&gt;.
That's where 'synthetic' comes from.
&lt;/p&gt;
&lt;p&gt;
The 'full export' only exists at runtime, and errors in merging logic are not problematic as you never overwrite data.
If you do spot a problem you only have to change the code with no need for data migrations.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="synthetic_example_temperature"&gt;&lt;a class="headerlink" href="#synthetic_example_temperature"&gt;¶&lt;/a&gt;illustrative example&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
I feel like the explanations are a bit abstract, so let's consider a specific scenario.
&lt;/p&gt;
&lt;p&gt;
Say you've got a temperature sensor that takes a measurement every minute and keeps it in its internal database.
It's only got enough memory for 2000 datapoints so you have to grab data from it every day, otherwise the older measurements would be overwritten (it's implemented as a ring buffer).
&lt;/p&gt;
&lt;p&gt;
It seems like a perfect fit for synthetic export. 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
export layer: every day you run a script that connects to the sensor and copies the database onto your computer
&lt;/p&gt;
&lt;p&gt;
That's it, it doesn't do anything more complicated than that.
The whole process is atomic, so if Bluetooth connection fails, we can simply retry until we succeed without having to worry about the details.
&lt;/p&gt;
&lt;p&gt;
As a result, we get a bunch of files like:
&lt;/p&gt;
&lt;pre class="example"&gt;# ls /data/temperature/*.db
...
20190715100026.db
20190716100138.db
20190717101651.db
20190718100118.db
20190719100701.db
...
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
data access layer: go through all chunks and construct the full temperature history
&lt;/p&gt;
&lt;p&gt;
E.g. it would look kind of like:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;def&lt;/span&gt; &lt;span class="org-function-name"&gt;measurements&lt;/span&gt;() -&amp;gt; Iterator[&lt;span class="org-builtin"&gt;float&lt;/span&gt;]:
    processed: &lt;span class="org-variable-name"&gt;Set&lt;/span&gt;[datetime] = &lt;span class="org-builtin"&gt;set&lt;/span&gt;()
    &lt;span class="org-keyword"&gt;for&lt;/span&gt; db &lt;span class="org-keyword"&gt;in&lt;/span&gt; &lt;span class="org-builtin"&gt;sorted&lt;/span&gt;(Path(&lt;span class="org-string"&gt;'/data/temperature'&lt;/span&gt;).glob(&lt;span class="org-string"&gt;'*.db'&lt;/span&gt;)):
        &lt;span class="org-keyword"&gt;for&lt;/span&gt; timestamp, value &lt;span class="org-keyword"&gt;in&lt;/span&gt; query(db, &lt;span class="org-string"&gt;'SELECT * FROM measurements'&lt;/span&gt;):
            &lt;span class="org-keyword"&gt;if&lt;/span&gt; timestamp &lt;span class="org-keyword"&gt;in&lt;/span&gt; processed:
                &lt;span class="org-keyword"&gt;continue&lt;/span&gt;
            processed.add(timestamp)
            &lt;span class="org-keyword"&gt;yield&lt;/span&gt; value
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
I hope it's clear how much easier this is compared with maintaining some sort of master sqlite database and updating it.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="synthetic_summary"&gt;&lt;a class="headerlink" href="#synthetic_summary"&gt;¶&lt;/a&gt;summary&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;advantages
&lt;ul class="org-ul"&gt;
&lt;li&gt;much easier way to achieve incremental exports without having to worry about introducing inconsistencies&lt;/li&gt;
&lt;li&gt;&lt;b&gt;very resilient&lt;/b&gt;, against pretty much everything: deleted content, data corruption, flaky APIs, programming errors&lt;/li&gt;
&lt;li&gt;&lt;b&gt;straightforward&lt;/b&gt; to normalize and unify – you are not overwriting anything&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;disadvantages
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
takes &lt;b&gt;extra space&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
That said, storage shouldn't be that much of a concern unless you export &lt;b&gt;very&lt;/b&gt; often.
I elaborate on this problem &lt;a class="link-down" href="#disk_space"&gt;later in the post&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;b&gt;overhead&lt;/b&gt; at access time
&lt;/p&gt;
&lt;p&gt;
When we access the data we have to merge all snapshots every time. I'll elaborate on this &lt;a class="link-down" href="#dal_performance"&gt;later as well&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="synthetic_example"&gt;&lt;a class="headerlink" href="#synthetic_example"&gt;¶&lt;/a&gt;more examples&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;Github API is restricted to 300 latest events, so synthetic logic is used in &lt;a href="https://github.com/karlicoss/ghexport/blob/master/dal.py"&gt;ghexport&lt;/a&gt; tool&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Reddit API is restricted to 1000 items, so synthetic logic is used in &lt;a href="https://github.com/karlicoss/rexport/blob/874e6116bfba8cbd63fa3b4d93810a1488cb8464/dal.py#L136"&gt;rexport&lt;/a&gt; tool
&lt;/p&gt;
&lt;p&gt;
I elaborate on Reddit &lt;a href="unnecessary-db.html#example_reddit"&gt;here&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Chrome only keeps 90 days of browsing history in its database
&lt;/p&gt;
&lt;p&gt;
&lt;a href="unnecessary-db.html#chrome_dal"&gt;Here&lt;/a&gt; I write in detail about why synthetic exports make a lot of sense for Chrome.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="export_layer"&gt;&lt;a class="headerlink" href="#export_layer"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; Export layer&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;span style="color:darkgreen; font-weight: bolder"&gt;Map:&lt;/span&gt; &lt;a href="myinfra.html#exports"&gt;export layer&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
No matter which &lt;a class="link-up" href="#types"&gt;of these&lt;/a&gt; ways you have to use to export your data, there are some common difficulties, hence patterns that I'm going to explore in this section.
&lt;/p&gt;
&lt;p&gt;
Just a quick reminder of &lt;a href="sad-infra.html#exports_are_hard"&gt;the problems&lt;/a&gt; that we're dealing with:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;authorization: how to log in?&lt;/li&gt;
&lt;li&gt;pagination: how to query the data correctly?&lt;/li&gt;
&lt;li&gt;consistency: how to make sure we assemble the full view of data correctly without running into concurrency issues?&lt;/li&gt;
&lt;li&gt;rate limits: how to respect the service's policies and avoid getting banned?&lt;/li&gt;
&lt;li&gt;error handling: how to be defensive enough without making the code too complicated?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
My guiding principle is: during the export, do the &lt;b&gt;absolute minimum&lt;/b&gt; work required to reliably get raw data on your disk.
This is kind of vague (perhaps even obvious), so I will try to elaborate on what I mean by that.
&lt;/p&gt;
&lt;p&gt;
This section doesn't cover the exact details, it's more of a collection of tips for minimizing the work and boilerplate. If you are interested in reading the code, &lt;a href="https://github.com/search?type=Repositories&amp;amp;q=user%3Akarlicoss+++topic%3Aexport"&gt;here&lt;/a&gt; are some of the export scripts and tools I've implemented.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="bindings"&gt;&lt;a class="headerlink" href="#bindings"&gt;¶&lt;/a&gt;use existing bindings&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
This may be obvious, but I still feel it has to be said.
Unless retrieving data is trivial (i.e. single GET request), chances that someone has already invested effort in dealing with various API quirks.
Bindings often deal with dirty details like rate limiting, retrying, pagination, etc. So if you're lucky you might end up spending very little effort on actually exporting data.
&lt;/p&gt;
&lt;p&gt;
If there is something in bindings you don't like or lack, it's still easier to &lt;a href="https://en.wikipedia.org/wiki/Monkey_patch"&gt;monkey patch&lt;/a&gt; or just fork and patch them up (don't forget to open a pull request later!).
&lt;/p&gt;
&lt;p&gt;
Also if you're the author of bindings, I have some requests. Please:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;don't print in stdout, it's a pain to filter out and suppress. Ideally use proper logging modules&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
don't be overly defensive, or allow to &lt;a href="mypy-error-handling.html#global_policy"&gt;configure&lt;/a&gt; non-defensive behavior
&lt;/p&gt;
&lt;p&gt;
It's quite sad when the library silently catches all exceptions and replaces them with empty strings/nulls/etc., without you even suspecting it.
It's especially problematic in Python, where "Ask forgiveness, not permission" is very common.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
expose raw underlying data (e.g. raw JSON/XML from the API)
&lt;/p&gt;
&lt;p&gt;
If you forget to handle something, or the user disagrees with the interpretation of data, they would still be able to benefit from the data bindings for retrieval and only alter the deserialization.
&lt;/p&gt;
&lt;p&gt;
Example of good data object:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://github.com/pawelad/pymonzo/blob/b5c8d4f46dcb3a2f475797a8b8ef1c15f6493fb9/src/pymonzo/api_objects.py#L38-L45"&gt;pymonzo&lt;/a&gt; exposes programmer-friendly fields and also keeps raw data&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
expose generic methods for handling API calls to make it easy to add new endpoints
&lt;/p&gt;
&lt;p&gt;
Same argument: if you forgot to handle some API calls, it makes it much easier for consumers to quickly add them.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="export_layer_examples"&gt;&lt;a class="headerlink" href="#export_layer_examples"&gt;¶&lt;/a&gt;examples&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
To export &lt;a href="https://github.com/karlicoss/hypexport"&gt;Hypothes.is&lt;/a&gt; data I'm using existing &lt;a href="https://github.com/judell/Hypothesis"&gt;judell/Hypothesis&lt;/a&gt; bindings.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;the bindings handle &lt;a href="https://github.com/judell/Hypothesis/blob/91f881693546aaddc4096327a97f5cf342c3770a/hypothesis.py#L69"&gt;pagination and rate limits&lt;/a&gt; for you&lt;/li&gt;
&lt;li&gt;the bindings return raw JSONs, making it trivial to serialize the data on disk&lt;/li&gt;
&lt;/ul&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
the bindings expose generic &lt;a href="https://github.com/judell/Hypothesis/blob/91f881693546aaddc4096327a97f5cf342c3770a/hypothesis.py#L138"&gt;&lt;code class="inline"&gt;authenticated_api_query&lt;/code&gt;&lt;/a&gt; method
&lt;/p&gt;
&lt;p&gt;
For instance, profile data request was missing from the bindings; and it was &lt;a href="https://github.com/karlicoss/hypexport/blob/7a80b36aa55da8b541e2778141eb84ada384d734/hypexport.py#L14"&gt;trivial&lt;/a&gt; to get it anyway 
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Thanks to good bindings, the actual export is pretty &lt;a href="https://github.com/karlicoss/hypexport/blob/7a80b36aa55da8b541e2778141eb84ada384d734/hypexport.py#L6-L19"&gt;trivial&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Another example: to export &lt;a href="https://github.com/karlicoss/rexport/blob/master/export.py"&gt;Reddit data&lt;/a&gt;, I'm using &lt;a href="https://github.com/praw-dev/praw"&gt;praw&lt;/a&gt;, an excellent library for accessing Reddit from Python.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;praw handles rate limits and pagination&lt;/li&gt;
&lt;li&gt;praw exposes a logger, which makes it easy to &lt;a href="https://github.com/karlicoss/rexport/blob/874e6116bfba8cbd63fa3b4d93810a1488cb8464/export.py#L107"&gt;control it&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;praw supports all endpoints, so exporting data is just a matter of &lt;a href="https://github.com/karlicoss/rexport/blob/d001e2d07d716130106ebe07a021f98d84a5ed93/rexport.py#L73-L84"&gt;calling the right API methods&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
one shortcoming of praw though is that it won't give you access to raw JSON data for some reason, so we have to use some &lt;a href="https://github.com/karlicoss/rexport/blob/874e6116bfba8cbd63fa3b4d93810a1488cb8464/export.py#L37-L60"&gt;hacky logic&lt;/a&gt; to serialize.
&lt;/p&gt;
&lt;p&gt;
If praw kept original data from the API, the &lt;a href="https://github.com/karlicoss/rexport/blob/master/export.py"&gt;code for export&lt;/a&gt; would be half as long.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="keep_raw"&gt;&lt;a class="headerlink" href="#keep_raw"&gt;¶&lt;/a&gt;don't mess with the raw data&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Keep the data you retrieved &lt;b&gt;as intact as possible&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
That means:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;don't insert it in in a database, unless it's really necessary&lt;/li&gt;
&lt;li&gt;don't convert formats (e.g. JSON to XML)&lt;/li&gt;
&lt;li&gt;don't try to clean up and normalize&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Instead, &lt;b&gt;keep the exporter code simple&lt;/b&gt; and don't try to interpret data in it.
Move data interpretation burden to the &lt;a class="link-down" href="#dal"&gt;data access layer&lt;/a&gt; instead.
&lt;/p&gt;
&lt;p&gt;
The rationale here is it's a potential source of inconsistencies. If you make a bug during data conversion, you might end corrupting your data forever.
&lt;/p&gt;
&lt;p&gt;
I'm elaborating on this point &lt;a href="unnecessary-db.html#asis"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="defensive"&gt;&lt;a class="headerlink" href="#defensive"&gt;¶&lt;/a&gt;don't  be too defensive&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;never silently fallback on default values in case of errors, unless you're really certain about what you're doing&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
don't add retry logic just in case
&lt;/p&gt;
&lt;p&gt;
In my experience, it's fair to assume that if the export failed, it's a random server-side glitch and not worth fine-tuning - it's easier to simply start the export all over again.
I'm not dealing with that in the individual export scripts at all, and using &lt;a class="link-down" href="#arctee"&gt;arctee&lt;/a&gt;, to retry exports automatically.
&lt;/p&gt;
&lt;p&gt;
If you know what you're doing (e.g. some endpoint is notoriously flaky) and do need retries, I recommend using an existing library that handles that like &lt;a href="https://github.com/litl/backoff#examples"&gt;backoff&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="credentials"&gt;&lt;a class="headerlink" href="#credentials"&gt;¶&lt;/a&gt;allow reading credentials from a file&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;you don't want them in your shell history or in crontabs&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
keeping them in a file can potentially allow for fine access control
&lt;/p&gt;
&lt;p&gt;
E.g. with Unix permissions you could only allow certain scripts to read secrets.
Note that I'm not a security expert and would be interested to know if there are better solutions to that
&lt;/p&gt;
&lt;p&gt;
Personally, I found it so boilerplaty I extracted this logic to a separate &lt;a href="https://github.com/karlicoss/exporthelpers/blob/master/export_helper.py"&gt;helper module&lt;/a&gt;. You can find an example &lt;a href="https://github.com/karlicoss/instapexport#exporting"&gt;here&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="storage"&gt;&lt;a class="headerlink" href="#storage"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;5&lt;/span&gt; How to store it: organizing data&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;span style="color:darkgreen; font-weight: bolder"&gt;Map:&lt;/span&gt; &lt;a href="myinfra.html#fs"&gt;filesystem&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
As I mentioned, for the most part I'm just keeping the raw API data.
For storage I'm just using the filesystem; all exports are kept or symlinked in the same directory (&lt;code class="inline"&gt;/exports&lt;/code&gt;) for ease of access:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-bash"&gt;find /exports/ | sort | head -n 20 | tail -n 7
&lt;/pre&gt;
&lt;/div&gt;
&lt;pre class="example"&gt;/exports/feedbin
/exports/feedly
/exports/firefox-history
/exports/fitbit
/exports/github
/exports/github-events
/exports/goodreads
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="timestamps"&gt;&lt;a class="headerlink" href="#timestamps"&gt;¶&lt;/a&gt;naming and timestamping&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
I find that the only important bit is if you keep multiple export files (e.g. &lt;a class="link-up" href="#synthetic"&gt;synthetic&lt;/a&gt;), make sure their names include timestamps and the time order is consistent with lexicographic order.
&lt;/p&gt;
&lt;p&gt;
This means the only acceptable date/time format is some variation of &lt;a href="https://en.wikipedia.org/wiki/ISO_8601"&gt;&lt;code class="inline"&gt;YYYY MM DD HH MM SS Z&lt;/code&gt;&lt;/a&gt;. 
Feel free to sprinkle in any separators you like, or use milliseconds if you are really serious. Any other date format, e.g. &lt;samp class="inline"&gt;MM/DD/YY&lt;/samp&gt;, using month names, or not using zero-padded numbers is going to bring you serious grief.
&lt;/p&gt;
&lt;p&gt;
E.g.:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-bash"&gt;ls /exports/instapaper/ | tail -n 5
&lt;/pre&gt;
&lt;/div&gt;
&lt;pre class="example"&gt;instapaper_20200101T000005Z.json
instapaper_20200101T040004Z.json
instapaper_20200101T080010Z.json
instapaper_20200101T120005Z.json
instapaper_20200101T160011Z.json
&lt;/pre&gt;
&lt;p&gt;
The reason is it's automatically sort/max friendly, which massively reduces the cognitive load when working with data.
&lt;/p&gt;
&lt;p&gt;
To make timestamping automatic and less boilerplaty, I'm using a &lt;a class="link-down" href="#arctee"&gt;wrapper script&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="backups"&gt;&lt;a class="headerlink" href="#backups"&gt;¶&lt;/a&gt;backups&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Backups are trivial: I can just run &lt;a href="https://borgbackup.readthedocs.io/en/stable"&gt;borg&lt;/a&gt; against &lt;samp class="inline"&gt;/exports&lt;/samp&gt;.
What is more, borg is deduplicating, so it's very friendly to incremental and synthetic exports.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="sync"&gt;&lt;a class="headerlink" href="#sync"&gt;¶&lt;/a&gt;synchronizing between computers&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
I synchronize/replicate it across my computers with Syncthing, also used Dropbox in the past.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="disk_space"&gt;&lt;a class="headerlink" href="#disk_space"&gt;¶&lt;/a&gt;disk space concerns&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Some back of the envelope math arguing it shouldn't be a concern for you:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;the amount of data you generate grows linearly. That means that running exports periodically would take 'quadratic' space&lt;/li&gt;
&lt;li&gt;with time, your available storage grows exponentially (and only gets cheaper)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Hopefully that's convincing, but if this is an issue it can also be addressed with compression or even using deduplicating backup software like &lt;a href="https://borgbackup.readthedocs.io/en/stable"&gt;borg&lt;/a&gt;. Keep in mind that would come at the cost of slowing down access, which may be helped with caching.
&lt;/p&gt;
&lt;p&gt;
I don't even bother compressing most of my exports, except for the few which &lt;a class="link-down" href="#arctee"&gt;arctee wrapper&lt;/a&gt; handles.
&lt;/p&gt;
&lt;p&gt;
There are also ways to benefit from compression without having to do it explicitly:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
keeping data under borg and using &lt;a href="https://borgbackup.readthedocs.io/en/stable/usage/mount.html"&gt;&lt;samp class="inline"&gt;borg mount&lt;/samp&gt;&lt;/a&gt; to access it.
&lt;/p&gt;
&lt;p&gt;
You get deduplication for free, however this makes exporting and accessing data much more obscure. In addition, &lt;samp class="inline"&gt;borg mount&lt;/samp&gt; locks the repository so it's going to be read-only while you access it.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
using a filesystem capable of compressing on the fly
&lt;/p&gt;
&lt;p&gt;
E.g. &lt;a href="https://serverfault.com/questions/740456/lightweight-transparent-compression-filesystem"&gt;ZFS/BTRFS&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
It seems straightforward enough, thought non-standard file systems might be incompatible with some software, e.g. &lt;a href="https://www.linuxuprising.com/2018/11/how-to-use-dropbox-on-non-ext4.html"&gt;Dropbox&lt;/a&gt;.
I haven't personally tried it.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="dal"&gt;&lt;a class="headerlink" href="#dal"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;6&lt;/span&gt; Data access layer (DAL)&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;span style="color:darkgreen; font-weight: bolder"&gt;Map:&lt;/span&gt; &lt;a href="myinfra.html#dal"&gt;data access layer&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
As I &lt;a class="link-up" href="#design"&gt;mentioned&lt;/a&gt;, all that DAL does is maps raw data (saved on the disk by the &lt;a class="link-up" href="#export_layer"&gt;export layer&lt;/a&gt;) onto abstract objects making it easier to work with in your programs. "Layer" sounds a bit intimidating and enterprisy but usually it's just a single short script.
&lt;/p&gt;
&lt;p&gt;
It's meant to deal with data cleanup, normalization, etc. Doing this at runtime rather than during the export makes it easier to work around data issues, allows experimentation, and is more forgiving if you make some bugs.
&lt;/p&gt;
&lt;p&gt;
  As I mentioned in the &lt;a class="link-up" href="#design"&gt;design principles&lt;/a&gt;, I'm trying to keep data retrieval code and data access code separate
since they serve very different purposes and deal with very different errors.
&lt;/p&gt;
&lt;p&gt;
Just as a reminder what we get as a result:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
resilience
&lt;/p&gt;
&lt;p&gt;
Accessing and working with data on your disk is considerably easier and faster than using APIs.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
offline
&lt;/p&gt;
&lt;p&gt;
You only access data on your disk, which makes you completely independent on the Internet.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
modularity and decoupling: you can use separate tools (even written in different programming languages) for retrieving and accessing data
&lt;/p&gt;
&lt;p&gt;
That's very important, so we all can benefit from existing code and reinventing less wheels.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
backups
&lt;/p&gt;
&lt;p&gt;
Keeping raw data makes them trivial
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="dal_performance"&gt;&lt;a class="headerlink" href="#dal_performance"&gt;¶&lt;/a&gt;performance concerns&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
A natural question is: if you run through all your data snapshots each time you access it, wouldn't it be too slow?
&lt;/p&gt;
&lt;p&gt;
First, it's somewhat similar to the worries about the &lt;a class="link-up" href="#disk_space"&gt;disk space&lt;/a&gt;. Data grows at the quadratic rate; and while processing power doesn't seem to follow Moore's law anymore there is still some potential to scale horizontally and use multiple threads. In practice, for most data sources that I use this process is almost instantaneous without parallelizing anyway.
&lt;/p&gt;
&lt;p&gt;
In addition:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;if you're using iterators/generators/coroutines (e.g. &lt;a href="https://github.com/karlicoss/rexport/blob/874e6116bfba8cbd63fa3b4d93810a1488cb8464/dal.py#L130-L136"&gt;example&lt;/a&gt;), that overhead will be amortized and basically unnoticeable&lt;/li&gt;
&lt;li&gt;you can still use caching. Just make sure it doesn't involve boilerplate or cognitive overhead to use. E.g. &lt;a href="unnecessary-db.html#cachew_cachew"&gt;cachew&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="dal_examples"&gt;&lt;a class="headerlink" href="#dal_examples"&gt;¶&lt;/a&gt;examples&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;div class="noop" id="dal_messenger"&gt;
&lt;p&gt;
Example: &lt;a href="https://github.com/karlicoss/fbmessengerexport/blob/a8f65a259dfa36ab6d175461994356947ded142a/model.py#L27-L47"&gt;DAL for Facebook Messenger&lt;/a&gt; knows how to read messages from the database on your disk, access certain fields (e.g. message body) and how to handle obscure details like converting timestamps to &lt;samp class="inline"&gt;datetime&lt;/samp&gt; objects. 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;it's &lt;b&gt;not&lt;/b&gt; trying to get messages from Facebook, which makes it way faster and more reliable to interact with data&lt;/li&gt;
&lt;li&gt;it's &lt;b&gt;not&lt;/b&gt; trying to do anything fancy beyond providing access to the data, which allows keeping it simple and resilient&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;
You can find more specific examples along with the motivation and explanations here:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="unnecessary-db.html#example_reddit"&gt;Reddit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="unnecessary-db.html#relational"&gt;Instapaper/Endomondo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="unnecessary-db.html#maintaining"&gt;Pocket&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="unnecessary-db.html#example_chrome"&gt;Chrome&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="automatic_exports"&gt;&lt;a class="headerlink" href="#automatic_exports"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;7&lt;/span&gt; Automating exports&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
In my opinion, it's absolutely essential to automate data exports when possible. 
You really don't want to think about it and having a recent version of your data motivates you to actually use it, otherwise there is much less utility.
&lt;/p&gt;
&lt;p&gt;
In addition, it serves as a means of backup, so you don't have to worry about what happens if the service ceases to exist.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="scheduling"&gt;&lt;a class="headerlink" href="#scheduling"&gt;¶&lt;/a&gt;scheduling&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
I run most of my data exports at least daily.
&lt;/p&gt;
&lt;p&gt;
I wrote a whole &lt;a href="scheduler.html"&gt;post&lt;/a&gt; on scheduling and job running with respect to the personal infrastructure. In short:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
on desktop: at the moment, I'm mostly using cron (to be more specific, &lt;a href="scheduler.html#fcron"&gt;fcron&lt;/a&gt;).
&lt;/p&gt;
&lt;p&gt;
I'm still &lt;a href="scheduler.html#solution"&gt;thinking&lt;/a&gt; of an alternative, but overall using cron is okay.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;on Android phone: &lt;a href="scheduler.html#phone"&gt;I'm using Automate app and cron&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="arctee"&gt;&lt;a class="headerlink" href="#arctee"&gt;¶&lt;/a&gt;arctee&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
This is a &lt;a href="https://github.com/karlicoss/arctee"&gt;wrapper script&lt;/a&gt; I'm using to run most of my data exports.
&lt;/p&gt;
&lt;p&gt;
Many things are very common to all data exports, regardless of the source.
In the vast majority of cases, you want to fetch some data, save it in a file (e.g. JSON) along with a timestamp and potentially compress it.
&lt;/p&gt;
&lt;p&gt;
This script aims to minimize the common boilerplate:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;samp class="inline"&gt;path&lt;/samp&gt; argument allows easy ISO8601 timestamping and guarantees atomic writing, so you'd never end up with corrupted exports.&lt;/li&gt;
&lt;li&gt;&lt;samp class="inline"&gt;--compression&lt;/samp&gt; allows to compress simply by passing the extension. No more &lt;samp class="inline"&gt;tar -zcvf&lt;/samp&gt;!&lt;/li&gt;
&lt;li&gt;&lt;samp class="inline"&gt;--retries&lt;/samp&gt; allows easy exponential backoff in case service you're querying is flaky.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Example:
&lt;/p&gt;
&lt;pre class="example"&gt;arctee '/exports/rtm/{utcnow}.ical.zstd' --compression zstd --retries 3 -- /soft/export/rememberthemilk.py
&lt;/pre&gt;
&lt;ol class="org-ol"&gt;
&lt;li&gt;&lt;p&gt;
runs &lt;samp class="inline"&gt;/soft/export/rememberthemilk.py&lt;/samp&gt;, retrying it up to three times if it fails
&lt;/p&gt;
&lt;p&gt;
The script is expected to dump its result in stdout; stderr is simply passed through.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;once the data is fetched it's compressed as &lt;samp class="inline"&gt;zstd&lt;/samp&gt;&lt;/li&gt;
&lt;li&gt;timestamp is computed and compressed data is written to &lt;samp class="inline"&gt;/exports/rtm/20200102T170015Z.ical.zstd&lt;/samp&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
The wrapper operates on regular files and is therefore, programming language agnostic as long as your export script simply outputs to stdout (or accepts a filename, so you can use &lt;samp class="inline"&gt;/dev/stdout&lt;/samp&gt;). It doesn't really matter how exactly (e.g. which programming language) it's implemented.
&lt;/p&gt;
&lt;p&gt;
That said, it feels kind of wrong having an extra script for all these things since they are not hard in principle, just tedious and boring to do all over again. If anyone has bright ideas on simplifying this, I'd be happy to know!
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="fin"&gt;&lt;a class="headerlink" href="#fin"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;8&lt;/span&gt; --&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Approaches that I described here have worked pretty well for me so far. It feels fairly composable, flexible and easy to maintain.
&lt;/p&gt;
&lt;p&gt;
I'm sharing this because I would &lt;b&gt;really&lt;/b&gt; like to make it accessible to more people, so they can also benefit from using their data.
&lt;/p&gt;
&lt;p&gt;
I'd be happy to hear any suggestions on simplifying and improving the system!
&lt;/p&gt;
&lt;p&gt;
Big thanks to &lt;a href="https://jborichevskiy.com"&gt;Jonathan&lt;/a&gt; for reading the draft and suggesting helpful edits.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    &lt;/section&gt;

    
    &lt;section id="post-footer"&gt;
        &lt;div class="post-tags"&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#infra"&gt;#infra&lt;/a&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#dataliberation"&gt;#dataliberation&lt;/a&gt;
        &lt;/div&gt;
        &lt;time datetime="2020-02-13T00:00:00"&gt;13 February 2020&lt;/time&gt;
    &lt;/section&gt;
    

    

    &lt;section id="post-comments"&gt;
    &lt;script data-isso="https://beepb00p.xyz/comments/" data-isso-reply-to-self="true" src="https://beepb00p.xyz/comments/js/embed.min.js"&gt;
&lt;/script&gt;

&lt;section data-isso-id="isso_exports" id="isso-thread"&gt;&lt;/section&gt;
    &lt;/section&gt;
&lt;/article&gt;
    &lt;/main&gt;

    &lt;footer id="bottomfooter"&gt;
        &lt;a href="https://twitter.com/karlicoss"&gt;🐦 me @twitter&lt;/a&gt;
        &lt;a href="https://github.com/karlicoss"&gt;💻 me @github&lt;/a&gt;
        &lt;a href="http://creativecommons.org/licenses/by/4.0" style="margin-left:auto"&gt;CC BY 4.0&lt;/a&gt;&lt;/footer&gt;

&lt;/body&gt;&lt;/html&gt;</description>
      <guid isPermaLink="true">https://beepb00p.xyz/exports.html</guid>
      <pubDate>Thu, 13 Feb 2020 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Against unnecessary databases</title>
      <link>https://beepb00p.xyz/unnecessary-db.html</link>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang="en" prefix="og: http://ogp.me/ns#"&gt;&lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;meta content="width=device-width, initial-scale=1" name="viewport"/&gt;

    &lt;title&gt;Against unnecessary databases | beepb00p&lt;/title&gt;
    &lt;link href="https://beepb00p.xyz/unnecessary-db.html" rel="canonical"/&gt;
    &lt;meta content="infra dataliberation cachew" name="keywords"/&gt;
    &lt;!-- TODO concat with keywords tags; also need to make comma separated? --&gt;

    &lt;!-- can test it with https://telegram.me/webpagebot --&gt;
    &lt;!-- or https://developers.facebook.com/tools/debug --&gt;
    &lt;meta content="website" property="og:type"/&gt;
    &lt;meta content="https://beepb00p.xyz/unnecessary-db.html" property="og:url"/&gt; &lt;!-- todo base? --&gt;
    &lt;meta content="Against unnecessary databases | beepb00p" property="og:title"/&gt;
    &lt;meta content="Parse, don't normalize" property="og:description"/&gt;
    &lt;!-- ugh. why is image necessary??? otherwise other parts aren't working or I get lots of 404s --&gt;
    &lt;!-- ugh. Facebook really wants jpg, but whatever --&gt;
    &lt;!-- also Facebook displays it with black background, but whatever, fuck it. --&gt;
    &lt;!-- svg does't work on  --&gt;
    &lt;meta content="https://beepb00p.xyz/assets/favicon.png" property="og:image"/&gt;

    &lt;!-- Icon made by Twitter --&gt;
    &lt;!-- https://twemoji.twitter.com/content/twemoji-twitter/en.html --&gt;
    &lt;!-- todo replace with svg favicon? most browsers support it --&gt;
    &lt;link href="./assets/favicon.png" rel="icon"/&gt;

    &lt;meta content="https://github.com/karlicoss/beepb00p" name="generator"/&gt;
    &lt;meta content="English" name="language"/&gt;

    &lt;!-- TODO get rid of google font. probably Georgia or Garamond? sadly they aren't available in Ubuntu by default.. --&gt;
    &lt;link href="https://fonts.gstatic.com" rel="preconnect"/&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&amp;amp;display=swap" rel="stylesheet"/&gt;

    &lt;link href="./assets/css/default.css" rel="stylesheet"/&gt;
    &lt;!-- TODO make conditional?? --&gt;
    &lt;link href="./assets/css/posts-list.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/links.css" rel="stylesheet"/&gt;

    &lt;!-- &lt;link rel="stylesheet" href="/assets/css/org.css" /&gt; --&gt;
    &lt;link href="./assets/css/htmlize.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-default.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-extra.css" rel="stylesheet"/&gt;
    &lt;script&gt;
    const TID = 'settings-timestamps';
function timestampsCheckbox() {
    return document.getElementById(TID)
}

window.onload = () =&gt; {
    const box = timestampsCheckbox()
    function setState(state) {
        box.checked = state
        const dd = state ? 'initial' : 'none'
        Array.from(document.querySelectorAll('.timestamp-wrapper, .property.CREATED')).map(x =&gt; {
            x.style.display = dd
        })
        localStorage.setItem(TID, JSON.stringify(state))
    }

    let state = localStorage.getItem(TID)
    if (state != null) {
        state = JSON.parse(state)
    } else {
        state = true
    }
    // todo a bit annoying that it glitches this way.. but whatever
    setState(state)
    // user click
    box.addEventListener('change', (event) =&gt; {
        setState(box.checked)
    })
}&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;!-- TODO not sure what to do on mobile devices? --&gt;
    &lt;!-- https://www.gwern.net/ --&gt;
    &lt;!-- could use position: fix so it's displayed  --&gt;
    &lt;div id="settings" style="position:fixed; top: 0; right:0; opacity: 0.3"&gt;
        &lt;!-- TODO headerlinks etc? --&gt;
        settings:
        &lt;div&gt;show timestamps&lt;input id="settings-timestamps" type="checkbox"/&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;nav id="topnav"&gt;
        &lt;a href="./"&gt;Home&lt;/a&gt;
        &lt;a href="./ideas.html"&gt;Ideas&lt;/a&gt;
        &lt;a href="./exobrain"&gt;Exobrain&lt;/a&gt;
        &lt;a href="./tags.html"&gt;Tags&lt;/a&gt;

        &lt;a href="./feed.html" style="margin-left:auto"&gt;Feed&lt;/a&gt;
        &lt;!-- margin-left aligns the rest to the right in flex layout --&gt;
        &lt;a href="./site.html"&gt;Site&lt;/a&gt;
        &lt;a href="./me.html"&gt;Me&lt;/a&gt;

        &lt;span style="font-size: 0.4em;"&gt;
            &lt;a href="https://twitter.com/karlicoss" style="display:block;"&gt;@twitter&lt;/a&gt;
            &lt;a href="https://github.com/karlicoss" style="display:block;"&gt;@github&lt;/a&gt;
        &lt;/span&gt;
    &lt;/nav&gt;

    &lt;!-- main contains the stuff which is not repeated across the site --&gt;
    &lt;main&gt;
        &lt;article&gt;
    
    &lt;section id="post-title"&gt;
    &lt;h1&gt;
        Against unnecessary databases
        &lt;a href="./blog-graph.html#against_db" style="font-size: 1rem;vertical-align: super;" title="See this post within the blog graph, and how it's connected to other posts"&gt;[see within blog graph]&lt;/a&gt;
    &lt;/h1&gt;
    &lt;div class="summary"&gt;Parse, don't normalize
    &lt;/div&gt;&lt;/section&gt;
    &lt;!-- are sections appropriate for that? --&gt;

    &lt;section id="post-content"&gt;
    &lt;p&gt;
In my previous post about the &lt;a href="my-data.html"&gt;data I collect&lt;/a&gt;, I mentioned numerous scripts I implemented, to export my personal data from the cloud, locally.
&lt;/p&gt;
&lt;p&gt;
In this post, I want to start sharing some of the design principles I discovered for making these scripts &lt;b&gt;robust, generic and flexible&lt;/b&gt;.
This is part of a series on building your own &lt;a href="sad-infra.html#data_mirror"&gt;'data mirror'&lt;/a&gt;, and there are also more posts to follow!
&lt;/p&gt;
&lt;p&gt;
Once you've managed to get through &lt;a href="sad-infra.html#exports_are_hard"&gt;various difficulties&lt;/a&gt; and retrieve your data from the cloud, you want to persist it on the disk.
&lt;/p&gt;
&lt;p&gt;
If the exported data is already in an sqlite database, that's great (lucky you!). Keep it and don't let go 🙃
&lt;/p&gt;
&lt;p&gt;
Typically though, you end up with some JSON/XML from the API, or HTML if you had to scrape. After that, you have a choice:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
keep it as is 
&lt;/p&gt;
&lt;p&gt;
This is the simplest thing to do and also the approach &lt;a class="link-down" href="#asis"&gt;I advocate for&lt;/a&gt;.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
during export, keep the data on disk as is
&lt;/p&gt;
&lt;p&gt;
No matter how you dislike the format; just store it.
E.g. if it was an XML, let it be XML. If you scraped an HTML, just keep it as is.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
to access the data, implement bindings on your favorite programming language that extract the necessary bits in runtime
&lt;/p&gt;
&lt;p&gt;
I elaborate more on it &lt;a class="link-down" href="#asis"&gt;later&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
If this is obvious to you, then great, hope you will learn something useful from this post nevertheless!
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
keep it in a database
&lt;/p&gt;
&lt;p&gt;
This is what I see some projects doing; I also bruised myself with this approach when I started exporting my data.
&lt;/p&gt;
&lt;p&gt;
Come up with a database schema and create a &lt;b&gt;"master database"&lt;/b&gt;, holding all of your past data.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;during export, extract the necessary data from XML/JSON/whatever and put it in the database.&lt;/li&gt;
&lt;li&gt;to access the data, query the database directly or implement data bindings on your favorite programming language.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In this post, &lt;b&gt;I want to argue very strongly against forcing the data in the database, unless it's really inevitable&lt;/b&gt;.
More broadly, this also applies to any attempts of normalizing data before persisting it, even if it's not a database.
&lt;/p&gt;
&lt;p&gt;
Now before someone thinks I'm some sort of weirdo database hater, I want to make some things clear!
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
this article refers to storing &lt;b&gt;your own personal data and digital trace&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
In general, there absolutely are cases where using a database is the only feasible and reasonable way of keeping and accessing data.
However, the amounts of data involved are quite different too.  
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
I want to argue about this not because I don't like databases/SQL or any other personal preferences
&lt;/p&gt;
&lt;p&gt;
Quite the opposite, &lt;b&gt;I wish I could run SQL queries against Instapaper's or Twitter's servers&lt;/b&gt;. Needless to say, it's &lt;a href="sad-infra.html#why"&gt;not quite the way things work&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I want to argue on this point because I feel like an unnecessary use of databases is a source of friction for implementing, and more importantly, maintaining your personal data exports, and &lt;a class="link-down" href="#api_extended"&gt;restricts you&lt;/a&gt; from using your data to the full capacity when you want it.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
My main claim is that for personal data, databases have benefits as a means of &lt;b&gt;intermediate&lt;/b&gt; storage, for caching, and as &lt;b&gt;one of&lt;/b&gt; the interfaces to your data, but &lt;b&gt;not as the primary&lt;/b&gt; storage of exported data.
&lt;/p&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#asis"&gt;1. What do you suggest?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#example_reddit"&gt;example: Reddit export&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#databases_good"&gt;2. Databases are good&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#space"&gt;take less space&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#performance"&gt;efficient data access&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sql"&gt;query language&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#rows"&gt;SQL rows are a better 'data interface' than JSON&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#constraints"&gt;types and constraints&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#easy_bindings"&gt;easy to map onto any language&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#databases_hard"&gt;3. Databases are hard&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#relational"&gt;relational model&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#schema"&gt;coming up with a schema&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#maintaining"&gt;maintaining&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#append"&gt;4. Append, don't modify&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#example_chrome"&gt;Example: Chrome history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#cachew"&gt;5. Appendix: when you really really want a database&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#cachew_cachew"&gt;cachew&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#fin"&gt;6. --&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="asis"&gt;&lt;a class="headerlink" href="#asis"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; What do you suggest?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Before I jump into explaining what's my problem with databases, let me summarize my current approach, so that it's clear what I'm suggesting as an alternative.
&lt;/p&gt;
&lt;p&gt;
Liberating your data involves fairly different, if not complementary, parts (or 'layers'):
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;"data export" part: knows how to get data from the cloud and saves it on the disk. Deals with APIs, network, etc.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
"data access" part: knows how to interpret whatever you exported on your disk and maps onto abstract entities/classes/objects
&lt;/p&gt;
&lt;p&gt;
I'll refer to it interchangeably as &lt;b&gt;"data access layer (DAL)"&lt;/b&gt; or &lt;b&gt;"data bindings"&lt;/b&gt; further in the article.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
My suggestions are:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
during data export, &lt;b&gt;store data as is&lt;/b&gt;, don't try to clean it up or normalize
&lt;/p&gt;
&lt;p&gt;
This allows you to keep your data safe as soon as you managed to retrieve it, and more forgiving to bugs and inconsistencies.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
during data access, merge and &lt;b&gt;normalize your data in runtime&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
This makes the export part simpler, saves you time on maintaining data and allows for faster iterations while working with it.
&lt;/p&gt;
&lt;p&gt;
Normalizing on every access might cause some overhead, of course, which I'll discuss &lt;a class="link-down" href="#performance"&gt;later&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
if necessary use databases as an intermediate layer to speed access up and as an additional interface to your data
&lt;/p&gt;
&lt;p&gt;
Nothing wrong with using databases for &lt;a class="link-down" href="#cachew"&gt;caching&lt;/a&gt; if you need it!
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
And as a specific example:
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="example_reddit"&gt;&lt;a class="headerlink" href="#example_reddit"&gt;¶&lt;/a&gt;example: Reddit export&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;a href="https://github.com/karlicoss/rexport"&gt;rexport&lt;/a&gt; is a script to export user's Reddit data like saved post/comments/submissions and upvotes.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
export layer
&lt;/p&gt;
&lt;p&gt;
If you ignore the argparse boilerplate, the export &lt;a href="https://github.com/karlicoss/rexport/blob/874e6116bfba8cbd63fa3b4d93810a1488cb8464/export.py#L69-L96"&gt;itself&lt;/a&gt; is very simple, just a matter of calling API methods (I'm using existing bindings) and combining the results into a JSON object.
After that, data is immediately persisted on a disk.
&lt;/p&gt;
&lt;p&gt;
Reddit API is restricted to the 1000 latest items, so to have a full view of my data, I need to 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;export it regularly (which I do)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
save each exported data slice in a new file, which I also do
&lt;/p&gt;
&lt;p&gt;
Using timestamp as a filename is a natural choice, I'm using &lt;a href="https://github.com/karlicoss/arctee"&gt;arctee&lt;/a&gt; tool to do this for all of my exports.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
data access layer
&lt;/p&gt;
&lt;p&gt;
The data access layer provides simple Python classes that make it pleasant to work with the data. 
&lt;/p&gt;
&lt;p&gt;
My bindings simply expose saved JSON data via Python's properties: e.g. &lt;a href="https://github.com/karlicoss/rexport/blob/874e6116bfba8cbd63fa3b4d93810a1488cb8464/dal.py#L52-L65"&gt;&lt;code class="inline"&gt;Comment&lt;/code&gt;&lt;/a&gt;. 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;if I ever need to extract something else from the raw JSON (e.g. upvotes), that would only be a matter of adding three lines of code into &lt;code class="inline"&gt;Comment&lt;/code&gt; class&lt;/li&gt;
&lt;li&gt;in contrast, had I kept the data in a database, that would have required a database migration for &lt;samp class="inline"&gt;Comments&lt;/samp&gt; table &lt;a class="link-down" href="#api_extended"&gt;at the very least&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Now, remember I mentioned that Reddit only gives you the latest 1000 items, so I end up with overlapping data slices? To get a full view of my data, I'm simply going through individual JSON files in chronological order and merging together in &lt;a href="https://github.com/karlicoss/rexport/blob/874e6116bfba8cbd63fa3b4d93810a1488cb8464/dal.py#L136-L153"&gt;&lt;code class="inline"&gt;accumulate&lt;/code&gt;&lt;/a&gt; method.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
[optional] caching layer
&lt;/p&gt;
&lt;p&gt;
I've got Reddit data way into past and export it every day, so merging together all these files during data access can indeed take a noticeable time.
&lt;/p&gt;
&lt;p&gt;
I'm overcoming this by using a &lt;a href="https://github.com/karlicoss/my/blob/12330dd6041b9a4ee66571dca845947988e6f474/my/reddit.py#L51"&gt;&lt;code class="inline"&gt;@cachew&lt;/code&gt;&lt;/a&gt; annotation on the &lt;code class="inline"&gt;comments()&lt;/code&gt; method.
&lt;/p&gt;
&lt;p&gt;
One annotation, that's it. Look ma, no SQL! Okay, okay, there is quite a bit of SQL involved, but it's all hidden inside &lt;a href="https://github.com/karlicoss/cachew#how-it-works"&gt;cachew&lt;/a&gt;. It would also work for any other source of personal data.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="databases_good"&gt;&lt;a class="headerlink" href="#databases_good"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; Databases are good&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
In this section, I'll present typical arguments &lt;b&gt;for&lt;/b&gt; using databases, and will try to argue, that in most circumstances (for keeping personal data), the benefits are not pragmatic and not worth &lt;a class="link-down" href="#databases_hard"&gt;the tradeoffs&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Note that generally, databases have numerous other benefits, however, I'll emphasize again, here I'm only considering aspects that are relevant to &lt;b&gt;personal data storage&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
When I say 'database' here, I typically mean Sqlite, which is most commonly used for personal data, although specific database, relational or not, shouldn't matter.
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:darkorange"&gt;&lt;strong&gt;If you think I've missed out on something, please let me know!&lt;/strong&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="space"&gt;&lt;a class="headerlink" href="#space"&gt;¶&lt;/a&gt;take less space&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Yes, however in most cases your data export will take few megabytes anyway. If you compress it, it's hundreds of kilobytes.
&lt;/p&gt;
&lt;p&gt;
Storage saved by using a database instead of plaintext is marginal and not worth the effort.
&lt;/p&gt;
&lt;p&gt;
Only exceptions I can think of are: 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;instant messaging apps: number of text messages approaches millions&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
continuous data like room temperature, CO2 levels, etc
&lt;/p&gt;
&lt;p&gt;
If you have a minute by minute stream of &lt;b&gt;uniform data&lt;/b&gt;, a database is probably the way to go.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="performance"&gt;&lt;a class="headerlink" href="#performance"&gt;¶&lt;/a&gt;efficient data access&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
The same point applies as in the &lt;a class="link-up" href="#space"&gt;previous section&lt;/a&gt;. If a your data export contains several thousand items, you won't notice the difference.
&lt;/p&gt;
&lt;p&gt;
In addition, there are &lt;a class="link-down" href="#cachew"&gt;ways&lt;/a&gt; of getting most of the database benefits without having to sacrifice simplicity and without writing SQL boilerplate.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="sql"&gt;&lt;a class="headerlink" href="#sql"&gt;¶&lt;/a&gt;query language&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
SQL is extremely powerful and helps you to interact with your data without distracting on low-level retrieval details.
&lt;/p&gt;
&lt;p&gt;
That's a very good point, but query language doesn't necessarily mean a database. 
E.g. see &lt;a href="https://pandas.pydata.org"&gt;pandas&lt;/a&gt; which is capable of what SQL is capable of, and even more convenient than SQL for our data exploration purposes.
&lt;/p&gt;
&lt;p&gt;
In addition, see &lt;a class="link-down" href="#relational"&gt;the counterargument&lt;/a&gt; about the restrictions of the relational model.
&lt;/p&gt;
&lt;p&gt;
And finally, nothing prevents you from providing a database as an &lt;a class="link-down" href="#cachew"&gt;additional interface&lt;/a&gt; to your data.   
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Example&lt;/b&gt;: exposing &lt;a href="https://github.com/karlicoss/my/blob/6787c9c0d6a6e0aff49565cf299464a7a9b40e9f/my/jawbone/__init__.py#L267-L280"&gt;jawbone sleep data&lt;/a&gt; as a dataframe.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="rows"&gt;&lt;a class="headerlink" href="#rows"&gt;¶&lt;/a&gt;SQL rows are a better 'data interface' than JSON&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
That's kind of a subjective point (although I'd rather agree).
&lt;/p&gt;
&lt;p&gt;
However, raw rows, while good enough for simple queries, can only get you so far.
&lt;/p&gt;
&lt;p&gt;
   While Sqlite is more pleasant to query than JSON (but still, do check out out &lt;a href="https://stedolan.github.io/jq"&gt;jq&lt;/a&gt;),
once you start using your data repeatedly, you want to abstract away from the low-level rows and encode with proper datatypes (in your favorite target programming language). E.g. you want to use strings that have the familiar methods, datetime types, data classes, etc.
&lt;/p&gt;
&lt;p&gt;
I want an &lt;a href="https://en.wikipedia.org/wiki/Data_access_layer"&gt;abstract interface&lt;/a&gt; to my data, and I'm not alone, &lt;a href="https://en.wikipedia.org/wiki/Object-relational_mapping"&gt;ORMs&lt;/a&gt; exist for a reason.
&lt;/p&gt;
&lt;p&gt;
So, in either case, you need to write data bindings. Say, you want to export some data from an API.
&lt;/p&gt;
&lt;p&gt;
We're comparing two options:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
option 1
&lt;/p&gt;
&lt;p&gt;
during export:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;retrieve the JSON from the API&lt;/li&gt;
&lt;li&gt;keep it on the disk as is. Trivial step, just save in the file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
during data access:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;parse JSON&lt;/li&gt;
&lt;li&gt;map data onto the abstract interface&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
option 2
&lt;/p&gt;
&lt;p&gt;
during export:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;retrieve the JSON from the API&lt;/li&gt;
&lt;li&gt;parse JSON, transform and normalize data &lt;a class="link-down" href="#relational"&gt;to conform to the database&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;insert in the database. Often not a trivial step due to transactions and multiple insert/update statements.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
during data access:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;make a SQL query&lt;/li&gt;
&lt;li&gt;map data onto the abstract interface&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Note that you have fewer steps if you follow the first approach. And it's not only about the time saved on implementing: the less you transform the data, the less the chance you screw something up. I'll elaborate with a specific example of a royal screw up &lt;a class="link-down" href="#example_chrome"&gt;later&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="constraints"&gt;&lt;a class="headerlink" href="#constraints"&gt;¶&lt;/a&gt;types and constraints&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Even though schemas in Sqlite are annotated with types, that &lt;b&gt;doesn't give you strong typing guarantees in runtime&lt;/b&gt;, a concept that is gently called &lt;a href="https://www.sqlite.org/quirks.html#flexible_typing"&gt;&lt;b&gt;"flexible typing"&lt;/b&gt;&lt;/a&gt;. In other words, your data is implicitly coerced which may be convenient but might cause some unanticipated failures later.
&lt;/p&gt;
&lt;p&gt;
SQL &lt;a href="https://www.tutorialspoint.com/sql/sql-check.htm"&gt;constraints&lt;/a&gt; are a potentially great way to guarantee intrinsic consistency of your data.
If you encode consistency checks in your target SQL, you will be protected from corrupting the logical state, even if you try to mess with the database manually.
&lt;/p&gt;
&lt;p&gt;
This is great in theory, however, doesn't work so well on practice for personal data:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;when you use something like PostgreSQL, you've got &lt;a href="https://severalnines.com/database-blog/understanding-check-constraints-postgresql"&gt;PL/pgSQL&lt;/a&gt; at hand, a real programming language, to encode your constraints&lt;/li&gt;
&lt;li&gt;when you use Sqlite, it's a bit more tedious, there is a &lt;a href="https://www.sqlite.org/c3ref/create_function.html"&gt;C API&lt;/a&gt; to interface with custom functions. Otherwise, you're limited by native Sqlite functions, hence encoding constraints might be very awkward. Needless to say, very few people would (and do) bother using it unless it's absolutely vital to implement such checks.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In addition, with regards to personal data, it's easier to assume a "single writer" model and encode constraint checking in the programming language, during data access.
&lt;/p&gt;
&lt;p&gt;
My observation is: &lt;b&gt;if you don't own the schema, you won't get it right&lt;/b&gt;. The services break their APIs, underdocument, or return utter garbage all the time.
&lt;/p&gt;
&lt;p&gt;
The alternative I suggest, storing raw data as is, means that at least:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;you won't make it any more inconsistent than it already is&lt;/li&gt;
&lt;li&gt;if you misinterpret the data, that's just a code change, data is not corrupted&lt;/li&gt;
&lt;li&gt;you will massively save on your time and mental resources&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="easy_bindings"&gt;&lt;a class="headerlink" href="#easy_bindings"&gt;¶&lt;/a&gt;easy to map onto any language&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
That's a good point, also somewhere along the lines of &lt;a class="link-up" href="#rows"&gt;'better data interfaces'&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Exporting data is one part, and it doesn't particularly matter who implemented it and how, as long as it works for you.
&lt;/p&gt;
&lt;p&gt;
Accessing is different, the realities of the modern &lt;a href="https://en.wikipedia.org/wiki/Foreign_function_interface"&gt;FFI&lt;/a&gt; are such that typically, it's easier to reimplement the data bindings from scratch on the programming language you prefer.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;if the data is kept as is (e.g. as unnormalized JSON), that means reimplementing the data extraction and parsing logic from scratch&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
if the data is kept in Sqlite, it's already to some extent structured and normalized
&lt;/p&gt;
&lt;p&gt;
That means that data bindings could be simply a matter of writing datatype definitions and using some database bindings, which is fairly straightforward.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I have to admit, I don't have much to counter this. This is a tradeoff I have accepted while writing tools for export.
&lt;/p&gt;
&lt;p&gt;
I want other people to use them, so we have a collective stake in maintaining them.
I write in Python, so hopefully, it's covering enough people.
&lt;/p&gt;
&lt;p&gt;
That said, I'll repeat my point that you can still use a database &lt;a class="link-down" href="#cachew"&gt;as an intermediate layer&lt;/a&gt;, without relying on it as a primary data storage. 
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="databases_hard"&gt;&lt;a class="headerlink" href="#databases_hard"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; Databases are hard&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Now let's go through things that directly make databases hard.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="relational"&gt;&lt;a class="headerlink" href="#relational"&gt;¶&lt;/a&gt;relational model&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
These days we often just say 'database' when we mean &lt;a href="https://en.wikipedia.org/wiki/Relational_database"&gt;'relational database&lt;/a&gt;'. 
Relational databases can be vaguely thought of as "a set of tables, each table storing typed data tuples".
Such simplicity allows for query language expressiveness and enables the optimizer to reason about data retrieval.
&lt;/p&gt;
&lt;p&gt;
At the same time, this simplicity is a curse and imposes structure that might be incompatible with the format that you receive data in.
Often, the relational model requires you to rearrange data before inserting, which might break data consistency.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="relational_examples"&gt;&lt;a class="headerlink" href="#relational_examples"&gt;¶&lt;/a&gt;Examples&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
Imagine you want to export your Instapaper bookmarks.
&lt;/p&gt;
&lt;p&gt;
API offers you a &lt;a href="https://www.instapaper.com/api"&gt;&lt;samp class="inline"&gt;/bookmarks/list&lt;/samp&gt;&lt;/a&gt; method, that lists user's bookmarks.
The catch is it doesn't require all of them; it's got a required &lt;samp class="inline"&gt;folder_id&lt;/samp&gt; parameter.
&lt;/p&gt;
&lt;p&gt;
For your export, that means that you have to go through the folders (i.e. "unread", "archive", etc.), and export each list individually.
Instead of a nice and flat bookmark list, you've got a &lt;code class="inline"&gt;Folder → Bookmark&lt;/code&gt; hierarchy. To make it compatible with the &lt;code class="inline"&gt;Bookmarks&lt;/code&gt; table, you need to flatten it first.
&lt;/p&gt;
&lt;p&gt;
There are some potential caveats during that: you could end up with duplicates if folders are not mutually exclusive or just due to inherent data races between multiple API requests, so you have to uniquify the bookmarks, which is an extra thing to think about.
&lt;/p&gt;
&lt;p&gt;
While in theory, nothing prevents &lt;code class="inline"&gt;Bookmark ↔ Folder&lt;/code&gt; from fitting in a relational model, the nature of the API interactions makes it awkward to implement on the client side.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
Imagine you want to export your Endomondo workouts.
&lt;/p&gt;
&lt;p&gt;
API offers you a list of workouts (represented as JSON) with various metadata (types of exercise/datetime/private notes) and in addition, heart rate data and location data.
&lt;/p&gt;
&lt;p&gt;
How do you keep heart rate and location?
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;in a massive &lt;a href="https://www.sqlite.org/datatype3.html"&gt;&lt;code class="inline"&gt;BLOB&lt;/code&gt;&lt;/a&gt; or &lt;code class="inline"&gt;TEXT&lt;/code&gt; column? That's barely better than simply serializing everything as JSON.&lt;/li&gt;
&lt;li&gt;in separate tables, with timestamps as the primary keys? Then you'd need to refer to them as 'timestamp ranges' which would make it pretty tedious to insert and access.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="schema"&gt;&lt;a class="headerlink" href="#schema"&gt;¶&lt;/a&gt;coming up with a schema&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Kind of similar to the points on &lt;a class="link-up" href="#constraints"&gt;types&lt;/a&gt; and the &lt;a class="link-up" href="#relational"&gt;relational model&lt;/a&gt;, often you need first-hand knowledge of the API to come up with a correct and reasonable schema.
&lt;/p&gt;
&lt;p&gt;
Schemas use a fixed number of fields, which requires you to scrupulously inspect the data and make sure you've covered everything by your schema.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="maintaining"&gt;&lt;a class="headerlink" href="#maintaining"&gt;¶&lt;/a&gt;maintaining&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Inevitably, APIs change and extend, often without you knowing that (or not having time to follow the API news).
If the API starts returning more data, that means the database scheme needs to change.
&lt;/p&gt;
&lt;p&gt;
Depending on the way you implemented it, that means one of two things:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
best-case scenario: you implement checks for the API schema and fail your export script on a mismatch.
&lt;/p&gt;
&lt;p&gt;
Now you are aware of API changes, but your export script stopped working and requires attention and fixing
Depending on the specific service and on how much do you value your data, it might require a &lt;a class="link-down" href="#api_backward"&gt;fast fixing response&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
worst-case scenario: you had no checks for schema changes and you're not even aware of it.
&lt;/p&gt;
&lt;p&gt;
Sometimes it's fine, but sometimes that means &lt;a class="link-down" href="#incremental"&gt;losing data forever&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Consider the following scenarios and how we handle them:
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="api_extended"&gt;&lt;a class="headerlink" href="#api_extended"&gt;¶&lt;/a&gt;API is extended, i.e. returns more data&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
Let's consider a specific example, Pocket API.      
&lt;/p&gt;
&lt;p&gt;
At the moment it only lets you access your 'articles', i.e. URLs you bookmarked to Pocket.
Imagine that you're using a database to export them, so your schema is: &lt;code class="inline"&gt;TABLE Article(STRING id, STRING url, STRING title, DATETIME added)&lt;/code&gt;.
&lt;/p&gt;
&lt;p&gt;
One day, the developers expose highlights (or annotations) from the &lt;a href="https://github.com/karlicoss/pockexport#setting-up"&gt;private API&lt;/a&gt; and your export script stats receiving it in the response JSON.
It's quite useful data to have!
&lt;/p&gt;
&lt;p&gt;
However, your database can't just magically change to conform to the new field. In addition, we've got the same issue with mapping onto the &lt;a class="link-up" href="#relational"&gt;relational model&lt;/a&gt; here: we've got an
&lt;code class="inline"&gt;Article → Highlight&lt;/code&gt; hierarchy, which we need to manually split up into separate tables. So you'd need to:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
find out that there is a new JSON field in the first place
&lt;/p&gt;
&lt;p&gt;
That's, of course, regardless of what storage you're using, but in case of a master database, you really might want to &lt;a class="link-down" href="#incremental"&gt;find it out sooner than later&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
come up a schema and create a new table, &lt;code class="inline"&gt;Highlight&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Don't forget to use the correct primary key, &lt;samp class="inline"&gt;(highlight_id, bookmark_id)&lt;/samp&gt;. Who knows whether &lt;samp class="inline"&gt;highlight_id&lt;/samp&gt; is unique across bookmarks boundaries?
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
migrate old data
&lt;/p&gt;
&lt;p&gt;
Why can't I just create the database from scratch, you ask? Well, that may not always be an option.
&lt;/p&gt;
&lt;p&gt;
Sometimes you &lt;a class="link-down" href="#incremental"&gt;don't have access&lt;/a&gt; to older data anymore.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The alternative &lt;a class="link-up" href="#asis"&gt;I suggest&lt;/a&gt; is keeping raw data and dealing normalizing during data access. Let's see how that would work:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
when new &lt;samp class="inline"&gt;annotations&lt;/samp&gt; field is introduced, it's automatically kept on disk along with everything else
&lt;/p&gt;
&lt;p&gt;
When you find out about it later, you can still use annotations from the previously exported data.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
supporting this field is extremely easy
&lt;/p&gt;
&lt;p&gt;
If you keep raw data, it's just a matter of adding a &lt;a href="https://github.com/karlicoss/pockexport/blob/8e141e12663a611891622bfe57dc8b7babdf6526/dal.py#L48-L52"&gt;getter&lt;/a&gt; method to the &lt;code class="inline"&gt;Article&lt;/code&gt; class.
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-type"&gt;@property&lt;/span&gt;
&lt;span class="org-keyword"&gt;def&lt;/span&gt; &lt;span class="org-function-name"&gt;highlights&lt;/span&gt;(&lt;span class="org-keyword"&gt;self&lt;/span&gt;) -&amp;gt; Sequence[Highlight]:
    &lt;span class="org-variable-name"&gt;default&lt;/span&gt; = [] &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;defensive to handle older export formats that had no annotations&lt;/span&gt;
    &lt;span class="org-variable-name"&gt;jsons&lt;/span&gt; = &lt;span class="org-keyword"&gt;self&lt;/span&gt;.json.get(&lt;span class="org-string"&gt;'annotations'&lt;/span&gt;, default)
    &lt;span class="org-keyword"&gt;return&lt;/span&gt; &lt;span class="org-builtin"&gt;list&lt;/span&gt;(&lt;span class="org-builtin"&gt;map&lt;/span&gt;(Highlight, jsons))
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
Modifying code is way easier than messing with databases and modifying the data.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="api_backward"&gt;&lt;a class="headerlink" href="#api_backward"&gt;¶&lt;/a&gt;API breaks backward compatibility&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
Imagine that for some reason &lt;a class="link-up" href="#example_reddit"&gt;Reddit API&lt;/a&gt; started returning &lt;a href="https://en.wikipedia.org/wiki/ISO_8601"&gt;isoformatted&lt;/a&gt; date strings instead of epochs (i.e. &lt;samp class="inline"&gt;20200126T19:43:21Z&lt;/samp&gt; instead of &lt;samp class="inline"&gt;1580067801&lt;/samp&gt;).
&lt;/p&gt;
&lt;p&gt;
Your existing &lt;code class="inline"&gt;Comment&lt;/code&gt; table assumed &lt;code class="inline"&gt;INTEGER&lt;/code&gt; for the comment creation date. Suddenly you started receiving strings, which Sqlite can't handle anymore.
&lt;/p&gt;
&lt;p&gt;
You have similar issues to the previous section: you need to migrate your old data. But there is even a bigger issue: &lt;b&gt;your data exports are not advancing anymore&lt;/b&gt; until you perform the migration. That's problematic because you might lose data forever if you postpone the fix for too long.
&lt;/p&gt;
&lt;p&gt;
In contrast, if you &lt;a class="link-up" href="#asis"&gt;keep raw data&lt;/a&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
your downstream tools, consuming exported data, start choking over wrong type stored in the JSON
&lt;/p&gt;
&lt;p&gt;
The massive difference though is: there is &lt;b&gt;no time pressure to fix&lt;/b&gt;, you know that at least your data is getting exported locally
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
fixing this issue is really quick: two lines of defensive code
&lt;/p&gt;
&lt;p&gt;
Testing the fix is trivial, code changes are easy and &lt;b&gt;reversible&lt;/b&gt; thanks to version control.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Database migrations are very hard, and you want to avoid them at all costs.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="append"&gt;&lt;a class="headerlink" href="#append"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; Append, don't modify&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
When it comes to exporting data, there are two very different cases:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
you can access all data at once
&lt;/p&gt;
&lt;p&gt;
This is an easy case, and you can just retrieve all over again every time.
&lt;/p&gt;
&lt;p&gt;
Example: Pinboard API, there are just a few megabytes of data you have on Pinboard and API doesn't prevent you from retrieving all of it at once.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a id="incremental"&gt;&lt;/a&gt;at any time you only have a slice of data available
&lt;/p&gt;
&lt;p&gt;
There are different reasons for this:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
many APIs restrict the number of latest items you can retrieve
&lt;/p&gt;
&lt;p&gt;
Examples:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://github.com/karlicoss/rexport#limitations"&gt;Reddit&lt;/a&gt; limits your API requests to 1000 results, due to some performance considerations&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.monzo.com/#list-transactions"&gt;Monzo bank API&lt;/a&gt; only gives you last 90 days of transactions, presumably for security reasons&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
data retention
&lt;/p&gt;
&lt;p&gt;
Example: chrome history is only retained for 90 days
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
limited memory
&lt;/p&gt;
&lt;p&gt;
Examples: temperature sensors, HR sensors, and other embedded devices
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
That means the data exports are now &lt;b&gt;incremental&lt;/b&gt;. This case is tricky because:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;you need to run your export scripts regularly, otherwise, you might miss some data&lt;/li&gt;
&lt;li&gt;you need some sort of 'merging' logic to combine a new slice of data with the data already exported&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In this section, we'll be dealing with this case, and this 'merging' logic is what we'll be discussing.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
How to deal with 'merging' data? Again, we have two alternatives here:
&lt;/p&gt;
&lt;ol class="org-ol"&gt;
&lt;li&gt;&lt;p&gt;
keep everything in a single database
&lt;/p&gt;
&lt;p&gt;
Come up with a schema for the 'master database'.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;during export: normalize and insert new data into the master database.&lt;/li&gt;
&lt;li&gt;during data access: map data rows onto specific classes and datatypes&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;keep exported slices intact

&lt;ul class="org-ul"&gt;
&lt;li&gt;during export: save each new data slice along with the timestamp&lt;/li&gt;
&lt;li&gt;during data access: go through the slices in the order of timestamp increase and assemble the full view of data.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
As you might have guessed, I want to advocate against the first approach. Don't try to merge your data during exporting, unless it's really necessary.
&lt;/p&gt;
&lt;p&gt;
First of all, all the reasons from the &lt;a class="link-up" href="#databases_hard"&gt;previous section&lt;/a&gt; apply. In addition:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
you have to be &lt;b&gt;even more careful&lt;/b&gt; about transactional logic since you might corrupt your export for good
&lt;/p&gt;
&lt;p&gt;
Remember, you may not be able to retrieve older data anymore.  
&lt;/p&gt;
&lt;p&gt;
While it's not hard to use transactions, it's still harder than simply using atomic file write.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
slices of data separated in time are &lt;b&gt;even more likely to be inconsistent&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
As an example, imagine the API changes some internals, i.e. the way IDs are assigned, that doesn't matter when you export everything at once.
&lt;/p&gt;
&lt;p&gt;
However, for an incremental export, if old IDs were persisted in the database, it may cause issues.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
That's where 'append' in the section title comes from, instead of merging data and modifying the master database, we 'append' data on the disk without modifying anything.
This is not a new approach and a common software engineering practice:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Persistent_data_structure#Examples_of_persistent_data_structures"&gt;Persistent data structures&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/ZFS#Copy-on-write_transactional_model"&gt;ZFS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://martinfowler.com/eaaDev/EventSourcing.html"&gt;Event sourcing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I've already mentioned that regarding &lt;a class="link-up" href="#example_reddit"&gt;Reddit&lt;/a&gt; a few times, but let me illustrate the 'inconsistency' aspect with a more specific example:
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="example_chrome"&gt;&lt;a class="headerlink" href="#example_chrome"&gt;¶&lt;/a&gt;Example: Chrome history&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
As I mentioned, Chrome only keeps the history for the last 90 days.
Imagine you want to retain all your past browsing history. And no, you &lt;a href="./takeout-data-gone.html"&gt;can't rely on Takeout&lt;/a&gt; for that, or you might not be using Google at all.
&lt;/p&gt;
&lt;p&gt;
So you want a script that exports your history, say, every week and maintains full browsing history over the years.
&lt;/p&gt;
&lt;p&gt;
Chrome keeps the history in an sqlite file, and exporting it is trivial! It's just a matter of copying &lt;samp class="inline"&gt;~/.config/google-chrome/Profile/History&lt;/samp&gt;.
&lt;/p&gt;
&lt;p&gt;
Imagine you want to come up with a master database schema and merge together weekly history databases.
That requires some careful inspection of the database in order to find out how it keeps the data.
&lt;/p&gt;
&lt;p&gt;
So you do it and it seems that a subset of schema that &lt;samp class="inline"&gt;History&lt;/samp&gt; database is &lt;a href="https://web.archive.org/web/20200923160840/https://www.lowmanio.co.uk/blog/entries/how-google-chrome-stores-web-history"&gt;already using&lt;/a&gt; would make sense:
&lt;/p&gt;
&lt;pre class="example"&gt;TABLE   urls(
    id    INTEGER PRIMARY KEY, 
    url   STRING,
    title STRING
)
TABLE visits(
    id         INTEGER PRIMARY KEY,
    url_id     INTEGER, // foreign key referring to urls.id
    visit_time STRING
)
&lt;/pre&gt;
&lt;p&gt;
Pseudocode for your export script would look like:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-variable-name"&gt;chunk_db&lt;/span&gt; = &lt;span class="org-string"&gt;"~/.config/google-chrome/Profile/History"&lt;/span&gt;
&lt;span class="org-variable-name"&gt;master_db&lt;/span&gt;  = &lt;span class="org-string"&gt;"/exports/chrome/full_history.db"&lt;/span&gt;

&lt;span class="org-keyword"&gt;for&lt;/span&gt; row &lt;span class="org-keyword"&gt;in&lt;/span&gt; query(chunk_db, &lt;span class="org-string"&gt;'SELECT id, url, title from urls'&lt;/span&gt;):
    insert_or_ignore(master_db, &lt;span class="org-string"&gt;'urls'&lt;/span&gt;, row)

&lt;span class="org-keyword"&gt;for&lt;/span&gt; row &lt;span class="org-keyword"&gt;in&lt;/span&gt; query(chunk_db, &lt;span class="org-string"&gt;'SELECT id, url_id, visit_tile from visits'&lt;/span&gt;):
    insert_or_ignore(master_db, &lt;span class="org-string"&gt;'visits'&lt;/span&gt;, row)
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
Note: this code already smells because:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;accessing an opened (by Chrome) sqlite database would fail – you need to copy the database file first and work with a copy&lt;/li&gt;
&lt;li&gt;it's also easiest to copy to ensure transactional reads: no one guarantees you Chrome updates the database in a transaction&lt;/li&gt;
&lt;li&gt;you need a write transaction on &lt;samp class="inline"&gt;master_db&lt;/samp&gt;, otherwise, someone who reads it might see inconsistent data&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
we have to use &lt;a href="https://sqlite.org/lang_conflict.html"&gt;&lt;samp class="inline"&gt;insert_or_ignore&lt;/samp&gt;&lt;/a&gt; (instead of simple &lt;samp class="inline"&gt;insert&lt;/samp&gt;), because the chunks are overlapping on data, hence primary keys will conflict
&lt;/p&gt;
&lt;p&gt;
It's kind of an arbitrary choice; the alternative could be using &lt;samp class="inline"&gt;insert_or_update&lt;/samp&gt;. Hopefully, they should be equivalent, although it's unclear which one is morally correct. E.g. what happens if URL's &lt;samp class="inline"&gt;title&lt;/samp&gt; change? But hopefully, that doesn't matter much anyway, right?
&lt;/p&gt;
&lt;p&gt;
As we'll see this very bit will turn out to be &lt;b&gt;very problematic&lt;/b&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
But anyway, let's carry on. Fast forward few exports and merges, your full history database looks like:
&lt;/p&gt;
&lt;style&gt; #urls_old   { display: inline-block; } &lt;/style&gt;
&lt;style&gt; #visits_old { display: inline-block; } &lt;/style&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" id="urls_old" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-left"/&gt;
&lt;col class="org-left"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;url&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;title&lt;/samp&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;reddit.com&lt;/td&gt;
&lt;td class="org-left"&gt;Reddit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;200&lt;/td&gt;
&lt;td class="org-left"&gt;google.com&lt;/td&gt;
&lt;td class="org-left"&gt;Google&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" id="visits_old" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-left"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;url_id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;visit_time&lt;/samp&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;300&lt;/td&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;2011-02-10 10:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;498&lt;/td&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;2011-04-01 09:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;499&lt;/td&gt;
&lt;td class="org-right"&gt;200&lt;/td&gt;
&lt;td class="org-left"&gt;2011-04-02 05:00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
&lt;samp class="inline"&gt;visit_time&lt;/samp&gt; is in epoch microseconds in the actual chrome history database, but it's easier to illustrate with strings here.
&lt;/p&gt;
&lt;p&gt;
Note that ids don't start with 0, we had already been using Chrome for more than 90 days at the time we started exporting, so sadly some data is gone forever.
&lt;/p&gt;
&lt;p&gt;
Now, imagine you've reinstalled your operating system. 
&lt;/p&gt;
&lt;p&gt;
What happens to the Chrome databases? They reset, no one guaranteed you that ids would persist. The &lt;b&gt;table ids start all over from 0 again&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;samp class="inline"&gt;~/.config/google-chrome/Profile/History&lt;/samp&gt; now looks like:
&lt;/p&gt;
&lt;style&gt; #urls_chunk_new   { display: inline-block; } &lt;/style&gt;
&lt;style&gt; #visits_chunk_new { display: inline-block; } &lt;/style&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" id="urls_chunk_new" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-left"/&gt;
&lt;col class="org-left"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;url&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;title&lt;/samp&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;0&lt;/td&gt;
&lt;td class="org-left"&gt;wikipedia.org&lt;/td&gt;
&lt;td class="org-left"&gt;Wikipedia&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;1&lt;/td&gt;
&lt;td class="org-left"&gt;google.com&lt;/td&gt;
&lt;td class="org-left"&gt;Google&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;stackoverflow.com&lt;/td&gt;
&lt;td class="org-left"&gt;Stackoverflow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" id="visits_chunk_new" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-left"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;url_id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;visit_time&lt;/samp&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;0&lt;/td&gt;
&lt;td class="org-right"&gt;0&lt;/td&gt;
&lt;td class="org-left"&gt;2012-04-20 19:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;900&lt;/td&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;2012-06-03 12:00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
Let's see what it means for our full history database &lt;samp class="inline"&gt;/exports/chrome/full_history.db&lt;/samp&gt;. What happens after you merge the new chunk of history?
&lt;/p&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-left"/&gt;
&lt;col class="org-left"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;url&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;title&lt;/samp&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;0&lt;/td&gt;
&lt;td class="org-left"&gt;wikipedia.org&lt;/td&gt;
&lt;td class="org-left"&gt;Wikipedia&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;1&lt;/td&gt;
&lt;td class="org-left"&gt;google.com&lt;/td&gt;
&lt;td class="org-left"&gt;Google&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;reddit.com&lt;/td&gt;
&lt;td class="org-left"&gt;Reddit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;200&lt;/td&gt;
&lt;td class="org-left"&gt;google.com&lt;/td&gt;
&lt;td class="org-left"&gt;Google&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
Hmm.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;samp class="inline"&gt;google.com&lt;/samp&gt; ended up twice with different ids, but okay, why not&lt;/li&gt;
&lt;li&gt;however, the real problem is that &lt;samp class="inline"&gt;stackoverflow.com&lt;/samp&gt; is gone due to the use of &lt;samp class="inline"&gt;insert_or_ignore&lt;/samp&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
And it's actually worse. Let's look at the &lt;samp class="inline"&gt;visits&lt;/samp&gt; table in the &lt;samp class="inline"&gt;full_history.db&lt;/samp&gt;:
&lt;/p&gt;
&lt;table border="2" cellpadding="6" cellspacing="0" frame="hsides" rules="groups"&gt;
&lt;colgroup&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-right"/&gt;
&lt;col class="org-left"/&gt;
&lt;/colgroup&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-right"&gt;&lt;samp class="inline"&gt;url_id&lt;/samp&gt;&lt;/td&gt;
&lt;td class="org-left"&gt;&lt;samp class="inline"&gt;visit_time&lt;/samp&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;0&lt;/td&gt;
&lt;td class="org-right"&gt;0&lt;/td&gt;
&lt;td class="org-left"&gt;2012-04-20 19:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;300&lt;/td&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;2011-02-10 10:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;498&lt;/td&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;2011-04-01 09:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;499&lt;/td&gt;
&lt;td class="org-right"&gt;200&lt;/td&gt;
&lt;td class="org-left"&gt;2011-04-02 05:00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-right"&gt;…&lt;/td&gt;
&lt;td class="org-left"&gt;…&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="org-right"&gt;900&lt;/td&gt;
&lt;td class="org-right"&gt;100&lt;/td&gt;
&lt;td class="org-left"&gt;2012-06-03 12:00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
The visit with id 900, that should point at &lt;samp class="inline"&gt;stackoverflow.com&lt;/samp&gt;, now points at &lt;samp class="inline"&gt;google.com&lt;/samp&gt;, so we ended up with some &lt;b&gt;fake browsing history&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
How could we have avoided it? Note that using &lt;samp class="inline"&gt;insert_or_update&lt;/samp&gt; wouldn't have helped: that way we'd just overwrite history in the master database and make it inconsistent again
&lt;/p&gt;
&lt;p&gt;
Why did that happen? The schema was wrong. 
We shouldn't have relied on ids: they are kind of an artifact of the &lt;a class="link-up" href="#relational"&gt;relational model&lt;/a&gt;. One way of getting around it is &lt;a href="https://en.wikipedia.org/wiki/Unnormalized_form"&gt;"unnormalizing"&lt;/a&gt;:
&lt;/p&gt;
&lt;pre class="example"&gt;TABLE   visit_with_url(
    visit_time STRING
    url        STRING
    title      STRING
)
&lt;/pre&gt;
&lt;p&gt;
When we update the database, we use something like:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;for&lt;/span&gt; row &lt;span class="org-keyword"&gt;in&lt;/span&gt; query(chunk_db, &lt;span class="org-string"&gt;'SELECT visit_time, url, title FROM urls JOIN visits ON url.id = visits.url_id'&lt;/span&gt;):
    insert_or_ignore(master_db, row)
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
Note that by the time you do realize that and fix it, you may have already lost (and even worse, corrupted) older history.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-4"&gt;
&lt;h4 id="chrome_dal"&gt;&lt;a class="headerlink" href="#chrome_dal"&gt;¶&lt;/a&gt;An alternative&lt;/h4&gt;
&lt;div class="outline-text-4"&gt;
&lt;p&gt;
According to what I suggest:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
export script is a matter of copying &lt;samp class="inline"&gt;Profile/History&lt;/samp&gt; database along with a timestamp. E.g. if we do it weekly, we end up with:
&lt;/p&gt;
&lt;pre class="example"&gt;/exports/chrome/History-20110210.sqlite
/exports/chrome/History-20110217.sqlite
...
/exports/chrome/History-20120603.sqlite
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
to get full history, we can use the following code
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-keyword"&gt;def&lt;/span&gt; &lt;span class="org-function-name"&gt;get_history&lt;/span&gt;():
   &lt;span class="org-variable-name"&gt;handled&lt;/span&gt; = &lt;span class="org-builtin"&gt;set&lt;/span&gt;()
   &lt;span class="org-keyword"&gt;for&lt;/span&gt; db &lt;span class="org-keyword"&gt;in&lt;/span&gt; &lt;span class="org-builtin"&gt;sorted&lt;/span&gt;(Path(&lt;span class="org-string"&gt;'/exports/chrome/'&lt;/span&gt;).glob(&lt;span class="org-string"&gt;'*.sqlite'&lt;/span&gt;)):
      &lt;span class="org-keyword"&gt;for&lt;/span&gt; row &lt;span class="org-keyword"&gt;in&lt;/span&gt; query(db, &lt;span class="org-string"&gt;'SELECT visit_time, url, title FROM urls JOIN visits ON url.id = visits.url_id'&lt;/span&gt;):
          &lt;span class="org-keyword"&gt;if&lt;/span&gt; row &lt;span class="org-keyword"&gt;in&lt;/span&gt; handled:
              &lt;span class="org-keyword"&gt;continue&lt;/span&gt;
          &lt;span class="org-keyword"&gt;else&lt;/span&gt;:
              &lt;span class="org-keyword"&gt;yield&lt;/span&gt; row
              handled.insert(row)
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
That way the full data view is a runtime concept and can never corrupt anything.
&lt;/p&gt;
&lt;p&gt;
If you ever find out that there are more interesting things in your browsing history, e.g. &lt;samp class="inline"&gt;time_spent&lt;/samp&gt; column (keeps time spent on each page), it's literally just a matter of inserting &lt;samp class="inline"&gt;time_spent&lt;/samp&gt; in the query.
&lt;/p&gt;
&lt;p&gt;
Again, an obvious downside is that in runtime, it might take several minutes to assemble the full history (although that may be acceptable, depending on your usecase). And that makes sense to try and use a database for &lt;a class="link-down" href="#cachew"&gt;intermediate caching&lt;/a&gt;; just don't rely on it for primary data storage.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="cachew"&gt;&lt;a class="headerlink" href="#cachew"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;5&lt;/span&gt; Appendix: when you really really want a database&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
As I mentioned so many times, databases are actually great for caching, as they can persist data in between program's runs.  
&lt;/p&gt;
&lt;p&gt;
After noticing similar similar database access patterns used all over again, I realized that it's possible to isolate the complexity and boilerplate in a separate Python library, &lt;a href="https://github.com/karlicoss/cachew#motivation"&gt;cachew&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="cachew_cachew"&gt;&lt;a class="headerlink" href="#cachew_cachew"&gt;¶&lt;/a&gt;cachew&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
TLDR: cachew lets you &lt;b&gt;cache function calls&lt;/b&gt; into an sqlite database on
your disk in a matter of &lt;b&gt;single decorator&lt;/b&gt; (similar to
&lt;a href="https://docs.python.org/3/library/functools.html#functools.lru_cache"&gt;&lt;samp class="inline"&gt;functools.lru_cache&lt;/samp&gt;&lt;/a&gt;).
The difference from &lt;samp class="inline"&gt;functools.lru_cache&lt;/samp&gt; is that cached data is
persisted between program runs, so next time you call your function, it
will only be a matter of reading from the cache. The cache is &lt;b&gt;invalidated
automatically&lt;/b&gt; if your function's arguments change, so you don't have to
think about maintaining it.
&lt;/p&gt;
&lt;p&gt;
In order to be cacheable, your function needs to return (an
&lt;a href="https://docs.python.org/3/library/typing.html#typing.Iterator"&gt;Iterator&lt;/a&gt;,
that is generator, tuple or list) of simple data types:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;primitive types: &lt;samp class="inline"&gt;str&lt;/samp&gt; / &lt;samp class="inline"&gt;int&lt;/samp&gt; / &lt;samp class="inline"&gt;float&lt;/samp&gt; / &lt;samp class="inline"&gt;datetime&lt;/samp&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/library/typing.html#typing.NamedTuple"&gt;NamedTuples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/library/dataclasses.html"&gt;dataclasses&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
That allows to &lt;b&gt;automatically infer the schema from type hints&lt;/b&gt;
(&lt;a href="https://www.python.org/dev/peps/pep-0526"&gt;PEP 526&lt;/a&gt;) and not think
about serializing/deserializing.
&lt;/p&gt;
&lt;p&gt;
The readme also contains &lt;a href="https://github.com/karlicoss/cachew#incremental-data-exports"&gt;an example&lt;/a&gt; of using cachew for exporting temperature sensor data.
&lt;/p&gt;
&lt;p&gt;
In essence, filenames along with their modification times are used as the key for caching:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;when the exported data is updated, files and their modification times change, which makes the cache invalidate. It's it's updated automatically on the next data access&lt;/li&gt;
&lt;li&gt;in between data updates, data is read straight from the cache and  the access is pretty much instantaneous: &lt;a class="link-up" href="#performance"&gt;databases are indeed fast&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="fin"&gt;&lt;a class="headerlink" href="#fin"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;6&lt;/span&gt; --&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
The post subtitle refers to an excellent article &lt;a href="https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate"&gt;"Parse, don't validate"&lt;/a&gt;.
It's on a different topic, but in a somewhat similar spirit: making our programs more robust while writing less code.
&lt;/p&gt;
&lt;p&gt;
Happy to hear your thoughts and suggestions! Thank you for making it through this pile of text :)
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;

    &lt;/section&gt;

    
    &lt;section id="post-footer"&gt;
        &lt;div class="post-tags"&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#infra"&gt;#infra&lt;/a&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#dataliberation"&gt;#dataliberation&lt;/a&gt;
            &lt;a class="post-tag tag-inactive" href="./tags.html"&gt;#cachew&lt;/a&gt;
        &lt;/div&gt;
        &lt;time datetime="2020-01-26T00:00:00"&gt;26 January 2020&lt;/time&gt;
    &lt;/section&gt;
    

    
    &lt;section id="post-discussion"&gt;
    &lt;br/&gt;
    &lt;div&gt;Discussion:&lt;/div&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;a href="https://lobste.rs/s/vzpjfj/against_unnecessary_databases"&gt;lobsters&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    

    &lt;section id="post-comments"&gt;
    &lt;script data-isso="https://beepb00p.xyz/comments/" data-isso-reply-to-self="true" src="https://beepb00p.xyz/comments/js/embed.min.js"&gt;
&lt;/script&gt;

&lt;section data-isso-id="isso_against_db" id="isso-thread"&gt;&lt;/section&gt;
    &lt;/section&gt;
&lt;/section&gt;&lt;/article&gt;
    &lt;/main&gt;

    &lt;footer id="bottomfooter"&gt;
        &lt;a href="https://twitter.com/karlicoss"&gt;🐦 me @twitter&lt;/a&gt;
        &lt;a href="https://github.com/karlicoss"&gt;💻 me @github&lt;/a&gt;
        &lt;a href="http://creativecommons.org/licenses/by/4.0" style="margin-left:auto"&gt;CC BY 4.0&lt;/a&gt;&lt;/footer&gt;

&lt;/body&gt;&lt;/html&gt;</description>
      <guid isPermaLink="true">https://beepb00p.xyz/unnecessary-db.html</guid>
      <pubDate>Sun, 26 Jan 2020 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>In search of a better job scheduler</title>
      <link>https://beepb00p.xyz/scheduler.html</link>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang="en" prefix="og: http://ogp.me/ns#"&gt;&lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;meta content="width=device-width, initial-scale=1" name="viewport"/&gt;

    &lt;title&gt;In search of a better job scheduler | beepb00p&lt;/title&gt;
    &lt;link href="https://beepb00p.xyz/scheduler.html" rel="canonical"/&gt;
    &lt;meta content="infra" name="keywords"/&gt;
    &lt;!-- TODO concat with keywords tags; also need to make comma separated? --&gt;

    &lt;!-- can test it with https://telegram.me/webpagebot --&gt;
    &lt;!-- or https://developers.facebook.com/tools/debug --&gt;
    &lt;meta content="website" property="og:type"/&gt;
    &lt;meta content="https://beepb00p.xyz/scheduler.html" property="og:url"/&gt; &lt;!-- todo base? --&gt;
    &lt;meta content="In search of a better job scheduler | beepb00p" property="og:title"/&gt;
    &lt;meta content="What if cron and systemd had a baby? Wouldn't it be beautiful?" property="og:description"/&gt;
    &lt;!-- ugh. why is image necessary??? otherwise other parts aren't working or I get lots of 404s --&gt;
    &lt;!-- ugh. Facebook really wants jpg, but whatever --&gt;
    &lt;!-- also Facebook displays it with black background, but whatever, fuck it. --&gt;
    &lt;!-- svg does't work on  --&gt;
    &lt;meta content="https://beepb00p.xyz/assets/favicon.png" property="og:image"/&gt;

    &lt;!-- Icon made by Twitter --&gt;
    &lt;!-- https://twemoji.twitter.com/content/twemoji-twitter/en.html --&gt;
    &lt;!-- todo replace with svg favicon? most browsers support it --&gt;
    &lt;link href="./assets/favicon.png" rel="icon"/&gt;

    &lt;meta content="https://github.com/karlicoss/beepb00p" name="generator"/&gt;
    &lt;meta content="English" name="language"/&gt;

    &lt;!-- TODO get rid of google font. probably Georgia or Garamond? sadly they aren't available in Ubuntu by default.. --&gt;
    &lt;link href="https://fonts.gstatic.com" rel="preconnect"/&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&amp;amp;display=swap" rel="stylesheet"/&gt;

    &lt;link href="./assets/css/default.css" rel="stylesheet"/&gt;
    &lt;!-- TODO make conditional?? --&gt;
    &lt;link href="./assets/css/posts-list.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/links.css" rel="stylesheet"/&gt;

    &lt;!-- &lt;link rel="stylesheet" href="/assets/css/org.css" /&gt; --&gt;
    &lt;link href="./assets/css/htmlize.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-default.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-extra.css" rel="stylesheet"/&gt;
    &lt;script&gt;
    const TID = 'settings-timestamps';
function timestampsCheckbox() {
    return document.getElementById(TID)
}

window.onload = () =&gt; {
    const box = timestampsCheckbox()
    function setState(state) {
        box.checked = state
        const dd = state ? 'initial' : 'none'
        Array.from(document.querySelectorAll('.timestamp-wrapper, .property.CREATED')).map(x =&gt; {
            x.style.display = dd
        })
        localStorage.setItem(TID, JSON.stringify(state))
    }

    let state = localStorage.getItem(TID)
    if (state != null) {
        state = JSON.parse(state)
    } else {
        state = true
    }
    // todo a bit annoying that it glitches this way.. but whatever
    setState(state)
    // user click
    box.addEventListener('change', (event) =&gt; {
        setState(box.checked)
    })
}&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;!-- TODO not sure what to do on mobile devices? --&gt;
    &lt;!-- https://www.gwern.net/ --&gt;
    &lt;!-- could use position: fix so it's displayed  --&gt;
    &lt;div id="settings" style="position:fixed; top: 0; right:0; opacity: 0.3"&gt;
        &lt;!-- TODO headerlinks etc? --&gt;
        settings:
        &lt;div&gt;show timestamps&lt;input id="settings-timestamps" type="checkbox"/&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;nav id="topnav"&gt;
        &lt;a href="./"&gt;Home&lt;/a&gt;
        &lt;a href="./ideas.html"&gt;Ideas&lt;/a&gt;
        &lt;a href="./exobrain"&gt;Exobrain&lt;/a&gt;
        &lt;a href="./tags.html"&gt;Tags&lt;/a&gt;

        &lt;a href="./feed.html" style="margin-left:auto"&gt;Feed&lt;/a&gt;
        &lt;!-- margin-left aligns the rest to the right in flex layout --&gt;
        &lt;a href="./site.html"&gt;Site&lt;/a&gt;
        &lt;a href="./me.html"&gt;Me&lt;/a&gt;

        &lt;span style="font-size: 0.4em;"&gt;
            &lt;a href="https://twitter.com/karlicoss" style="display:block;"&gt;@twitter&lt;/a&gt;
            &lt;a href="https://github.com/karlicoss" style="display:block;"&gt;@github&lt;/a&gt;
        &lt;/span&gt;
    &lt;/nav&gt;

    &lt;!-- main contains the stuff which is not repeated across the site --&gt;
    &lt;main&gt;
        &lt;article&gt;
    
    &lt;section id="post-title"&gt;
    &lt;h1&gt;
        In search of a better job scheduler
        &lt;a href="./blog-graph.html#scheduler" style="font-size: 1rem;vertical-align: super;" title="See this post within the blog graph, and how it's connected to other posts"&gt;[see within blog graph]&lt;/a&gt;
    &lt;/h1&gt;
    &lt;div class="summary"&gt;What if cron and systemd had a baby? Wouldn't it be beautiful?
    &lt;/div&gt;&lt;/section&gt;
    &lt;!-- are sections appropriate for that? --&gt;

    &lt;section id="post-content"&gt;
    &lt;p&gt;
To support my &lt;a href="./tags.html#infra"&gt;personal infrastructure&lt;/a&gt;, I need a fair amount of regular automatic jobs:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;for exporting &lt;a href="my-data.html"&gt;my personal data&lt;/a&gt; from the cloud&lt;/li&gt;
&lt;li&gt;for generating &lt;a href="orger.html"&gt;plaintext&lt;/a&gt; views of my digital trace&lt;/li&gt;
&lt;li&gt;for updating my &lt;a href="orger-todos.html"&gt;todo lists&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;updating &lt;a href="https://github.com/karlicoss/promnesia#demo"&gt;promnesia&lt;/a&gt; index&lt;/li&gt;
&lt;li&gt;lots of other backups and supplementary scripts&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Running all that manually (more than 100 scripts across all devices) is an awful job for a human.
I want to set them up once and more or less forget about it, only checking now and then.
&lt;/p&gt;
&lt;p&gt;
In addition, I am trying to share my knowledge with other people, and it turns out not many people (even programmers, let alone less technical people) are using scheduling software in a personal capacity. So in this post I'll be speculating why it's hard and how to make it easier.
&lt;/p&gt;
&lt;p&gt;
I'll be considering pros and cons of job scheduling software mostly with the &lt;b&gt;emphasis on the personal infrastructure&lt;/b&gt;. 
I'm sure there will be some aspects I'm missing out on, more specific to industrial-scale job management.
&lt;/p&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#cron"&gt;1. cron&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#systemd"&gt;2. systemd / launchd&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#what_do_i_want"&gt;3. What do I need?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#other"&gt;4. Alternative schedulers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#solution"&gt;5. Solution?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#dron"&gt;dron&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#phone"&gt;6. Phone jobs?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#android_cron"&gt;cron?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#fin"&gt;7. --&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="cron"&gt;&lt;a class="headerlink" href="#cron"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; &lt;a href="https://en.wikipedia.org/wiki/Cron"&gt;cron&lt;/a&gt;&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;b&gt;Pros&lt;/b&gt;:  
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;once you get used to the cron scheduling syntax, it's very easy to actually add new jobs.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
easy to adjust
&lt;/p&gt;
&lt;p&gt;
You just type &lt;code class="inline"&gt;crontab -e&lt;/code&gt;, and you can insert/delete/comment jobs, overview when they are running, and space them out in time if necessary.
Once you saved the crontab and exited, it's applied immediately
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
even though systemd is present in most desktop Linux/Mac distributions, cron will &lt;b&gt;definitely&lt;/b&gt; be there
&lt;/p&gt;
&lt;p&gt;
This probably doesn't matter if you're using a general purpose Linux distribution.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;Cons&lt;/b&gt;: anything else you can think of is extremely tedious and repetitive to achieve in cron.
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
no periodic (i.e. 'once a day' scheduling), only supports specific time
&lt;/p&gt;
&lt;p&gt;
This is annoying when if you don't keep your computer always on.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;no job dependencies&lt;/li&gt;
&lt;li&gt;no timeouts and generally no means of resource management&lt;/li&gt;
&lt;li&gt;no restart policies&lt;/li&gt;
&lt;li&gt;no means of failure notifications apart from local email&lt;/li&gt;
&lt;li&gt;logs go to local mail by default and there are no other mechanisms of failure notification&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://habilis.net/cronic/#disease"&gt;some really bad defaults&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Fun fact: cron only emails you if the job has produced output. If your job failed with nonzero exit code, but produced no output you'd never find out. 
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Cron has some variations that help with some of these problems:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Anacron"&gt;anacron&lt;/a&gt; – allows running commands periodically (e.g. weekly), which helps if your computer is sometimes offline; but it can't run more frequently than once a day&lt;/li&gt;
&lt;li&gt;&lt;a id="fcron"&gt;&lt;/a&gt;&lt;a href="https://wiki.archlinux.org/index.php/cron#Fcron"&gt;fcron&lt;/a&gt;, which I'm &lt;b&gt;using at the moment&lt;/b&gt;. Pretty decent:

&lt;ul class="org-ul"&gt;
&lt;li&gt;unlike anacron, fully compatible with regular cron jobs and allows running periodically as well&lt;/li&gt;
&lt;li&gt;got lots of cool &lt;a href="http://fcron.free.fr/doc/en/fcrontab.5.html"&gt;options&lt;/a&gt;, e.g.:

&lt;ul class="org-ul"&gt;
&lt;li&gt;setting &lt;a href="http://fcron.free.fr/doc/en/fcrontab.5.html#FCRONTAB.5.NICE"&gt;&lt;code class="inline"&gt;nice&lt;/code&gt;&lt;/a&gt; value&lt;/li&gt;
&lt;li&gt;&lt;a href="http://fcron.free.fr/doc/en/fcrontab.5.html#FCRONTAB.5.LAVG"&gt;&lt;code class="inline"&gt;lavg&lt;/code&gt;&lt;/a&gt;: conditional running depending on load balancing&lt;/li&gt;
&lt;li&gt;&lt;a href="http://fcron.free.fr/doc/en/fcrontab.5.html#FCRONTAB.5.JITTER"&gt;&lt;code class="inline"&gt;jitter&lt;/code&gt;&lt;/a&gt;, &lt;a href="http://fcron.free.fr/doc/en/fcrontab.5.html#FCRONTAB.5.RANDOM"&gt;&lt;code class="inline"&gt;random&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://fcron.free.fr/doc/en/fcrontab.5.html#FCRONTAB.5.SERIAL"&gt;&lt;code class="inline"&gt;serial&lt;/code&gt;&lt;/a&gt; as a primitive way of specifying dependencies&lt;/li&gt;
&lt;li&gt;&lt;a href="http://fcron.free.fr/doc/en/fcrontab.5.html#FCRONTAB.5.EXESEV"&gt;&lt;code class="inline"&gt;exesev&lt;/code&gt;&lt;/a&gt; to prevent multiple instances of the same job (although it doesn't treat it as error)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="systemd"&gt;&lt;a class="headerlink" href="#systemd"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; &lt;a href="https://en.wikipedia.org/wiki/Systemd"&gt;systemd&lt;/a&gt; / &lt;a href="https://en.wikipedia.org/wiki/Launchd"&gt;launchd&lt;/a&gt;&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Disclaimer: I'm not very familiar with Mac OS, but as far as I understand, launchd is very similar to systemd.
&lt;/p&gt;
&lt;p&gt;
Systemd is very powerful and flexible, supports timers, dependencies, restart policies, monitoring, logging, etc.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Pros&lt;/b&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;timers&lt;/li&gt;
&lt;li&gt;dependencies&lt;/li&gt;
&lt;li&gt;resource policies (restricting memory and CPU, timeouts)&lt;/li&gt;
&lt;li&gt;restart policies (although &lt;a href="https://github.com/systemd/systemd/issues/6129"&gt;no exponential backoff&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
shared &lt;a href="https://www.freedesktop.org/software/systemd/man/systemd.exec.html#EnvironmentFile"&gt;environments&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
It can be particularly helpful if a set of scripts shares certain libraries (e.g. &lt;samp class="inline"&gt;PYTHONPATH&lt;/samp&gt;) or data.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;tooling and monitoring&lt;/li&gt;
&lt;li&gt;logging&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;Cons&lt;/b&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
tedious to add new jobs
&lt;/p&gt;
&lt;p&gt;
If you want to add a job, you need to:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
write a unit file
&lt;/p&gt;
&lt;p&gt;
Most of it is boilerplate, so good luck getting the syntax right.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;copy it to &lt;samp class="inline"&gt;~/.config/systemd/user&lt;/samp&gt;&lt;/li&gt;
&lt;li&gt;remember to enable the service&lt;/li&gt;
&lt;li&gt;remember to run &lt;code class="inline"&gt;systemctl --user reload-daemon&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
That's a &lt;b&gt;massive overhead&lt;/b&gt; in comparison with &lt;code class="inline"&gt;crontab -e&lt;/code&gt;, edit, save.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;b&gt;units are scattered&lt;/b&gt; across &lt;samp class="inline"&gt;~/.config/systemd/user&lt;/samp&gt;
&lt;/p&gt;
&lt;p&gt;
In cron if I have some boilerplate shared across several jobs (e.g. prefixed with &lt;samp class="inline"&gt;nice&lt;/samp&gt; or &lt;samp class="inline"&gt;timeout&lt;/samp&gt;), or multiple
very similar commands, I can align/tabulate them with spaces and use block editing in vim to add/remove/change it all at once, so if you keep the crontab tidy, there is little opportunity for error.
&lt;/p&gt;
&lt;p&gt;
In systemd I'd have two options:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;edit each unit file separately: boring and error-prone&lt;/li&gt;
&lt;li&gt;use a script to generate boilerplate for unit files and manage them&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;error notifications (even mailing) requires some &lt;a href="https://wiki.archlinux.org/index.php/Systemd/Timers#MAILTO"&gt;hacking&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Systemd feels like something desirable when scheduling services is your full time job, but not for personal scripts when everything is a bit more chaotic.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="what_do_i_want"&gt;&lt;a class="headerlink" href="#what_do_i_want"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; What do I need?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
I feel a serious lack of user-friendly job scheduling software for &lt;b&gt;personal&lt;/b&gt; needs. I want it to be:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
&lt;b&gt;possible for regular people&lt;/b&gt; to use
&lt;/p&gt;
&lt;p&gt;
"Regular" has different meaning for different people, so imagine someone starting to learn to program. They are capable of writing and running scripts, committing and pushing to git, etc. Imagine they want to run their script periodically:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
with &lt;a class="link-up" href="#cron"&gt;cron&lt;/a&gt;: I'd say the difficulty for them is somewhere around 5/10
&lt;/p&gt;
&lt;p&gt;
They need to run &lt;samp class="inline"&gt;crontab -e&lt;/samp&gt;, google the syntax, paste the path to their script, save and exit. That's it.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
with &lt;a class="link-up" href="#systemd"&gt;systemd&lt;/a&gt;: I'd say the difficulty is 9/10
&lt;/p&gt;
&lt;p&gt;
Several steps, confusing syntax and boilerplate, multiple different commands. It's not trivial even for experienced programmers.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In addition, both of these would behave in confusing ways with respect to environment, error reporting, and logging.
&lt;/p&gt;
&lt;p&gt;
It's understandable why these systems are so complex (they are very powerful and flexible!), but it's not impossible to have an alternative and user-friendlier interface for simple (cron-like) usecases.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
as &lt;b&gt;easy to configure&lt;/b&gt; as regular cron
&lt;/p&gt;
&lt;p&gt;
So you can edit the single plaintext configuration file, quickly adjust the jobs, check and apply configuration immediately.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;b&gt;better specs&lt;/b&gt; for jobs
&lt;/p&gt;
&lt;p&gt;
dependencies, timeouts, resource policies and retries without hacky wrappers and boilerplate
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
keeping configuration under &lt;b&gt;version control&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
This is easy with systemd, and also possible with cron (with some extra hacks).
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
better means of &lt;b&gt;monitoring&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
How often are the jobs running? Which ones are most flaky? How much resources are they using? 
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
simple way of running in &lt;b&gt;user's environment&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
It's understandable that cron/systemd shell environment is kept minimal, but for personal scripts, you want the same environment as in your interactive shell.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
means of &lt;b&gt;logging&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
E.g. easy logging to the filesystem for later inspection.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
means of &lt;b&gt;notification&lt;/b&gt;
&lt;/p&gt;
&lt;p&gt;
E.g. alternative ways of failure notification (e.g. sending desktop/phone notification).
&lt;/p&gt;
&lt;p&gt;
Currently, I'm using &lt;a href="https://wiki.archlinux.org/index.php/Mutt"&gt;mutt&lt;/a&gt; for that which is fine, but TODO
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="other"&gt;&lt;a class="headerlink" href="#other"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; Alternative schedulers&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Some of the tools I tried, none of which really satisfied me:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="https://github.com/mesos/chronos"&gt;mesos/chronos&lt;/a&gt;: too heavyweight to use personally&lt;/li&gt;
&lt;li&gt;&lt;a href="https://habilis.net/cronic"&gt;cronic&lt;/a&gt;: simple wrapper that helps with emailing on non-zero exit code, but not much else.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://github.com/instacart/ohmycron"&gt;instacart/ohmycron&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Supports locks to prevent simultaneous jobs, loads user environment and PATH.
&lt;/p&gt;
&lt;p&gt;
The interesting idea is setting it as a &lt;a href="https://github.com/instacart/ohmycron#ohmycron-as-the-cron-shell"&gt;cron shell&lt;/a&gt;, which can enhance cron syntax.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a id="huginn"&gt;&lt;/a&gt;&lt;a href="https://github.com/huginn/huginn"&gt;huginn&lt;/a&gt;: great example of a &lt;b&gt;user-friendly&lt;/b&gt; tool
&lt;/p&gt;
&lt;p&gt;
One thing that makes it different is that it's reactive and mainly event/data driven, so dependencies are first class citizens to the workflow.
There are multiple ways of inspecting jobs, e.g. list with some stats on events and dependency diagram. I highly recommend checking out &lt;a href="https://github.com/huginn/huginn#examples"&gt;example&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
It seems good for simple pipelines (e.g. scrape something/transform/send Telegram notification), but you're gonna need a real programming language to do something more complicated. It's possible to run &lt;a href="https://huginnio.herokuapp.com/agents#ShellCommandAgent"&gt;shell commands&lt;/a&gt; and &lt;a href="https://github.com/huginn/huginn/wiki/Creating-a-new-agent"&gt;write external agents&lt;/a&gt;, but the primary interface for editing is GUI. That makes it not very programmer friendly, and in addition it suffers from the same issues as &lt;a class="link-up" href="#systemd"&gt;systemd&lt;/a&gt; in that aspect (e.g. no bulk edit for jobs).
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
&lt;a href="https://dshearer.github.io/jobber/doc/v1.4/#jobfile"&gt;jobber&lt;/a&gt;: looks the most promising so far
&lt;/p&gt;
&lt;p&gt;
Supported:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;plaintext configuration (yaml)&lt;/li&gt;
&lt;li&gt;job execution history&lt;/li&gt;
&lt;li&gt;quickly testing jobs&lt;/li&gt;
&lt;li&gt;pausing/resuming jobs&lt;/li&gt;
&lt;li&gt;success/failure notifications&lt;/li&gt;
&lt;li&gt;backoffs (although they weren't configurable last time I checked)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
However, still no timeouts, dependencies, and jobs can only run at the schedule, like &lt;a class="link-up" href="#cron"&gt;cron&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;b&gt;&lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2020-01-26]&lt;/span&gt;&lt;/span&gt;&lt;/b&gt; Thanks to everyone who suggested alternatives in the comments and linked discussions!
&lt;/p&gt;
&lt;p&gt;
Sadly, most of them are pretty heavy: often distributed, aiming at orchestrating clusters and grids, which is quite an overkill for my humble personal needs.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="solution"&gt;&lt;a class="headerlink" href="#solution"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;5&lt;/span&gt; Solution?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
&lt;a class="link-up" href="#systemd"&gt;Systemd&lt;/a&gt; feels almost perfect except for its boilerplate and being somewhat user-unfriendly.
&lt;/p&gt;
&lt;p&gt;
What if we took the good bit that cron has (easy means of editing jobs), and tried to do the same within systemd?
&lt;/p&gt;
&lt;p&gt;
Imagine a frontend (let's name it &lt;code class="inline"&gt;systemdtab&lt;/code&gt;), that gave something similar to cron experience:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
you type &lt;code class="inline"&gt;systemdtab -e&lt;/code&gt;, and that opens the text editor with your configuration
&lt;/p&gt;
&lt;p&gt;
You can adjust your jobs as you wish, save the file and exit. It can check syntax the same way &lt;code class="inline"&gt;crontab -e&lt;/code&gt; checks it, and prompt to retry in case of typos.
&lt;/p&gt;
&lt;p&gt;
Once you exit, your changes are applied automatically: 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;samp class="inline"&gt;systemdtab&lt;/samp&gt; generates individual unit files from your output&lt;/li&gt;
&lt;li&gt;replaces the old unit files with the new ones and restarts the daemon&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
considering the boilerplate, it seems that the systemdtab config could be a script (e.g. &lt;samp class="inline"&gt;~/.systemdtab.py&lt;/samp&gt;), that generates the actual Systemd unit files
&lt;/p&gt;
&lt;p&gt;
It doesn't matter which language is used, it could be bash, python or anything. It would allow one to massively save on boilerplate if you're running sets of similar jobs.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;the configuration is kept in a plaintext file, which makes it trivial to inspect and version control.&lt;/li&gt;
&lt;li&gt;some means of simple visualization and monitoring, e.g. similar to &lt;a class="link-up" href="#huginn"&gt;huginn&lt;/a&gt;?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
This doesn't have to be a replacement or something, &lt;samp class="inline"&gt;systemdtab&lt;/samp&gt; can manage its own set of unit files, completely separate from the rest of the services.
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:darkorange"&gt;&lt;strong&gt;Does such a tool exist?&lt;/strong&gt;&lt;/span&gt; It feels like it's possible to hack together a rough implementation (at least satisfying to me) fairly quickly, but is there really nothing existing? Please let me know!
&lt;/p&gt;
&lt;p&gt;
One tool in a similar spirit is &lt;a href="https://github.com/systemd-cron/systemd-cron"&gt;systemd-cron/systemd-cron&lt;/a&gt;, but it simply maps existing cron job specs into systemd jobs. This seems very useful if you're trying to transition, but doesn't help with my &lt;a class="link-up" href="#what_do_i_want"&gt;needs&lt;/a&gt;..
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="dron"&gt;&lt;a class="headerlink" href="#dron"&gt;¶&lt;/a&gt;dron&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2020-01-26]&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
After writing this post, I realized that even if there are no existing tools, the shortcomings of systemd might be fairly easy to overcome. So I hacked together &lt;a href="https://github.com/karlicoss/dron"&gt;dron&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="phone"&gt;&lt;a class="headerlink" href="#phone"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;6&lt;/span&gt; Phone jobs?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
That's another problem I sort of solved for myself, but not fully satisfied.
&lt;/p&gt;
&lt;p&gt;
I need to export app data regularly from my (rooted) Android phone (e.g. see &lt;a href="my-data.html#bluemaestro"&gt;here&lt;/a&gt;). Export scripts themselves are trivial, it's just a matter of copying files from &lt;samp class="inline"&gt;/data/data/&lt;/samp&gt; directory. However, there is no software for Android to run these scripts regularly.
&lt;/p&gt;
&lt;p&gt;
At the moment, I'm using &lt;a href="https://llamalab.com/automate"&gt;Automate app&lt;/a&gt; to run them. Automate is great, but it feels a bit wrong running a shell script using a complex flowchart, so I'd be interested to know if there are simpler alternatives.
&lt;/p&gt;
&lt;p&gt;
Ideally, it would be a simple app that allows running shell scripts at regular intervals, keeping logs and notifying when they fail. 
&lt;/p&gt;
&lt;p&gt;
&lt;span style="color:darkorange"&gt;&lt;strong&gt;Is there such an app?&lt;/strong&gt;&lt;/span&gt; Please let me know if you know one!
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="android_cron"&gt;&lt;a class="headerlink" href="#android_cron"&gt;¶&lt;/a&gt;cron?&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Thanks to a commenter who &lt;a href="https://beepb00p.xyz/scheduler.html#isso-103"&gt;suggested&lt;/a&gt; that &lt;a href="https://play.google.com/store/apps/details?id=com.termux"&gt;Termux&lt;/a&gt; got cron daemon. I tried it out, and it works!
&lt;/p&gt;
&lt;p&gt;
The downsides are:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
something still needs to run cron daemon at startup
&lt;/p&gt;
&lt;p&gt;
On Linux, this is achieved by the init system, but it turns out &lt;a href="https://android.stackexchange.com/questions/6558/how-can-i-run-a-script-on-boot"&gt;a bit tricky&lt;/a&gt; to use even on rooted phone.
&lt;/p&gt;
&lt;p&gt;
So I'm just starting it on boot via Automate app at the moment.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;would be nice to have a GUI based tool as it's not very convenient to edit shell scripts on Android (I just used interactive &lt;a href="https://developer.android.com/studio/command-line/adb"&gt;adb shell&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;I'm not sure how it behaves with respect to the power saving mode, etc. Ideally you'd want it to integrate with &lt;a href="https://developer.android.com/reference/android/app/job/JobScheduler"&gt;JobScheduler&lt;/a&gt; Android APIs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="fin"&gt;&lt;a class="headerlink" href="#fin"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;7&lt;/span&gt; --&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Updates:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2020-01-19]&lt;/span&gt;&lt;/span&gt; added section on &lt;a class="link-up" href="#huginn"&gt;huginn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2020-01-26]&lt;/span&gt;&lt;/span&gt; added sections: &lt;a class="link-up" href="#dron"&gt;dron&lt;/a&gt; and &lt;a class="link-up" href="#android_cron"&gt;using cron on Android&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

    &lt;/section&gt;

    
    &lt;section id="post-footer"&gt;
        &lt;div class="post-tags"&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#infra"&gt;#infra&lt;/a&gt;
        &lt;/div&gt;
        &lt;time datetime="2020-01-18T00:00:00"&gt;18 January 2020&lt;/time&gt;
    &lt;/section&gt;
    

    

    &lt;section id="post-comments"&gt;
    &lt;script data-isso="https://beepb00p.xyz/comments/" data-isso-reply-to-self="true" src="https://beepb00p.xyz/comments/js/embed.min.js"&gt;
&lt;/script&gt;

&lt;section data-isso-id="isso_scheduler" id="isso-thread"&gt;&lt;/section&gt;
    &lt;/section&gt;
&lt;/article&gt;
    &lt;/main&gt;

    &lt;footer id="bottomfooter"&gt;
        &lt;a href="https://twitter.com/karlicoss"&gt;🐦 me @twitter&lt;/a&gt;
        &lt;a href="https://github.com/karlicoss"&gt;💻 me @github&lt;/a&gt;
        &lt;a href="http://creativecommons.org/licenses/by/4.0" style="margin-left:auto"&gt;CC BY 4.0&lt;/a&gt;&lt;/footer&gt;

&lt;/body&gt;&lt;/html&gt;</description>
      <guid isPermaLink="true">https://beepb00p.xyz/scheduler.html</guid>
      <pubDate>Sat, 18 Jan 2020 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>What data on myself I collect and why?</title>
      <link>https://beepb00p.xyz/my-data.html</link>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang="en" prefix="og: http://ogp.me/ns#"&gt;&lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;meta content="width=device-width, initial-scale=1" name="viewport"/&gt;

    &lt;title&gt;What data on myself I collect and why? | beepb00p&lt;/title&gt;
    &lt;link href="https://beepb00p.xyz/my-data.html" rel="canonical"/&gt;
    &lt;meta content="dataliberation pkm quantifiedself" name="keywords"/&gt;
    &lt;!-- TODO concat with keywords tags; also need to make comma separated? --&gt;

    &lt;!-- can test it with https://telegram.me/webpagebot --&gt;
    &lt;!-- or https://developers.facebook.com/tools/debug --&gt;
    &lt;meta content="website" property="og:type"/&gt;
    &lt;meta content="https://beepb00p.xyz/my-data.html" property="og:url"/&gt; &lt;!-- todo base? --&gt;
    &lt;meta content="What data on myself I collect and why? | beepb00p" property="og:title"/&gt;
    &lt;meta content="How I am using 50+ sources of my personal data" property="og:description"/&gt;
    &lt;!-- ugh. why is image necessary??? otherwise other parts aren't working or I get lots of 404s --&gt;
    &lt;!-- ugh. Facebook really wants jpg, but whatever --&gt;
    &lt;!-- also Facebook displays it with black background, but whatever, fuck it. --&gt;
    &lt;!-- svg does't work on  --&gt;
    &lt;meta content="https://beepb00p.xyz/assets/favicon.png" property="og:image"/&gt;

    &lt;!-- Icon made by Twitter --&gt;
    &lt;!-- https://twemoji.twitter.com/content/twemoji-twitter/en.html --&gt;
    &lt;!-- todo replace with svg favicon? most browsers support it --&gt;
    &lt;link href="./assets/favicon.png" rel="icon"/&gt;

    &lt;meta content="https://github.com/karlicoss/beepb00p" name="generator"/&gt;
    &lt;meta content="English" name="language"/&gt;

    &lt;!-- TODO get rid of google font. probably Georgia or Garamond? sadly they aren't available in Ubuntu by default.. --&gt;
    &lt;link href="https://fonts.gstatic.com" rel="preconnect"/&gt;
    &lt;link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro&amp;amp;display=swap" rel="stylesheet"/&gt;

    &lt;link href="./assets/css/default.css" rel="stylesheet"/&gt;
    &lt;!-- TODO make conditional?? --&gt;
    &lt;link href="./assets/css/posts-list.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/links.css" rel="stylesheet"/&gt;

    &lt;!-- &lt;link rel="stylesheet" href="/assets/css/org.css" /&gt; --&gt;
    &lt;link href="./assets/css/htmlize.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-default.css" rel="stylesheet"/&gt;
    &lt;link href="./assets/css/org-extra.css" rel="stylesheet"/&gt;
    &lt;script&gt;
    const TID = 'settings-timestamps';
function timestampsCheckbox() {
    return document.getElementById(TID)
}

window.onload = () =&gt; {
    const box = timestampsCheckbox()
    function setState(state) {
        box.checked = state
        const dd = state ? 'initial' : 'none'
        Array.from(document.querySelectorAll('.timestamp-wrapper, .property.CREATED')).map(x =&gt; {
            x.style.display = dd
        })
        localStorage.setItem(TID, JSON.stringify(state))
    }

    let state = localStorage.getItem(TID)
    if (state != null) {
        state = JSON.parse(state)
    } else {
        state = true
    }
    // todo a bit annoying that it glitches this way.. but whatever
    setState(state)
    // user click
    box.addEventListener('change', (event) =&gt; {
        setState(box.checked)
    })
}&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;!-- TODO not sure what to do on mobile devices? --&gt;
    &lt;!-- https://www.gwern.net/ --&gt;
    &lt;!-- could use position: fix so it's displayed  --&gt;
    &lt;div id="settings" style="position:fixed; top: 0; right:0; opacity: 0.3"&gt;
        &lt;!-- TODO headerlinks etc? --&gt;
        settings:
        &lt;div&gt;show timestamps&lt;input id="settings-timestamps" type="checkbox"/&gt;&lt;/div&gt;
    &lt;/div&gt;

    &lt;nav id="topnav"&gt;
        &lt;a href="./"&gt;Home&lt;/a&gt;
        &lt;a href="./ideas.html"&gt;Ideas&lt;/a&gt;
        &lt;a href="./exobrain"&gt;Exobrain&lt;/a&gt;
        &lt;a href="./tags.html"&gt;Tags&lt;/a&gt;

        &lt;a href="./feed.html" style="margin-left:auto"&gt;Feed&lt;/a&gt;
        &lt;!-- margin-left aligns the rest to the right in flex layout --&gt;
        &lt;a href="./site.html"&gt;Site&lt;/a&gt;
        &lt;a href="./me.html"&gt;Me&lt;/a&gt;

        &lt;span style="font-size: 0.4em;"&gt;
            &lt;a href="https://twitter.com/karlicoss" style="display:block;"&gt;@twitter&lt;/a&gt;
            &lt;a href="https://github.com/karlicoss" style="display:block;"&gt;@github&lt;/a&gt;
        &lt;/span&gt;
    &lt;/nav&gt;

    &lt;!-- main contains the stuff which is not repeated across the site --&gt;
    &lt;main&gt;
        &lt;article&gt;
    
    &lt;section id="post-title"&gt;
    &lt;h1&gt;
        What data on myself I collect and why?
        &lt;a href="./blog-graph.html#my_data" style="font-size: 1rem;vertical-align: super;" title="See this post within the blog graph, and how it's connected to other posts"&gt;[see within blog graph]&lt;/a&gt;
    &lt;/h1&gt;
    &lt;div class="summary"&gt;How I am using 50+ sources of my personal data
    &lt;/div&gt;&lt;/section&gt;
    &lt;!-- are sections appropriate for that? --&gt;

    &lt;section id="post-content"&gt;
    &lt;p&gt;
This is the list of personal data sources I use or planning to use with rough guides on how to get your hands on that data if you want it as well.
It's still incomplete and I'm going to update it regularly.
&lt;/p&gt;
&lt;p&gt;
My goal is collecting almost all of my digital trace, &lt;b&gt;automating data collection to the maximum extent possible&lt;/b&gt; and making it work in the background, so one can set up pipelines once and hopefully never think about it again.
&lt;/p&gt;
&lt;p&gt;
This is kind of a follow-up on my previous post on the &lt;a href="sad-infra.html"&gt;sad state of personal data&lt;/a&gt;, and part of my personal way of getting around this sad state.
&lt;/p&gt;
&lt;p&gt;
If you're terrified by the long list, you can jump straight into &lt;a class="link-down" href="#consumers"&gt;"Data consumers"&lt;/a&gt; section to find out how I use it.
In addition, check out &lt;a href="myinfra.html"&gt;my infrastructure map&lt;/a&gt;, which might explain it better!
&lt;/p&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#why"&gt;1. Why do you collect X? How do you use your data?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#backup"&gt;backup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#lifelogging"&gt;lifelogging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#qs"&gt;quantified self&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#what"&gt;2. What do I collect/want to collect?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#amazon"&gt;Amazon&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#arbtt"&gt;Arbtt (desktop time tracker)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#bitbucket"&gt;Bitbucket (repositories)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#bluemaestro"&gt;Bluemaestro (environment sensor)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#blood"&gt;Blood&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#browser_history"&gt;Browser history (Firefox/Chrome)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#emfit"&gt;Emfit QS (sleep tracker)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#endomondo"&gt;Endomondo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#facebook"&gt;Facebook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#messenger"&gt;Facebook Messenger&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#feedbin"&gt;Feedbin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#feedly"&gt;Feedly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#fitbit"&gt;Fitbit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#foursquare"&gt;Foursquare/Swarm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#github_repos"&gt;Github (repositories)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#github_events"&gt;Github (events)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#gmail"&gt;Gmail&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#goodreads"&gt;Goodreads&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#takeout"&gt;Google takeout&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#hackernews"&gt;&lt;span class="todo STRT"&gt;STRT&lt;/span&gt;Hackernews&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#hsbc"&gt;HSBC bank&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#hypothesis"&gt;Hypothesis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#instapaper"&gt;Instapaper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#jawbone"&gt;Jawbone&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#kindle"&gt;Kindle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#kobo"&gt;Kobo reader&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#lastfm"&gt;Last.fm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#monzo"&gt;Monzo bank&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#nomie"&gt;Nomie&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#nutrition"&gt;Nutrition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#photos"&gt;Photos&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#pdfs"&gt;PDF annotations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#pinboard"&gt;Pinboard&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#notes"&gt;Plaintext notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#pocket"&gt;Pocket&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#reddit"&gt;Reddit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#rtm"&gt;Remember the Milk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#rescuetime"&gt;Rescuetime&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#shell"&gt;Shell history&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sleep"&gt;Sleep&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sms_calls"&gt;Sms/calls&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#spotify"&gt;Spotify&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#stackexchange"&gt;Stackexchange&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#taplog"&gt;Taplog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#telegram"&gt;Telegram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#twitter"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#vk"&gt;VK.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#weight"&gt;Weight&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#whatsapp"&gt;&lt;span class="todo TODO"&gt;TODO&lt;/span&gt;Whatsapp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#23andme"&gt;23andme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#consumers"&gt;3. Data consumers&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#search"&gt;Instant search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#orger"&gt;orger&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#promnesia"&gt;promnesia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#timeline"&gt;timeline&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#mypkg"&gt;&lt;code class="inline"&gt;HPI&lt;/code&gt; python package&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#fin"&gt;4. --&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="why"&gt;&lt;a class="headerlink" href="#why"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; Why do you collect X? How do you use your data?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
All things considered, I think it's a fair question!
Why bother with all this &lt;a href="./tags.html#infra"&gt;infrastructure&lt;/a&gt; and hoard the data if you never use it?
&lt;/p&gt;
&lt;p&gt;
In the next section, I will elaborate on each specific data source, but to start with I'll list the rationales that all of them share:
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="backup"&gt;&lt;a class="headerlink" href="#backup"&gt;¶&lt;/a&gt;backup&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
It may feel unnecessary, but shit happens. What if your device dies, account gets suspended for some reason or the company goes bust?
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="lifelogging"&gt;&lt;a class="headerlink" href="#lifelogging"&gt;¶&lt;/a&gt;&lt;a href="./tags.html#lifelogging"&gt;lifelogging&lt;/a&gt;&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Most data in digital form got timestamps, so automatically, without manual effort, constitutes data for your timeline.
&lt;/p&gt;
&lt;p&gt;
I want to remember more, be able to review my past and bring back and reflect on memories. Practicing lifelogging helps with that.
&lt;/p&gt;
&lt;p&gt;
It feels very wrong that things can be forgotten and lost forever.
It's understandable from the neuroscience point of view, i.e. the brain has limited capacity and it would be too distracting to remember everything all the time.
That said, I want to have a &lt;b&gt;choice&lt;/b&gt; whether to forget or remember events, and I'd like to be able to potentially access forgotten ones.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="qs"&gt;&lt;a class="headerlink" href="#qs"&gt;¶&lt;/a&gt;&lt;a href="./tags.html#quantifiedself"&gt;quantified self&lt;/a&gt;&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Most collected digital data is somewhat quantitative and can be used to analyze your body or mind.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="what"&gt;&lt;a class="headerlink" href="#what"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; What do I collect/want to collect?&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
As I mentioned, most of the collected data serve as a means of backup/lifelogging/quantified self, so I won't mention them again in the 'Why' sections.
&lt;/p&gt;
&lt;p&gt;
All my data collection pipelines are &lt;b&gt;automatic unless mentioned otherwise&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;
Some scripts are still private so if you want to know more, let me know so I can prioritize sharing them.
&lt;/p&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="amazon"&gt;&lt;a class="headerlink" href="#amazon"&gt;¶&lt;/a&gt;Amazon&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/jbms/finance-dl"&gt;jbms/finance-dl&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;was planning to correlate them with &lt;a class="link-down" href="#monzo"&gt;monzo&lt;/a&gt;/&lt;a class="link-down" href="#hsbc"&gt;HSBC&lt;/a&gt; transactions, but haven't got to it yet&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="arbtt"&gt;&lt;a class="headerlink" href="#arbtt"&gt;¶&lt;/a&gt;Arbtt (desktop time tracker)&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://arbtt.nomeata.de"&gt;arbtt-capture&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;haven't used it yet, but it could be a rich source of lifelogging context&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="bitbucket"&gt;&lt;a class="headerlink" href="#bitbucket"&gt;¶&lt;/a&gt;Bitbucket (repositories)&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/samkuehn/bitbucket-backup"&gt;samkuehn/bitbucket-backup&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why: 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
proved especially useful considering Atlassian is going to &lt;a href="https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket"&gt;&lt;b&gt;wipe&lt;/b&gt;&lt;/a&gt; mercurial repositories
&lt;/p&gt;
&lt;p&gt;
I've got lots of private mercurial repositories with university homework and other early projects, and it's sad to think of people who will lose theirs during this wipe.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="bluemaestro"&gt;&lt;a class="headerlink" href="#bluemaestro"&gt;¶&lt;/a&gt;&lt;a href="https://bluemaestro.com/products/product-details/bluetooth-environmental-monitor-and-logger"&gt;Bluemaestro&lt;/a&gt; (environment sensor)&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: sensor syncs with phone app via Bluetooth, &lt;samp class="inline"&gt;/data/data/com.bluemaestro.tempo_utility/databases/&lt;/samp&gt; is regularly copied to grab the data.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;temperature during sleep data for the &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
lifelogging: capturing weather conditions information
&lt;/p&gt;
&lt;p&gt;
E.g. I can potentially see temperature/humidity readings along with my photos from hiking or skiing.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="blood"&gt;&lt;a class="headerlink" href="#blood"&gt;¶&lt;/a&gt;Blood&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: via &lt;a href="https://thriva.co"&gt;thriva&lt;/a&gt;, data imported manually into an org-mode table (not doing too frequently so wasn't worth automated scraping)
&lt;/p&gt;
&lt;p&gt;
Also tracked glucose and ketones (with &lt;a href="https://freestylediabetes.co.uk/freestyle-libre"&gt;freestyle libre&lt;/a&gt;) for a few days out of curiosity, also didn't bother automating it.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;contributes to the &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;, could be a good way of establishing your baselines&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="browser_history"&gt;&lt;a class="headerlink" href="#browser_history"&gt;¶&lt;/a&gt;Browser history (Firefox/Chrome)&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/promnesia/tree/master/scripts"&gt;custom scripts&lt;/a&gt;, copying the underlying sqlite databases directly, running on my computers and phone.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="emfit"&gt;&lt;a class="headerlink" href="#emfit"&gt;¶&lt;/a&gt;&lt;a href="https://shop-eu.emfit.com/products/emfit-qs"&gt;Emfit QS&lt;/a&gt; (sleep tracker)&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Emfit QS is kind of a medical grade sleep tracker. It's more expensive than wristband ones (e.g. &lt;a class="link-down" href="#fitbit"&gt;fitbit&lt;/a&gt;, &lt;a class="link-down" href="#jawbone"&gt;jawbone&lt;/a&gt;) but also more reliable and gives more data.
&lt;/p&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/backup-emfit"&gt;emfitexport&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;sleep data for the &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="endomondo"&gt;&lt;a class="headerlink" href="#endomondo"&gt;¶&lt;/a&gt;Endomondo&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: Endomondo collects GPS data, and HR data (via &lt;a href="https://uk.wahoofitness.com/devices/heart-rate-monitors/wahoo-tickr-x-heart-rate-strap"&gt;Wahoo Tickr X strap&lt;/a&gt;). Then, &lt;a href="https://github.com/karlicoss/endoexport"&gt;karlicoss/endoexport&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;exercise data for the &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="facebook"&gt;&lt;a class="headerlink" href="#facebook"&gt;¶&lt;/a&gt;Facebook&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: manual archive export.
&lt;/p&gt;
&lt;p&gt;
I barely use Facebook, so don't even bother doing it regularly.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="messenger"&gt;&lt;a class="headerlink" href="#messenger"&gt;¶&lt;/a&gt;Facebook Messenger&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/fbmessengerexport"&gt;karlicoss/fbmessengerexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="feedbin"&gt;&lt;a class="headerlink" href="#feedbin"&gt;¶&lt;/a&gt;Feedbin&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: via API
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="feedly"&gt;&lt;a class="headerlink" href="#feedly"&gt;¶&lt;/a&gt;Feedly&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: via API
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="fitbit"&gt;&lt;a class="headerlink" href="#fitbit"&gt;¶&lt;/a&gt;Fitbit&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: manual CSV export, as I only used it for few weeks. Then the sync stopped working and I had to return it.
However, it seems &lt;a href="https://dev.fitbit.com/build/reference/web-api/intraday-requests"&gt;possible&lt;/a&gt; via API.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;activity data for the &lt;a class="link-down" href="#dashboard"&gt;#dashboard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="foursquare"&gt;&lt;a class="headerlink" href="#foursquare"&gt;¶&lt;/a&gt;Foursquare/Swarm&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: via API
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="github_repos"&gt;&lt;a class="headerlink" href="#github_repos"&gt;¶&lt;/a&gt;Github (repositories)&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/josegonzalez/python-github-backup"&gt;github-backup&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;capable of exporting starred repositories as well, so if the authors delete them I will still have them&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="github_events"&gt;&lt;a class="headerlink" href="#github_events"&gt;¶&lt;/a&gt;Github (events)&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: manually requested archive (once), after that automatic &lt;a href="https://github.com/karlicoss/ghexport"&gt;karlicoss/ghexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt; in comments/open issues, etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="gmail"&gt;&lt;a class="headerlink" href="#gmail"&gt;¶&lt;/a&gt;Gmail&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/joeyates/imap-backup"&gt;imap-backup&lt;/a&gt;, &lt;a class="link-down" href="#takeout"&gt;Google Takeout&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;this is arguably &lt;b&gt;the most important&lt;/b&gt; thing you should export considering how heavily everything relies on email&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="goodreads"&gt;&lt;a class="headerlink" href="#goodreads"&gt;¶&lt;/a&gt;Goodreads&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/goodrexport"&gt;karlicoss/goodrexport&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="takeout"&gt;&lt;a class="headerlink" href="#takeout"&gt;¶&lt;/a&gt;Google takeout&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: semi-automatic. 
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;only manual step: enable scheduled exports (you can schedule 6 per year at a time), and choose to keep it on Google Drive in export settings&lt;/li&gt;
&lt;li&gt;mount your Google Drive (e.g. via &lt;a href="https://github.com/astrada/google-drive-ocamlfuse"&gt;google-drive-ocamlfuse&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;keep a script that checks mounted Google Drive for fresh takeout and moves it somewhere safe&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;Google collects lots of data, which you could put to some good use. However, old data is getting &lt;a href="./takeout-data-gone.html"&gt;wiped&lt;/a&gt;, so it's important to export Takeout regularly.&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;(potentially) search history for &lt;a class="link-down" href="#promnesia"&gt;promnesia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;search&lt;/a&gt; in youtube watch history&lt;/li&gt;
&lt;li&gt;location data for lifelogging and the &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt; (activity)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="hackernews"&gt;&lt;a class="headerlink" href="#hackernews"&gt;¶&lt;/a&gt;&lt;span class="todo STRT"&gt;STRT&lt;/span&gt;Hackernews&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: haven't got to it yet. It's going to require:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;extracting upvotes/saved items via web scraping since Hackernews doesn't offer an API for that. Hopefully, there is an existing library for that.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
I'm also using &lt;a href="https://play.google.com/store/apps/details?id=io.github.hidroh.materialistic"&gt;Materialistic&lt;/a&gt; app that has its own 'saved' posts and doesn't synchronize with Hackernews. 
&lt;/p&gt;
&lt;p&gt;
Exporting them is going to require copying the database directly from the app private storage.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Why: same reasons as &lt;a class="link-down" href="#reddit"&gt;Reddit&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="hsbc"&gt;&lt;a class="headerlink" href="#hsbc"&gt;¶&lt;/a&gt;HSBC bank&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: manual exports of monthly PDFs with transactions. They don't really offer API, so unless you want to web scrape and deal with 2FA, it seems it's the best you can do.
&lt;/p&gt;
&lt;p&gt;
Why
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;personal finance; used it with &lt;a href="https://github.com/karlicoss/hsbc-parser"&gt;karlicoss/hsbc-parser&lt;/a&gt; to feed into &lt;a href="https://hledger.org"&gt;hledger&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="hypothesis"&gt;&lt;a class="headerlink" href="#hypothesis"&gt;¶&lt;/a&gt;&lt;a href="https://hypothes.is"&gt;Hypothesis&lt;/a&gt;&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/hypexport"&gt;karlicoss/hypexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;quick todos via &lt;a class="link-down" href="#orger"&gt;orger&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="instapaper"&gt;&lt;a class="headerlink" href="#instapaper"&gt;¶&lt;/a&gt;Instapaper&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/instapexport"&gt;karlicoss/instapexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;, in particular implementing overlay with highlights&lt;/li&gt;
&lt;li&gt;quick todos via &lt;a class="link-down" href="#orger"&gt;orger&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="jawbone"&gt;&lt;a class="headerlink" href="#jawbone"&gt;¶&lt;/a&gt;Jawbone&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: via API.
Jawbone is dead now, so if you haven't exported it already, likely your data is lost forever.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;sleep data for the &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="kindle"&gt;&lt;a class="headerlink" href="#kindle"&gt;¶&lt;/a&gt;Kindle&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: manually exported &lt;samp class="inline"&gt;MyClippings.txt&lt;/samp&gt; from Kindle. Potentially can be automated similarly to &lt;a class="link-down" href="#kobo"&gt;Kobo&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="kobo"&gt;&lt;a class="headerlink" href="#kobo"&gt;¶&lt;/a&gt;&lt;a href="https://www.kobo.com"&gt;Kobo&lt;/a&gt; reader&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: almost automatic via &lt;a href="https://github.com/karlicoss/kobuddy"&gt;karlicoss/kobuddy&lt;/a&gt;. Manual step: having to connect your reader via USB now and then.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="orger-todos.html#krill"&gt;spaced repetition&lt;/a&gt; for unfamiliar words/new concepts via &lt;a class="link-down" href="#orger"&gt;orger&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="lastfm"&gt;&lt;a class="headerlink" href="#lastfm"&gt;¶&lt;/a&gt;Last.fm&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/lastfm-backup"&gt;karlicoss/lastfm-backup&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="monzo"&gt;&lt;a class="headerlink" href="#monzo"&gt;¶&lt;/a&gt;Monzo bank&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/monzoexport"&gt;karlicoss/monzoexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;automatic personal finance, fed into &lt;a href="https://hledger.org"&gt;hledger&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="nomie"&gt;&lt;a class="headerlink" href="#nomie"&gt;¶&lt;/a&gt;&lt;a href="https://nomie.app"&gt;Nomie&lt;/a&gt;&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: regular copies of &lt;samp class="inline"&gt;/data/data/io.nomie.pro/files/_pouch_events&lt;/samp&gt; and &lt;samp class="inline"&gt;/data/data/io.nomie.pro/files/_pouch_trackers&lt;/samp&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;could be a great tool for detailed lifelogging if you're into it&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="nutrition"&gt;&lt;a class="headerlink" href="#nutrition"&gt;¶&lt;/a&gt;Nutrition&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
I tracked almost all nutrition data for stuff I ingested over the course of a year.
&lt;/p&gt;
&lt;p&gt;
How: I found most existing apps/projects clumsy and unsatisfactory, so I developed my own system.
Not even a proper app, something simpler, basically a domain-specific language in Python to track it.
&lt;/p&gt;
&lt;p&gt;
Tracking process was simply editing a python file and adding entries like:
&lt;/p&gt;
&lt;div class="org-src-container"&gt;
&lt;pre class="src src-python"&gt;&lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;file: food_2017.py&lt;/span&gt;
&lt;span class="org-variable-name"&gt;july_09&lt;/span&gt; = F(
  [  &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;lunch&lt;/span&gt;
       spinach * bag,
       tuna_spring_water * can,       &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;can size for this tuna is 120g&lt;/span&gt;
       beans_broad_wt    * can * 0.5, &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;half can. can size for broad beans is 200g&lt;/span&gt;
       onion_red_tsc     * gr(115)  , &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;grams, explicit&lt;/span&gt;
       cheese_salad_tsc  * 100,       &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;grams, implicit as it makes sense for cheese&lt;/span&gt;
       lime, &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;1 fruit, implicit&lt;/span&gt;
  ],
  [
     &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;dinner...&lt;/span&gt;
  ],
  tea_black * 10,     &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;cups, implicit&lt;/span&gt;
  wine_red * ml * 150, &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;ml, explicit&lt;/span&gt;
)

&lt;span class="org-variable-name"&gt;july_10&lt;/span&gt; = ... &lt;span class="org-comment-delimiter"&gt;# &lt;/span&gt;&lt;span class="org-comment"&gt;more logs&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
Comments added for clarity of course, so it'd be more compact normally.
&lt;/p&gt;
&lt;p&gt;
Then some code was used for processing, calculating, &lt;a href="https://postimg.cc/bdSVc43Y"&gt;visualizing&lt;/a&gt;, etc.
&lt;/p&gt;
&lt;p&gt;
Having a real programming language instead of an app let me make it very flexible and expressive, e.g.:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
I could define composite dishes as Python objects, and then easily reuse them.
&lt;/p&gt;
&lt;p&gt;
E.g. if I made four servings of soup on 10.08.2018, ate one immediately and froze other three I would define something like &lt;samp class="inline"&gt;soup_20180810 = [...]&lt;/samp&gt;, and then I can simply reuse &lt;samp class="inline"&gt;soup_20180810&lt;/samp&gt; when I eat it again.
(date was easy to find out as I label food when put it in the freezer anyway)
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;I could make many things implicit, making it pretty expressive without spending time on unnecessary typing&lt;/li&gt;
&lt;li&gt;I rarely had to in nutrient composition manually, I just pasted the product link to supermarket website and had an automatic script to parse nutrient information&lt;/li&gt;
&lt;li&gt;For micronutrients (that usually aren't listed on labels) I used the &lt;a href="https://github.com/alyssaq/usda-sqlite"&gt;USDA sqlite database&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The hard thing was actually not entering, but rather not having nutrition information if you're eating out. That year I was mostly cooking my own food, so tracking was fairly easy.
&lt;/p&gt;
&lt;p&gt;
Also I was more interested in lower bounds, (e.g. "do I consume at least recommended amount of micronutrients"), so not having logged food now and then was fine for me.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
I mostly wanted to learn about food composition and how it relates to my diet, and I did
&lt;/p&gt;
&lt;p&gt;
That logging motivated me to learn about different foods and try them out while keeping dishes balanced.
I cooked so many different things, made my diet way more varied and became less picky.
&lt;/p&gt;
&lt;p&gt;
I stopped because cooking did take some time and I actually realized that as long as I actually vary
food and try to eat everything now and then, I hit all recommended amounts of micronutrients, so I stopped.
It's kind of an obvious thing that everyone recommends, but one thing is hearing it as a common wisdom
and completely different is coming to the same conclusion &lt;b&gt;from your data&lt;/b&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;nutritional information contributes to &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="photos"&gt;&lt;a class="headerlink" href="#photos"&gt;¶&lt;/a&gt;Photos&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: no extra effort required if you sync/organize your photos and videos now and then.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;obvious source of lifelogging, in addition comes with GPS data&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="pdfs"&gt;&lt;a class="headerlink" href="#pdfs"&gt;¶&lt;/a&gt;PDF annotations&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
As in, &lt;a href="annotating.html#pdfs"&gt;native PDF annotations&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
How: nothing needs to be done, PDFs are local to your computer. You do need &lt;a href="https://github.com/karlicoss/my/blob/master/my/pdfs.py"&gt;some tools&lt;/a&gt; to crawl your filesystem and extract the annotations.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
experience of using your PDF annotations (e.g. searching) is &lt;a href="annotating.html#comparison"&gt;&lt;b&gt;extremely poor&lt;/b&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I'm improving this by using &lt;a class="link-down" href="#orger"&gt;orger&lt;/a&gt;.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="pinboard"&gt;&lt;a class="headerlink" href="#pinboard"&gt;¶&lt;/a&gt;Pinboard&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/pinbexport"&gt;karlicoss/pinbexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="notes"&gt;&lt;a class="headerlink" href="#notes"&gt;¶&lt;/a&gt;Plaintext notes&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Mostly this refers to org-mode files, which I use for notekeeping and logging.
&lt;/p&gt;
&lt;p&gt;
How: nothing needs to be done, they are local. 
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;search&lt;/a&gt; comes for free, it's already local&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="pocket"&gt;&lt;a class="headerlink" href="#pocket"&gt;¶&lt;/a&gt;Pocket&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/pockexport"&gt;karlicoss/pockexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;, in particular implementing overlay with highlights&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="reddit"&gt;&lt;a class="headerlink" href="#reddit"&gt;¶&lt;/a&gt;Reddit&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/rexport"&gt;karlicoss/rexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="orger-todos.html#reddit"&gt;org-mode interface&lt;/a&gt; for processing saved Reddit posts/comments, via &lt;a class="link-down" href="#orger"&gt;orger&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="rtm"&gt;&lt;a class="headerlink" href="#rtm"&gt;¶&lt;/a&gt;Remember the Milk&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: ical export from the API.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I stopped using RTM in favor of org-mode, but I can still easily find my old task and notes, which allowed for a smooth transition.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="rescuetime"&gt;&lt;a class="headerlink" href="#rescuetime"&gt;¶&lt;/a&gt;Rescuetime&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/rescuexport"&gt;karlicoss/rescuexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;richer contexts for lifelogging&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="shell"&gt;&lt;a class="headerlink" href="#shell"&gt;¶&lt;/a&gt;Shell history&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: many shells support keeping timestamps along your commands in history.
&lt;/p&gt;
&lt;p&gt;
E.g. &lt;a href="http://jesrui.sdf-eu.org/remember-all-your-bash-history-forever.html"&gt;"Remember all your bash history forever"&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;potentially can be useful for detailed lifelogging&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="sleep"&gt;&lt;a class="headerlink" href="#sleep"&gt;¶&lt;/a&gt;Sleep&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Apart from &lt;a class="link-up" href="#emfit"&gt;automatic collection&lt;/a&gt; of HR data, etc., I collect some extra stats like:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;whether I woke up on my own or after alarm&lt;/li&gt;
&lt;li&gt;whether I still feel sleepy shortly after waking up&lt;/li&gt;
&lt;li&gt;whether I had dreams (and I log dreams if I did)&lt;/li&gt;
&lt;li&gt;I log every time I feel sleepy throughout the day&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
How: org-mode, via &lt;a href="https://emacs.stackexchange.com/a/45640/19521"&gt;org-capture into table&lt;/a&gt;.
Alternatively, you could use a spreadsheet for that as well.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;I think it's important to find connections between subjective feelings and objective stats like amount of exercise, sleep HR, etc.,
so I'm trying to find correlations using my &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;dreams are quite fun part of lifelogging&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="sms_calls"&gt;&lt;a class="headerlink" href="#sms_calls"&gt;¶&lt;/a&gt;Sms/calls&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://play.google.com/store/apps/details?id=com.riteshsahu.SMSBackupRestore"&gt;SMS Backup &amp;amp; Restore&lt;/a&gt; app, automatic exports.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="spotify"&gt;&lt;a class="headerlink" href="#spotify"&gt;¶&lt;/a&gt;Spotify&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: export script, using &lt;a href="https://github.com/plamere/spotipy"&gt;plamere/spotipy&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;potentially can be useful for better search in music listening history&lt;/li&gt;
&lt;li&gt;can be used for custom recommendation algorithms&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="stackexchange"&gt;&lt;a class="headerlink" href="#stackexchange"&gt;¶&lt;/a&gt;Stackexchange&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/karlicoss/stexport"&gt;karlicoss/stexport&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="taplog"&gt;&lt;a class="headerlink" href="#taplog"&gt;¶&lt;/a&gt;&lt;a href="https://play.google.com/store/apps/details?id=com.waterbear.taglog"&gt;Taplog&lt;/a&gt;&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
(not using it anymore, in favor of org-mode)
&lt;/p&gt;
&lt;p&gt;
How: regular copying of &lt;samp class="inline"&gt;/data/data/com.waterbear.taglog/databases/Buttons Database&lt;/samp&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;a quick way of single tap logging (e.g. weight/sleep/exercise etc), contributes to the &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="telegram"&gt;&lt;a class="headerlink" href="#telegram"&gt;¶&lt;/a&gt;Telegram&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/fabianonline/telegram_backup"&gt;fabianonline/telegram_backup&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="twitter"&gt;&lt;a class="headerlink" href="#twitter"&gt;¶&lt;/a&gt;Twitter&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: twitter archive (manually, once), after that regular automatic exports via API
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="vk"&gt;&lt;a class="headerlink" href="#vk"&gt;¶&lt;/a&gt;VK.com&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: &lt;a href="https://github.com/Totktonada/vk_messages_backup"&gt;Totktonada/vk_messages_backup&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Sadly VK broke their API so the script stopped working. I'm barely using VK now anyway so not motivated enough to work around it.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="weight"&gt;&lt;a class="headerlink" href="#weight"&gt;¶&lt;/a&gt;Weight&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: manually, used &lt;a class="link-up" href="#nomie"&gt;Nomie&lt;/a&gt; and &lt;a class="link-up" href="#taplog"&gt;Taplog&lt;/a&gt;, but now just using org-mode and extracting data with &lt;a href="https://github.com/karlicoss/orgparse"&gt;orgparse&lt;/a&gt;.
Could be potentially automated via wireless scales, but not much of a priority for me.
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;obvious data source for the &lt;a class="link-down" href="#dashboard"&gt;dashboard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="whatsapp"&gt;&lt;a class="headerlink" href="#whatsapp"&gt;¶&lt;/a&gt;&lt;span class="todo TODO"&gt;TODO&lt;/span&gt;Whatsapp&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Barely using it so haven't bothered yet.   
&lt;/p&gt;
&lt;p&gt;
How: Whatsapp doesn't offer API, so potentially going to require grabbing sqlite database from Android app (&lt;samp class="inline"&gt;/data/data/com.whatsapp/databases/msgstore.db&lt;/samp&gt;)
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a class="link-down" href="#search"&gt;better search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link-down" href="#promnesia"&gt;better browsing history&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="23andme"&gt;&lt;a class="headerlink" href="#23andme"&gt;¶&lt;/a&gt;&lt;a href="https://www.23andme.com"&gt;23andme&lt;/a&gt;&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
How: manual &lt;a href="https://customercare.23andme.com/hc/en-us/articles/212196868-Accessing-Your-Raw-Genetic-Data"&gt;raw data export&lt;/a&gt; from 23andme website. I hope your genome doesn't change so often to bother with automatic exports!
&lt;/p&gt;
&lt;p&gt;
Why:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;p&gt;
was planning to setup some sort of automatic search of new genome insights against open source analysis tools
&lt;/p&gt;
&lt;p&gt;
Haven't really had time to think about it yet, and it feels like a hard project out of my realm of competence.
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="consumers"&gt;&lt;a class="headerlink" href="#consumers"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; Data consumers&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="search"&gt;&lt;a class="headerlink" href="#search"&gt;¶&lt;/a&gt;Instant search&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Typical search interfaces make me unhappy as they are &lt;b&gt;siloed, slow, awkward to use and don't work offline&lt;/b&gt;.
So I built my own ways around it! I write about it in detail &lt;a href="pkm-search.html#personal_information"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
In essence, I'm mirroring most of my online data like chat logs, comments, etc., as plaintext.
I can overview it in any text editor, and incrementally search over &lt;b&gt;all of it&lt;/b&gt; in a single keypress.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="orger"&gt;&lt;a class="headerlink" href="#orger"&gt;¶&lt;/a&gt;orger&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;a href="https://github.com/karlicoss/orger"&gt;orger&lt;/a&gt; is a tool that helps you generate an org-mode representation of your data.
&lt;/p&gt;
&lt;p&gt;
It lets you benefit from the existing tooling and infrastructure around org-mode, the most famous being Emacs.
&lt;/p&gt;
&lt;p&gt;
I'm using it for:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;searching, overviewing and navigating the data&lt;/li&gt;
&lt;li&gt;creating tasks straight from the apps (e.g. Reddit/Telegram)&lt;/li&gt;
&lt;li&gt;spaced repetition via &lt;a href="https://orgmode.org/worg/org-contrib/org-drill.html"&gt;org-drill&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Orger comes with some existing &lt;a href="https://github.com/karlicoss/orger/tree/master/modules"&gt;modules&lt;/a&gt;, but it should be easy to adapt your own data source if you need something else.
&lt;/p&gt;
&lt;p&gt;
I write about it in detail &lt;a href="orger.html"&gt;here&lt;/a&gt; and &lt;a href="orger-todos.html"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="promnesia"&gt;&lt;a class="headerlink" href="#promnesia"&gt;¶&lt;/a&gt;promnesia&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
&lt;a href="https://github.com/karlicoss/promnesia#demo"&gt;promnesia&lt;/a&gt; is a browser extension I'm working on to escape silos by &lt;b&gt;unifying annotations and browsing history&lt;/b&gt; from different data sources.
&lt;/p&gt;
&lt;p&gt;
I've been using it for more than a year now and working on final touches to properly release it for other people.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="dashboard"&gt;&lt;a class="headerlink" href="#dashboard"&gt;¶&lt;/a&gt;dashboard&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
As a big fan of &lt;a class="post-tag" href="./tags.html#quantified-self"&gt;#quantified-self&lt;/a&gt;, I'm working on personal health, sleep and exercise dashboard, built from various data sources.
&lt;/p&gt;
&lt;p&gt;
I'm working on making it public, you can see some screenshots &lt;a href="https://www.reddit.com/r/QuantifiedSelf/comments/cokt4f/what_do_you_all_do_with_your_data/ewmucgk"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="timeline"&gt;&lt;a class="headerlink" href="#timeline"&gt;¶&lt;/a&gt;timeline&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
Timeline is a &lt;a class="post-tag" href="./tags.html#lifelogging"&gt;#lifelogging&lt;/a&gt; project I'm working on.
&lt;/p&gt;
&lt;p&gt;
I want to see all my digital history, search in it, filter, easily jump at a specific point in time and see the context when it happened.
That way it works as a sort of external memory.
&lt;/p&gt;
&lt;p&gt;
Ideally, it would look similar to Andrew Louis's &lt;a href="https://hyfen.net/memex"&gt;Memex&lt;/a&gt;, or might even reuse his interface if
he open sources it. I highly recommend watching his talk for inspiration.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-3"&gt;
&lt;h3 id="mypkg"&gt;&lt;a class="headerlink" href="#mypkg"&gt;¶&lt;/a&gt;&lt;a href="https://github.com/karlicoss/HPI"&gt;&lt;code class="inline"&gt;HPI&lt;/code&gt;&lt;/a&gt; python package&lt;/h3&gt;
&lt;div class="outline-text-3"&gt;
&lt;p&gt;
This python package is a my personal (python) API to access all collected data.
&lt;/p&gt;
&lt;p&gt;
I'm elaborating on it &lt;a href="hpi.html"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="outline-2"&gt;
&lt;h2 id="fin"&gt;&lt;a class="headerlink" href="#fin"&gt;¶&lt;/a&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; --&lt;/h2&gt;
&lt;div class="outline-text-2"&gt;
&lt;p&gt;
Happy to answer any questions on my approach and help you with liberating your data.  
&lt;/p&gt;
&lt;p&gt;
In the &lt;a href="exports.html"&gt;next post&lt;/a&gt; I'm elaborating on design decisions behind my data export and access infrastructure.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Updates&lt;/b&gt;:
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;span class="timestamp-wrapper"&gt;&lt;span class="timestamp"&gt;[2020-01-14]&lt;/span&gt;&lt;/span&gt;: added 'Nutrition', 'Shell history' and 'Sleep' sections&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;

    &lt;/section&gt;

    
    &lt;section id="post-footer"&gt;
        &lt;div class="post-tags"&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#dataliberation"&gt;#dataliberation&lt;/a&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#pkm"&gt;#pkm&lt;/a&gt;
            &lt;a class="post-tag tag-active" href="./tags.html#quantifiedself"&gt;#quantifiedself&lt;/a&gt;
        &lt;/div&gt;
        &lt;time datetime="2020-01-12T00:00:00"&gt;12 January 2020&lt;/time&gt;
    &lt;/section&gt;
    

    
    &lt;section id="post-discussion"&gt;
    &lt;br/&gt;
    &lt;div&gt;Discussion:&lt;/div&gt;
    &lt;ul&gt;
        &lt;li&gt;&lt;a href="https://www.reddit.com/r/DataHoarder/comments/eol6hw/how_i_collect_and_use_50_sources_of_my_personal"&gt;/r/DataHoarder&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="https://reddit.com/r/QuantifiedSelf/comments/eo41j6/what_data_on_myself_i_collect_why_and_how_i_use_it/fe8pxih"&gt;/r/QuantifiedSelf&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="https://news.ycombinator.com/item?id=26045797"&gt;&lt;b&gt;hackernews&lt;/b&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    

    &lt;section id="post-comments"&gt;
    &lt;script data-isso="https://beepb00p.xyz/comments/" data-isso-reply-to-self="true" src="https://beepb00p.xyz/comments/js/embed.min.js"&gt;
&lt;/script&gt;

&lt;section data-isso-id="isso_my_data" id="isso-thread"&gt;&lt;/section&gt;
    &lt;/section&gt;
&lt;/section&gt;&lt;/article&gt;
    &lt;/main&gt;

    &lt;footer id="bottomfooter"&gt;
        &lt;a href="https://twitter.com/karlicoss"&gt;🐦 me @twitter&lt;/a&gt;
        &lt;a href="https://github.com/karlicoss"&gt;💻 me @github&lt;/a&gt;
        &lt;a href="http://creativecommons.org/licenses/by/4.0" style="margin-left:auto"&gt;CC BY 4.0&lt;/a&gt;&lt;/footer&gt;

&lt;/body&gt;&lt;/html&gt;</description>
      <guid isPermaLink="true">https://beepb00p.xyz/my-data.html</guid>
      <pubDate>Sun, 12 Jan 2020 00:00:00 +0000</pubDate>
    </item>
  </channel>
</rss>
