Pomodoro timers in i3 statusbar

The Pomodoro Technique

Pomodoro is an awesome productivity technique, one of the few that work for me, consistently, more than five years now. If you have not heard of it, the basic idea is the following:

  1. Decide on the task to be done.
  2. Set the pomodoro timer (traditionally to 25 minutes).
  3. Work on the task.
  4. End work when the timer rings and put a checkmark on a piece of paper.
  5. If you have fewer than four checkmarks, take a short break (3–5 minutes), then go to step 2.
  6. After four pomodoros, take a longer break (15–30 minutes), reset your checkmark count to zero, then go to step 1. 1Wikipedia: https://en.wikipedia.org/wiki/Pomodoro_Technique

Now playing: Iggy Pop – The Passenger

This works, for me usually 15 / 5 minutes, depending on the complexity of the task. For things that are very hard to do or for times when I don’t feel well at all, switching helps immensely. Usually it’s 5 minutes of a task that requires a lot of willpower, 5 minutes of something easier, 5+ minutes of pause. For tasks requiring more uninterrupted contentration, tasks that are easier for me, and when I feel well and productive, I go for 25 minutes / 5 minutes of pause.

This system is also nice because it implements the age-old rule of “rest before you are tired”. (I found that when I feel tired, it’s probably too late to rest, and my productivity is already impaired. I can force myself through it, but it would mean that I’d pay for it the next day.)  So the best metric I found for the exact ratio is the amount of willpower it takes to do something.

To implement this, I always used https://onlinetimer.ru/, and it’s absolutely perfect. You can even drag and drop individual timers and create bookmarks out of them:

i3 / i3status

But since I use it really a lot, I decided to make another keyboard shortcut for a timer, and visualize it in my i3 statusbar, to have a nice overview.

i3 is a(n awesome) tiling windows manager for Linux. Its statusbar is controlled in .i3/config:

This is the config for my smaller screen, which hides the statusbar except Mod4 (=Win) is pressed. It executes status_command, which in turn generates a statusbar with i3status using a certain config file, and then pipes the output through .i3/wrapper.py

My .i3status-small is not too creative. Maybe the only nontrivial thing is a run_watch which tells me if a VPN is running:

It checks if the file /etc/openvpn/mv.pid exists, if it does – the VPN in running. The vpn is run via the following aliased command:

alias o='sudo openvpn --writepid /etc/openvpn/mv.pid --config'

The result looks like this (click to enlarge)

i3status wrapper for custom commands

Now playing: Les Miserables 10th anniversary version – The Confrontation

First, I researched possible timers. Found utimer, It’s perfect.

Its output looks like this:

I added the following lines in .i3/config. The first line executes utimer, countdown 15 minutes, pipes the output to a textfile and plays a sound at the end of its execution. Third line kills the player.

I needed to prepend the timers to the statusbar, so I cound see how much time is left. For this, I used this excellent wrapper script. It’s built based on i3statusbar’s input protocol, documented here.

I added the following lines, heavily commented:

It’s quite a dirty solution, but it works. When there’s text, it gets outputted on screen after being split. If the timer program finishes, it outputs a \n instead of a ^M, and nothing is shown. They are colored so I know which timer is which.

I also added  a  third timer, which I can run from CLI and which both makes a sound and a popup, with optional text. Heavily based on this forum post. Its file also gets read by wrapper.py.

The statusbar with all three timers active looks like this:

Sometimes they break, probably because of the hack-y way I use to read the files outputted by the timer. Restarting i3 (which does not close any programs and is not a problem) helps, I have a shortcut for that.

The sounds I use are http://soundbible.com/2205-Bells-Tibetan-Large.html and http://soundbible.com/2170-Clock-Chimes-4x.html.

(Y)

SH

 

Footnotes   [ + ]

Три історії про автостоп

1. Львів-Тернопіль

Now playing: «Penn Sardin» de madame Claude Michel (grève des Sardinières, Douarnenez 1924)

Виїзд зі Львову, в сторону Тернополя, літо 2014. Зупинився маленький мікроавтобус. Всередині чотири чоловіка, років 25-35.

— Хто ви, куди їдете?
— Ми православні християни, нас об’єднав Бог. Живемо і працюємо у Німеччині, зараз їдемо додому.

Сів, поїхали.

Водій:
— Хлопці, а я вам росказував притчу про сіяча?
— Так, раз вісім.
— Нічого, гарна притча, ось…  як тебе звати, до речі? Ваня? Добре. Іван не чув, хай послухає. Так от, …

Дуже приємно, коли таки знайшов попутку, впізнавати по дорозі окремі машини, які не зупинилися, і обганяти їх.

