A trick to avoid Arduino IDE

For better or for worse, I am an EMACS guy. It’s a good, comfortable fit, considering that EMACS stands for “editor for middle aged computer scientists”.

I also like a lot of Arduino compatible hardware, and leverage libraries and code posted by others to get things done – or at least started – faster.

The Arduino IDE has some nice little bits and pieces that I like:

  • Easy management of support for lots of different boards
  • Easy management and updating of libraries
  • Quick access to serial monitor resistant to plugging/unplugging the board
  • Lots of great code contributions that work well within the environment

I looked around for a way to develop Arduino code in EMACS, and there are a lot of possibilities, but they all required rather a lot of setup and maintenance and removed some of the advantages of the IDE mentioned above.

So, I came up with a low-tech solution. All of my “.ino” sketches look like this:

#include "src/main.h"

void setup() {
  arduino_setup();
}

void loop() {
  arduino_loop();
}

This is what src/main.h looks like:

void arduino_setup(void);
void arduino_loop(void);

Then, I just put all the code in main.cpp or include it from elsewhere in src/, and use the IDE only for compiling, loading and monitoring. All the steps for including exotic libraries or new boards, etc. are usually covered by the developers providing the code or libraries for the Arduino IDE environment, but I can live happily in EMACS most of the time.

How I use Notion on i3wm

This is a quick guide on how I use Notion on Linux, with i3wm.

My particular setup involves:

  • Run notion.so in Chrome app mode
  • Keep the notion window in the i3wm scratchpad so I can pop it up when I need it using $mod+n
  • Adjust the interface size for a high resolution monitor

Command line to run Notion as an App within Chrome


#!/bin/sh
google-chrome --force-device-scale-factor=1.5 --user-data-dir=.config/google-chrome-for-notion/ --app=https://notion.so


I launch this from rofi, but you could also bind it to a key or launch it from dmenu or a shell. It should be in your $PATH somewhere. I keep it in ~/bin.

Note that it starts Chrome in app mode and using a different configuration directory. Start with a blank one, and Chrome will fill in the rest. You will have to log in to everything on Chrome again (only the first time), as this is a different instance of Chrome from your usual one. This is intentional so that the Notion window does not interfere with your regular Chrome windows.

Configuration lines for .config/i3/config

Make Notion open directly in the scratchpad

for_window [class="^Google-chrome" instance="^notion"] floating enable, move scratchpad, scratchpad show

Shortcut key to bring Notion to the foreground

bindsym $mod+n [class="^Google-chrome" instance="^notion"] scratchpad show
This also hides it again if it is open.

Usage

After i3wm has started, launch Notion inside Chrome according to the command line above.
Use mod$+n to open and close Notion as you need it. I tend to keep a running journal page open and add notes to it as I do other things.

A limit to immortality

Our perception of time seems to become compressed as we age. A year was an eternity when I was young, and now they just fly by. Let’s assume this effect is real, and can be quantified. Now add an idea from neurobiology. I learned from Sam Harris that there is a non-zero time interval between the moment the brain arrives at a conclusion, or makes a decision, and the moment we perceive it. This is one of his main arguments in “Free Will”.

So, qualitatively, if there is a continued shortening in the perception of time as we age, and there is a non-zero time interval for us to perceive the results of our own thoughts, then, if we were immortal, at some point, our perception of that time interval would be less than the interval itself.

We would not notice the passage of time anymore, and thus effectively cease to be immortal. We may continue living, but we wouldn’t notice it!

I’ll do the math and come back later.