Category Archives: General

How to set up free Obsidian notes synchronization on macOS

TLDR: get SparkleShare and configure it to synchronize your Obsidian vault(s) with Bitbucket.

Add your notes to the cloud

1. Start by downloading SparkleShare from https://github.com/hbons/SparkleShare/releases

2. Register a free account at https://bitbucket.org/ if you don’t have one. Create a new private repository for your vault. The name can be “obsidian-notes”.

3. Open SparkleShare and click its icon in menu bar, select “SparkleShare -> Computer ID -> Copy to Clipboard”. Now go back to Bitbucket at https://bitbucket.org/account/settings/ssh-keys/ and add new SSH key, and paste key’s value from the clipboard.

4. Back to SparkleShare in menu bar, click “SparkleShare -> Sync remote project” and follow the wizard to add Bitbucket repository.

5. Copy your existing notes from your vault into a newly created sync folder. In Finder, click on your home folder, then “SparkleShare”, then “bitbucket.org” and finally your repository’s name e.g. “obsidian-notes” (see step 2) – this is a folder that SparkleShare watches for changes and keeps in sync.

6. Now use Obsidian to open your notes from this new folder, not the old one, otherwise SparkleShare will not be able to synchronize the files.

Add your notes from the cloud to a new computer

When you already have Obsidian vault on one computer (A) with SparkleShare set up to store notes in Bitbucket and you want to add those notes to another computer (B). Here’s what you need to do (all on computer B):

1. Install SparkleShare, start it.

2. Log in to your Bitbucket account and go to https://bitbucket.org/account/settings/ssh-keys/

3. In menu bar, click SparkleShare icon, then in menu “SparkleShare -> Computer ID -> Copy to Clipboard”.

4. Go back to Bitbucket page, add new SSH key to your account and paste it’s value from clipboard.

5. In menu bar, click SparkleShare icon, then “SparkleShare -> Sync remote project”, follow the wizard to add your repository, and don’t forget to check “Fetch prior revisions” to download existing notes.

Warning

You might want to create a totally separate account just to synchronize your notes. So you’ll create a notes repository on your main account, but add SSH keys to your notes account. Afterwards give access to your notes repository for the notes account.

This way SparkleShare’s SSH keys will not allow access to your main account’s repositories except when you specifically allow them to. Bitbucket’s free tier has up to 5 users per repository, so synchronization still should be free.

mac OS tip – add shortcuts to (almost) any application

Just a note for myself. It is possible to add a global shortcut for any UI app in mac OS using System Preferences.

I am using Notes app extensively to manage my notes and TODO lists. Sometimes instead of checking the TODO item I need to mark it as unneeded, then I like to use a Strikethrough text. Notes does not have a shortcut defined for this text style and I kept jumping through the menus.

Finally figured out the way to assign a key binding. Here’s how to do it:

  1. Open System Preferences and go to Keyboard → Shortcuts;
  2. Go to App Shortcuts in the left list and click “+” below;
  3. In the Application dropdown select Notes.app (or other app you need);
  4. Type in or paste exact menu item name in Menu Title – this is just the item name, not the full path to it. In my example it’s “Strikethrough” (no quotes);
  5. Click in Keyboard Shortcut input and then press which shortcut you’d like to assign, I picket Cmd+Shift+S (⌘+⇧+S).
  6. Press Add and you are all set, the shortcut is immediately active and ready to use.

If something goes wrong, make sure the app and the menu title are correct.

Book review: SQL Performance Explained

Overall: 9/10

Good parts

In-depth explanation of database performance concepts and pitfalls for all current major relative database engines. Goes over indexes, how to use them properly and why they might not be used during query execution. This can be used as an introduction but also as a handbook for everyday work.

Missing

Wish the author would include answers for “Think about it” questions in the appendix, so readers could check themselves.

Facebook be gone

Productivity can sometimes be hard. Especially when you have facebook accessible on all your devices. I have killed their app from my iPhone ages ago, but still manage to use it in the browser. And if you started looking through the feed, it never ends. But this had to stop.
First, I tried iOS built-in website blocker, but you just cannot block one site, there is an entire black list and I grew tired of it. It was the time for more elegant solution (for civilized age).

So here’s my “Almost Instant Productivity Boost”™ for you iOS device: https://github.com/alexzabolotny/NoMoreFacebook . Yes, it’s a custom iOS content blocker, which only kills facebook. Yes, you have to have Mac and XCode to install it. No, you cannot download it from App Store. Yes, because I don’t have money to pay for the license.

Oh yeah, just use /etc/hosts file to block facebook on your Mac (link to google).

Unfortunately, I was lazy, so Login with facebook will also be gone. Which is a pity, but I don’t care. If you care – just send me a PR.

Car

Some time ago we got a new car. It’s Mercedes-Benz B-class again, but a bit newer. However, this new car has some bugs.

First thing that i’ve notice is that rear view mirror if switched to ‘night mode’ has different angle, so every time we go from ‘day’ to ‘night’ or back we need to adjust it.

Another thing is even better. Sometime in the morning it give us a message in red: ‘Reversing not possible. Consult workshop’. And reverse gear is indeed does not work. Moreover it only uses odd gears from now on: 1-3-5-7, and revs are usually very high as well. At first we were really upset and even got it to the workshop. Needless to say, they did not fix or even detected the problem. However it persists. Right this morning we had the message again. Luckily there is a workaround. Yes, you just need to reboot it. Twice. Turn off, take out the key, start again. Repeat. And the message is gone, plus gearbox is working with all gears now. Simple fix.