До речі їх машина була одна з найбільш убитих, які я бачив в житті. Частина панелі укравління трималась за допомогою скотчу, а внутрішньої сторони дверей справа від мене не було взагалі. Але атмосфера була в основному тихою, приємною, спокійною та затишною.

— Ніщо не вчить життю так, як Біблія. Рік тому до мене раптово вночі, третя десь, приїхав друг. Я не чекав його, тому у мене дома не було хліба. Але як приймати друга, коли на столі немає хліба? Тому я пішов до сусіда. Я до нього довго стукав, він не відповідав. Потім встав, мене послав і знову пішов. Але у Біблії написано — стукайте і вам відчинять. Тому я продовжив стукати. І що ти думаєш? Через пару хвилин він мені відкрив і дав хліба!

Їхали далі. Дух пустоти, свободи і ностальгії. Вони всі жили в Німеччині 5 років, і поверталися до України вперше за той період, і їм було рідним і цікавим абсолютно все. Тоді ж вони мені росказали про свою традицію слухати “Океан Ельзи – Я їду додому” при перетині кордону. Включили голосно знову. За вікном степ.

Той. хто був за рулем, росказав мені, що хлопець на задньому сидінні працює в якомусь фітнес-центрі. Сам він займався підробкою документів, не уточнив яких. Не пригадую, що робив третій, але теж щось дуже мутне, на рівні підробки документів. Я запитав про четвертого (він спав зверху), всі дуже явно промовчали, я вирішив що насправді не дуже хочу знати.

Зупинились коло священного джерела по дорозі, на жаль не згадаю назву. Зупинились, розтягнулись, вийшли, набрали звідти святої води. Повернулись до машини всі крім водія. Вирішили його почекати. Пройшло хвилин 10.

— Ну добре. Петро, піди глянь, що він там робить.

Петро відійшов, повернувся:
— Молиться.
— А, ну хай.

Прошло ще хвилин 10. Петро знову пішов, повернувся хитаючи головою.
— Що там?
— Витирає пил з ікон.
— Ох, це на довго…

Через хвилин 20 всі знову зібралися і поїхали далі. Вже коло Тернополя я став свідком однієї прекрасної сцени.

— Вася!
— Що?
— Воно знову відвалилося!
— Ну бля!

Я на першому сидінні справа, водій зліва від мене. Він тримаючи коліном руль, не зменшуючи швидкості (але знову ж таки, дорога пуста, навколо — степ…), ВІДКРИВАЄ СВОЇ ДВЕРІ, ДІСТАЄ СКОТЧ, ВИСУВАЄТЬСЯ І ЩОСЬ ПІДКЛЕЮЄ З ЗОВНІШНЬОЇ СТОРОНИ МАШИНИ. Потім закриває двері, відкладає скотч, їде далі.

Вони мене залишили на кільцевій м.Тернопіль, я зловив машину з дуже милою сім’єю яка мене довезла до іншого боку кільцевої, і звідти продовжив свою дорогу.

2. Прага-Краков

(Можна умовно вважати продовженням цього посту.)

Now playing: Ben Folds & Regina Spektor – You don’t know me.

(to be continued…)

Exporting Cambridge Brain Sciences data

Now playing: Ry Cooder – Jesus on the Mainline

Cambridge Brain Sciences is a nice way to measure brain health. After quick (~10 minutes) tests, it gives you your score in three main areas (Verbal, Reasoning and Memory) and your C-Score, which is “the summary of your cognitive function”. It’s meant not as a semi-static measure (~IQ), but as a “how are you feeling today” kind of thing.

I use it both as a way to track/manage some depression symptoms, and as an objective way to measure how various things influence your mental performance (think exercise/nootropics/sleep/…). I wrote a bit about it and how I use it here.

It’s pretty awesome, but lacks a CSV export, or even just a way to get the data in a readable format, without having to hover on their charts. I wrote them (they are pretty responsive and open to suggestions, by the way) and they said that they will add that as a planned feature. I  didn’t want to wait (patience is not one of my virtues) and wanted to start running some analyses on the data I have, but didn’t want to it down manually. Hovering over the data points in their chart to get the individual data points would have been very very tedious.

Looking at the source code (and hoping to find some “data.json” or something similar), I saw that for their charts they use Highchart. After skimming the documentation, I wrote small and extremely basic javascript snippet that would output the dates and datapoints of the currently open chart:

To use:

  1. Open the CBS dashboard
  2. Open the developer console.
  3. Paste snippet above

2017-11-08-225919_941x199_scrot

Then, if you need the verbal/memory/reasoning data, just switch to that tab and repeat the process.

For individual tests the process is very similar.

