Migrating to Obsidian

Recently someone released Foam for VSCode on Obsidian, it led me down a rabbit hole of Second brain and Zettelkasten method. In short: it’s an enhanced mindmap with text, images and link between articles

Sound similar to a wiki? Yes. Shall I try out this new thing? Also yes.

So I started to Migrate all my notes to Obsidian, an excellent implementation of this idea (and it’s free for personal use).

My notes a scattered between SimpleNote, Google Keep and OneNote

Migrating from SimpleNote

You can export your notes to HTML from the web app. Then convert HTML to MD with pandoc

Migrating from Google Keep

You can use google Takeout to export your Keep notes to a bunch of HTML files, then use pandoc. You may need to edit the resulting md files a little bit. VS Code is an excellent tool for this

Migrating from OneNote

This is where most of my notes are, and is the most involved. You need

  • A Windows machine
  • OneNote Office Version (not the Windows Store version)

Use this script https://github.com/rab-bit/ConvertOneNote2MarkDown4Obsidian and follow the instruction. This is an updated version of the original script here with various bugs fixed.

ssh-add tricks

 

From spike (https://stuff-things.net/2016/02/11/stupid-ssh-add-tricks/)

Listing

You can list the currently loaded keys with -l and -L. The former displays the keys’ fingerprints while the latter displays the entire public key. Both list the path of file the key came from, which it the only way I recognize them.

Deleting.

ssh-add -d file removes the key the file from the agent. ssh -D clears out all keys, taking you back to square one.

Locking

You can simply run ssh-add -D to remove all of your keys from the Agent, but then you have to go through the trouble of adding them back. However, if you just want to step away and make sure your keys are protect, you can use ssh-add -x:

1
2
3
4
% ssh-add -x
Enter lock password:
Again:
Agent locked.

The Agent still has your keys, but won’t allow them to be used until unlocked with ssh-add -X:

1
2
3
ssh-add -X
Enter lock password:
Agent unlocked.

Expiring

Instead of locking your keys, you can set an auto-expiry with -t after which the key will automatically be deleted from the agent:

1
2
3
4
ssh-add -t 60  ~/.ssh/random_rsa
Enter passphrase for /Users/spike/.ssh/random_rsa:
Identity added: /Users/spike/.ssh/random_rsa (/Users/spike/.ssh/random_rsa)
Lifetime set to 60 seconds

OS X Specific

On OS X ssh-add is integrated with the system keychain. If you give the -K option, as in ssh-add -K, when you add a key, that key’s password will be added to the keychain. As long as your keychain is unlocked, a key that has been stored in this way doesn’t require a password to be loaded into the agent.

All keys with their password stored in the keychain will automatically be loaded when you run ssh -A. This happens automatically on login.

I have mixed feeling about this feature, preloading your keys makes life easier, but it does remove a layer of security. If someone access your Mac, they get your keys. On the other hand, the probably get a lot of other things too. Typically, I take the lazy approach for everyday keys and keep the high-security ones out of the keychain.

When a password has been stored in keychain, ssh -K -d key-file both removes the key from the agent and removes it password from the keychain. Without -K, -d does not change the keychain and the key can be reloaded without a password. -D silently ignores -K.

There you have it, a pretty small but surprisingly helpful set of features, you now have in your bag of tricks.

Things to note when developing on Android

Putting files onto the emulator

There are two: using adb (see below) and through file explorer (in ADT)

File explorer

Oh, and one file at a time only

Update music

Maybe on real phones, there’s supposed to be an Intent to process your music files when they are copied over to the device. The emulator doesn’t do this, so any music you threw in using the file explorer won’t show up in your “Music” or “Media” application (depends on the version).

You have to start developer tools > Media scanner to scan for music files

Media scanner

Controlling the emulator

There’s more to the emulator than what your can control with ADT. ADT is quite nice to use, but it only let you:

  • Simulate incoming SMS and call
  • Simulate geolocation
  • View / terminate processes
  • Manage files

Actually you can use several tools that come with the SDK and talk to the emulator itself to get more out of it. To connect to the emulator, telnet to local host with the port as the emulator’s number (5554, 5556 and so on). These numbers can be used as phone numbers so the emulators can call / SMS each other, but not receive calls from a connected phone.

The list of commands can be found here

Setting the battery to full

There’s a tool called ADB (android debug bridge) that can install packages and put files on to the sdcard. ADB is used internally by ADT itself, but you can use it to manually control the emulator, doing things like setting the telnet listening port, view system log (logcat) or issuing shell commands on the device (alternatively you can do this with Dev tools inside the phone)

Solving errors that appear to came out of nowhere

In addition to usual Java errors like forgetting to add imports, put some files in the wrong folder… Sometimes when you import a project from somewhere (like… from Google’s examples :p), the project turns all red (indicating error), you checked the import, they are there, you checked the classes, they are there, you cleaned the project and rebuild as a routine habit when things go wrong with Android, the errors are still there!

Check your project’s properties (default.properties) to see if the target is right. For example, if you are using 2.2 platform, it should be target=android-8 for 2.1 it should be android-7 and so on… assumed you installed the platform with the AVD manager.

Also, when you change API level requirement in AndroidManifest.xml, the project doesn’t seem to build right and it just can’t run, saying something like “Android requires .class compatibility set to 5.0. Please fix project properties”

You know you need to use this

ADT's magic wand