In a recent article, Peter Franklin draws a parallel between capitalism and Tolkien’s Lord of the Rings mythology, likening Facebook, and social media in general, to the rings of middle earth — powerful rings gifted by Sauron, Lord of Mordor, to the leaders of middle earth, secretly influencing them, binding them to darkness, and increasing the power of the dark lord.

There’s a larger concept in this mythology about power, which does not necessarily imply evil. The artifacts and tools that we create have power and purpose. In our modern world, open data and open source software can be powerful forces that create positive impact. With open source software, freely distributed libraries and applications influence behavior, affecting properties of the systems that rule our lives. By making certain things easy for other software developers, one small piece of code can have outsize effects on unrelated commercial software. Open and easily accessible datasets can create positive economic impact that can be more evenly distributed than investments of capital.

If you don’t know the story, or if it has been a while, you can catch up on the lore, reading Tolkien Gateway’s background on the Ring Verse or listen to Tolkien reading the Ring Verse on YouTube.

Tolkien’s reflection on power

Tolkien’s ring mythology aptly illustrates that to exercise power, one must give it away (and risk losing it), which he explains in one of his letters. Dr. Rhona Beare’s correspondence led Tolkien to elaborate on the rings of power as a mythical representation of power or, in his words, potency:

The Ring of Sauron is only one of the various mythical treatments of the placing of one’s life, or power, in some external object, which is thus exposed to capture or destruction with disastrous results to oneself…

a mythical way of representing the truth that potency (or
perhaps rather potentiality) if it is to be exercised, and produce results, has to be externalised and so as it were passed, to a greater or less degree, out of one’s direct control. A man who wishes to exert
‘power’ must have subjects, who are not himself. But he then depends on them.
— 14 October 1958 [1]

Whether it is capital investment, the intellectual property of source code, knowledge that you have collected as data or a small golden ring, you can amplify your power by giving it away, but then you must rely on others. Like Frodo, we can all exercise free will in deciding what to do with the power we are given. Destroy the ring, keep the elven chain mail shirt, go adventuring or enjoy our home in the shire. We decide.

[1] originally published in a booklet, later in The Letters of J.R.R. Tolkien, pdf)

Migration to Firebase from a Heroku-hosted Rails app appears to work seamlessly. I’ve only tested one user, but I could log in with the same password and Facebook account with no end-user intervention.

It took a little experimentation to come up with the correct format for export from heroku psql command line:

\COPY (select id, email, CASE WHEN confirmed_at IS NULL THEN 'false' ELSE 'true' END as Verified, regexp_replace(encode(encrypted_password::bytea, 'base64'), '\n', '') as hash, password_salt::text, screen_name, '' as photo, '' as google_id, '' as google_email, '' as google_name, '' as google_photo, uid as facebook_id, provider_email as facebook_email, '' as fname, '' as fphoto, '' as twitter_id, '' as twitter_mail, '' as twitter_name, '' as twitter_photo, '' as github_id, '' as github_mail, '' as github_name, '' as github_photo, EXTRACT(EPOCH FROM created_at)::bigint, EXTRACT(EPOCH FROM last_sign_in_at)::bigint, '' as phone FROM speakers ORDER BY id limit 160) TO '~/users.csv' WITH (FORMAT csv, DELIMITER ',');

Which I imported with the following command:

firebase auth:import ~/users.csv     \
    --hash-algo=BCRYPT               \
    --rounds=10                      \

Check your devise config file config/initializers/devise.rb — encryption options are configurable there.

Additional Notes

I found these samples helpful to get a test running very quickly.

Firebase auth import requires exactly 26 collumns (for csv import):

UID,Email,Email Verified,Password Hash,Password Salt,Name,Photo URL,Google ID,Google Email,Google Display Name,Google Photo URL,Facebook ID,Facebook Email,Facebook Display Name,Facebook Photo URL,Twitter ID,Twitter Email,Twitter Display Name,Twitter Photo URL,GitHub ID,GitHub Email,GitHub Display Name,GitHub Photo URL,User Creation Time,Last Sign-In Time,Phone Number

In learning a new programming language, it’s helpful to understand it’s philosophy. I seek to learn patterns that are idiomatic, and more importantly: why the syntax is the way it is. This allows me to write original code more quickly, gaining an intuition for simple things like when to look for a library and when to just write code.

I rarely find good resources for learning a new language that are targeted at experienced programmers. So I’ve developed a habit of looking for language koans. Inspired by Ruby Koans, these are unit tests which guide a programmer through basic language constructs by presenting a failing test and let you write simple code to learn the syntax of a language. These tests typically include a bit of text that helps newcomers reflect on what is special and interesting about this particular programming language.

In learning Go, I found cdarwin/go-koans, which helped me to reflect on the philosophy of golang, the Go programming language.

The koans caused me to meditate on the basics, leading me to read more and reflect. While about_basics.go is quick to solve technically, it sparked my curiosity on two points.

1. The uninitialized variable

I really wanted the comments in the go-koans to be a bit more like Zen koans (or Ruby koans), so I wrote these:

// listen to the darkness of an unset variable
// what is the code that is not written?
// consider the emptiness of a string

// create meaning from emptiness
// undefined structure isn't

“Make the zero value useful” —Go Proverbs

It reminds me of the Zen teacup parable. An empty cup has utility, even before it is filled.

2. The implications of a string

One of the most deceptively simple types in modern programming languages is the string. In Go, there is a built-in string type with short, unsatisfying descriptive text.

Strings, bytes, runes and characters in Go explains that strings are a read-only slice of bytes (at runtime). Go source code is UTF-8, so string literals always contain UTF-8 text (except for byte-level escapes.

Strings always cause me to reflect on how memory management works in a language. In my search for basic answers about how and when memory happens in string operations, I read about allocation efficiency in high-performance Go services which includes a nice explanation of heap vs stack memory allocation in Go.


At this point, I don’t know what I need to know about this new programming language. I just like to know what the code I’m typing actually does. Learning syntax is boring, so I need to occupy my mind with something more interesting while I practice typing unfamiliar sequences of text. To write good code, I need to know so much more than the syntax, but I need to be careful not get get too attached to certain details. For example, future compiler versions change the patterns of how code is transformed into machine operations. However, if I attach just a little deeper meaning to these syntax constructs and get a feel for what my code ends up doing under-the-hood, I can more quickly understand the implications of the code I write.

When I emerge from these learning meditations and I can finally construct this new syntax without thinking and start to solve actual problems that matter to humans, then I will have created these little trails in my mind that lead to empty spaces, which have shape and meaning, like the Go zero value and the Zen teacup.