The snippet is the same, but you need to change the “chart” parameter. Switch to the “Tests” page, then right-click on the needed graph, “Inspect element”. You are looking for the data-highcharts-chart parameter:

2017-11-06-160037_380x139_scrot

This is the number you need. Set it in the first line of the snippet (chart=” “) and run.

To work with the data, I pasted it into LibreOffice calc with the following settings.

2017-11-06-160403_558x121_scrot

You need the “Separated by space” and “Merge delimiters”.

That way, it gets outputted to different cells, and you can copy the ones you need. I’m sure Excel can do something similar.

To merge the AM/PM on the other cell, I used the following formula to convert the time:

with B37 as cell with the time, and C37 as cell with AM/PM.

I hope I’m not infringing any terms of service, it’s not even scraping — just accessing the data already in the graphs. And I am not doing a tool or Greasemonkey script out of this, because I think that I won’t need to do this often (I add the data manually at the end of each tests if I do them), but if there’s interest, I could do something more “beautiful” and portable — let me know!

(Y)

SH.

Quotes for today

Straight from my quotes file, with sources mostly missing. But all of those are easy to Google.

“Experience by itself teaches nothing… Without theory, experience has no meaning. Without theory, one has no questions to ask. Hence, without theory, there is no learning.” ― W. Edwards Deming, The New Economics for Industry, Government, Education

Home is where the water tastes normal

You don’t need the cow to get the milk

It might be best to let go of finding meaning in life from your job. Try to find a low-stress slack job that pays the bills and leaves you energy to do other things, and then find meaning in life from those things. This will also allow you to shift from one interest to another.

The best thing about being a hybrid – you don’t have to be particularly good at either yet people are constantly blown away by the simplest things.

My personal belief (and mantra of creativity/slacking) is that if you do something people have never seen before, you will always exceed their expectations.

“It’s easy to pretend expertise when there’s no data to contradict you.”

В ДНР ожидаются серьёзные кадровые перестановки.  Но не те, о которых вы думаете.  Ожидающиеся перестановки будут сделаны, чтобы оттянуть те, о которых вы думаете.

“Hack Like Nobody’s Watching (because it is highly likely that nobody is watching)”

Pay more attention to what the losers do wrong as to what the winners do right

Title: somethingsometing (should be avoided)

And I will deny that I ever said this, but …
Aren’t you a little worried that there’s a hell?
Your original research was thought-provoking, although it would be considered felony in most states.
Generally you want your alibi not to be a witness at the scene of the crime. (Daria)

LPT: When you’re thinking about buying something you don’t necessarily need, imagine the item in one hand and the cash in the other. Which one would you take?

Never forget that everything Hitler did in Germany was legal.   ~ Martin Luther King Jr.
A little inaccuracy sometimes saves tons of explanation.   ~ HH Munro
What is said when drunk has been thought out beforehand.   ~ Flemish proverb
If you buy the why, the how is infinitely bearable.   ~ Friedrich Nietzsche
Seek, above all, for a game worth playing.   ~ Robert S. de Ropp
The best use of life is to spend it for something that will outlast it.   ~ William James
Only the simplest mind can believe that in a great controversy one side was mere folly.   ~ AJ Kane

Practice choosing discomfort

Real men don’t need either condoms or antivirus

Welcome to the Internet. Consider this a threat.

My friend is epileptic. One time after her seizure I asked if she knew me. She looked up at me and eventually said “Mom?” in a very uncertain tone.  I’m a little younger than her and I have a beard.

Vim, empty and blank lines, executing commands on regexes, ^M

It’s been quite a while since I wrote something in the Bits and Pieces category. I’m forgetting that the goal of this blog was partly documenting my own knowledge for my own use.Definitely need to hide this category from the front page and use it often. Or even better, make it a category on the wiki.

That said:

Vim digraphs

^M is how vim shows the 0xD character, which in Windows is a newline character. A more complete list of such characters is here: http://vimdoc.sourceforge.net/htmldoc/digraph.html#digraph-table

One way to insert such characters would be: ^M is entered by holding down Ctrl and typing v followed by m, and then releasing Ctrl. 1https://stackoverflow.com/a/5843561/3597501

Interestingly enough, the keys above are represented via the <kbd> tag, which apparently is a thing:2 https://developer.mozilla.org/ru/docs/Web/HTML/Element/kbd

The HTML <kbd> element represents user input and produces an inline element displayed in the browser’s default monospace font.

Vim removing empty lines & executing a command on lines matching a regex

:g/^$/d
:g will execute a command on lines which match a regex. The regex is ‘blank line’ and the command is :d (delete) 3 https://stackoverflow.com/questions/706076/vim-delete-blank-lines