Heroku, golang and martini

Just a note to myself. When deploying go + martini project to Heroku, there was an error:


remote: -----> Running: godep go install -tags heroku ./...
remote: www.go:3:8: cannot find package "github.com/go-martini/martini" in any of:
remote: /app/tmp/cache/go1.4.2/go/src/github.com/go-martini/martini (from $GOROOT)
remote: /tmp/build_ea6105408e12a560374800681cccb8e2/.heroku/g/src/gggggg/Godeps/_workspace/src/github.com/go-martini/martini (from $GOPATH)
remote: /tmp/build_ea6105408e12a560374800681cccb8e2/.heroku/g/src/github.com/go-martini/martini
remote: godep: go exit status 1

To fix it I had to force Godeps/_workspace folder into git repository, since Heroku buildpack expects dependencies to be delivered with app code.

Mailcatcher to test your email subsystem

You have probably heard of Mailcatcher already. It’s a great piece of software that implements neat idea.
I am using Vagrant and Apache on Debian, so my development box is build using puphpet.com. It allows mailcatcher installation btw, but we’ll do it manually and with a step forward:

  1. Get sqlite3 development libs: sudo apt-get install libsqlite3-dev;
  2. Got ruby? Install mailcatcher: sudo gem install mailcatcher;
  3. Now, let’s make it running after box restart:
    • Create /etc/init.d/mailcatcher script with this code:
      #! /bin/sh
      
      ### BEGIN INIT INFO
      # Provides:          mailcatcher
      # Required-Start:    $all
      # Required-Stop:     $network
      # Default-Start:     2 3 4 5
      # Default-Stop:      0 1 6
      # Short-Description: Start daemon at boot time
      # Description:       Enable service provided by daemon.
      ### END INIT INFO
      
      PID_FILE=/var/run/mailcatcher.pid
      NAME=mailcatcher
      PROG=/usr/local/bin/mailcatcher
      USER=mailcatcher
      GROUP=mailcatcher
       
      start() {
      	echo -n "Starting MailCatcher"
      	if start-stop-daemon --stop --quiet --pidfile $PID_FILE --signal 0
      	then
      		echo " already running."
      		exit
      	fi
      	start-stop-daemon \
      		--start \
      		--pidfile $PID_FILE \
      		--make-pidfile \
      		--background \
      		--exec $PROG \
      		--user $USER \
      		--group $GROUP \
      		--chuid $USER \
      		-- \
      		--foreground
      	echo "."
      	return $?
      }
       
      stop() {
      	echo -n "Stopping MailCatcher"
      	start-stop-daemon \
      		--stop \
      		--oknodo \
      		--pidfile $PID_FILE
      	echo "."
      	return $?
      }
       
      restart() {
      	stop
      	start
      }
       
      case "$1" in
      	start)
      		start
      		;;
      	stop)
      		stop
      		;;
      	restart)
      		restart
      		;;
      	*)
      		echo "Usage: $0 {start|stop|restart}"
      		exit 1
      		;;
      esac
      
    • Make the script executable: sudo chmod +x /etc/init.d/mailcatcher;
    • Create the user: sudo adduser mailcatecher;
    • Add the script for upstart: update-rc.d mailcatcher enable;

Ok, so mailcatcher will run at startup, but will not be visible at host machine. Now, you can do it just by forwarding guest’s 1080 port to host’s 1080 port using Vagrant config. But it didn’t work for me for no apparent reason. And i am not a big fan of typing in port numbers into browser address bar. So next steps will solve that:

  1. Create a new Apache “site”, let’s say “/etc/apache2/sites-available/35-mailcatcher.conf“;
  2. Let’s use Apache proxy module to let us access to mailcatcher (on port 80). Add this to the newly created “site” file:
    <VirtualHost *:80>
         ServerName mailcatcher.local
         ProxyPass / http://127.0.0.1:1080/
         ProxyPassReverse / http://127.0.0.1:1080/
    </VirtualHost>
    
  3. On your host machine update /etc/hosts file with this line (replace %GUEST_IP% with your Vagrant box IP address):
    %GUEST_IP% mailcatcher.local
    
  4. Enable mailcatcher site with a2ensite command, enable proxy module with a2enmod proxy_http command and restart apache;
  5. Point your browser to http://mailcatcher.local and your should see mailcatcher interface.
  6. If you see 503 error, it’s probably because mailcatcher did not start.

    Oh, yes, refer to the manual on how to add support to your language of choice. For PHP it’s simple:

    ; php.ini
    sendmail_path = /usr/bin/env catchmail -f [email protected]
    

The Stanley Parable

Oh i have written code today, alright. Whole day. Cracked the nut just two minutes before six. What a joy, when you do something that actually works, despite all odds and… inconveniences (i don’t want to rattle again about how “good” open source products sometimes are, there are too much complains in this blog already, and besides, i could just go and fix it instead of mumbling, it is free after all).

So instead, i would rather tell about the game. It’s called The Stanley Parable. And it is simply brilliant. The problem i face is that this is all i can tell you about it. Go play.