Also interesting is the distinction between blank lines and empty lines. They could be defined as just '\n' and as a line with various spaces, but on visible content.

Footnotes   [ + ]

1. https://stackoverflow.com/a/5843561/3597501
2. https://developer.mozilla.org/ru/docs/Web/HTML/Element/kbd
3. https://stackoverflow.com/questions/706076/vim-delete-blank-lines

Updated Fiamma “Add link” bookmarklet (now there are _two_ of them!)

Now I have a bookmarklet that gets triggered when I’m on a page I want to bookmark. It window.open()’s to the wiki page named after the page title and passes two parameters to the template: the title and the URI of the page. The template gets preloaded1More here: https://www.mediawiki.org/wiki/Manual:Creating_pages_with_preloaded_text .

The template itself looks pretty trivial. (Note to self: Templates are case sensitive?!)

Then we get a page with an URI and a title. I fill the additional values like this:

Then I run the bookmarklet, which transform it to the following:

Then I could add something, and then save it.

The new bookmarklet now understands an unlimited number of keywords and categories.

The updated bookmarklet:

Todo:

Make it check for bad characters (think “|”, which mediawiki doesn’t like in names and parameters, and everything else here: https://www.mediawiki.org/wiki/Manual:Page_title; make it do something for empty titles, so I don’t get redirected to the main page; put together all of this and upload it to github?

The final bookmarklet looks like this:

Unrelated to the above:

Apparently, after N years of studying programming and tweaking/optimizing whatever incarnation of my workspace, I’m getting it. Like, you can really solve your own problems by writing your own code?! Wow!

What happens next? I’m gonna go around writing extensions and stuff? How was the quote: “Be a man, write your own drivers!”

Regardless, this small and dead-simple bookmarklet that solves my own problems has done much more for my motivation than anything else I’ve ever tried in the last couple of years.

Wohoo!

(Y)

Footnotes   [ + ]

“The puzzle of motivation” TED Talk – notes

To put it mildly, I didn’t do very well. I, in fact, graduated in the part of my law school class that made the top 90% possible.”

“The key is to overcome what’s called functional fixedness. You look at that box and you see it only as a receptacle for the tacks. But it can also have this other function, as a platform for the candle. The candle problem.”

  • External motivation works only for simple left-brain tasks; it’s counterproductive for tasks requiring lateral thinking. (“I’m going to time you to establish norms” vs “If you’re the fastest we’re testing here today, you get $20”)
  • Carrots and sticks work mostly for easily outsourceable jobs

“reward actually narrows our focus and restricts our possibility.”

Think about your own work. Are the problems that you face, or even the problems we’ve been talking about here, do they have a clear set of rules, and a single solution? No. The rules are mystifying. The solution, if it exists at all, is surprising and not obvious. Everybody in this room is dealing with their own version of the candle problem.”

It makes me crazy. And here’s the thing. This is not a feeling. Okay? I’m a lawyer; I don’t believe in feelings. This is not a philosophy. I’m an American; I don’t believe in philosophy.”

  • “autonomy, mastery and purpose. Autonomy: the urge to direct our own lives.Mastery: the desire to get better and better at something that matters. Purpose: the yearning to do what we do in the service of something larger than ourselves. These are the building blocks of an entirely new operating system for our businesses.”

 

  • Those 20th century rewards, those motivators we think are a natural part of business, do work, but only in a surprisingly narrow band of circumstances.
  • Those if-then rewards often destroy creativity.
  • Three: The secret to high performance isn’t rewards and punishments, but that unseen intrinsic drive– the drive to do things for their own sake. The drive to do things cause they matter.

RELATED:

Intrinsic VS Extrinsic motivation @ p2pfoundation

Милан Кундера — “Искусство романа”

Хочу возродить древнюю графоманскую традицию писать несколько строчек о прочитанных книгах. В первую очередь, это навеяно вот этого плана списками правил, но еще — мне необходимо бороться с этим вечным стремлением проглотить-и-ничего-не-запомнить. Книга, лично мне, ценна ровно настолько, насколько она что-то после себя оставила — я вот хочу ей в этом помочь. Смысла во всех пометках очень мало, если потом они так и остаются пометками на полях. А еще — мне нужно лучше учиться выбирать важное или хотя бы интересное мне. Надеюсь, что переписывая, я еще раз задумаюсь на счет того, действительно ли настолько важен этот отрывок.

Мне нужно создать лучшую систему анализа прочитанного. В первую очередь для развития навыков анализа и соотношения с остальным, развития концентрации, способность видеть вещи в контексте. Сейчас много работы идет зря, много времени теряется, мало запоминается — я не удовлетворен, в общем. Пусть это будет условным началом.

Continue reading “Милан Кундера — “Искусство романа””