A fresh Yosemite installation

I just did my first fresh install of Mac OS X (Yosemite) in years and am writing this as a note to self + some possible help for people running in to the same problems as I have.

Box.net sync

Will not install since it wants to put stuff in /Library/PrivilegedHelperTools/com.box.sync.bootstrapper/, but can’t create that dir if i does not exist. So you have to create it.

Keyboard Maestro, Jitouch and others

In Yosemite, applications bundled inside an application or preference pane can’t add themselves to the Accessibility list in the Privacy preferences. To add them, you must browse to the bundled app, then unlock the Privacy preference pane, and then drag the app into the list.

LaunchBar 6

Settings etc. can be found in ~/Library/Preferences/at.obdev.LaunchBar.plistand in ~/Library/Application Support/LaunchBar. Just need to copy these.

Keyboard Maestro

Keyboard Maestro can sync macros via Dropbox. Just need to enable it in the app.

MailTags / Mail Act-On

These apps can also sync their settings via a folder synced using e.g. Dropbox.

iTerm 2

Color schemes can be exported.

Typinator

Expansions (Sets) can be synced via Dropbox. Just go to preferences and change the location of the sets to a new folder in Dropbox and Typinator will ask if you want to copy the existing ones to that folder. Then you just use that folder on the other computer.

Hazel

Rules can be exported.

Advertisement

Screenlog

I created a small script a while ago that takes a picture of my desktop, resizes it and stamps the current date and time to it using ImageMagick. I run the script using a launch agent that runs every 45 seconds.

Afterwards, I create a movie from the screenshots using another script and ffmpeg. Here is the GitHub repo if anybody wants to use it.

My motivation for creating the script was to be able to quickly view my day infront of my screen to see what I did during the day. Especially when I feel that I was not very productive. Also, it helps me remember a day – seeing what I did gives me clues to what I was thinking during the day.

GitHub Repo: https://github.com/fnurl/screenlog

Sova eller stänga av?

Jag postade en bild på Facebook igår där min Mac hade en upptid på 34 dagar och fick då en kommentar kring miljöaspekten på det hela. Eftersom jag har en laptop så stängs locket på den efter arbetsdagen och den tas med hem för eventuellt kvällsarbete. Normalfallet är dock att den inte öppnas förrän nästa morgon. Upptiden handlar alltså för min del om tid sedan senaste omstart, snarare än tid som den varit på. Man kan ju dock undra om det är bättre att stänga av den eller låta den vara på? Nedan följer resultatet av en undersökning i form av omskrivna kommentarer:

Jag har levt med föreställningen om att det inte är så mycket ström som dras när datorn sover, bara tillräckligt mycket ström för att minnet ska finnas kvar – allt annat är avstängt (skärm, CPU, hårddiskar), så det borde inte gå åt så mycket alls. Tänker man i batteritid, så kan den ju sova i dagar, så det är ju inte så mycket som dras.

Ur ren miljösynpunkt finns det nog dock en gräns för när det lönar sig att stänga av datorn snarare än att låta den sova eftersom min Mac. Den tar mänligen ganska lång tid på sig att kallstarta (mest alla program som jag drar igång), så att det finns ganska många minuter av hög strömförbrukning.

Vet dock inte hur många timmar det i så fall skulle röra sig om – dvs när det blir vettigare att stänga av än att låta den sova.

Därför gjorde jag en liten undersökning. Jag lät datorn sova mellan igår 17:07 och idag 07:32 och såg att det gick åt 767 mAh från batteriet. När datorn är igång drar den mellan 1.3A och 1.7A (mellan ~10.5V och 11.5V). Antar att batteriet ligger på 12V, så approximation ger att 767mAh skulle ha räckt i ca 30 minuter.

Jag provade sedan att stänga av och sätta på den för att se hur mycket el som används. Det tar nästan exakt 30 minuter för mig att stänga ner, sätta på, logga in, och sen dra igång alla mina småprogram (dropbox, google drive, etc som går på automatiskt) + mail och webbläsare (som minimalt antal program för att jobba) på min dator (inte SSD).

Batteriet låg på 3092mAh när jag började stänga ner och när jag fick upp webbläsaren låg den på 2169mAh, dvs en förbrukning 923mAh. Så just i detta fall, skulle det ha förbrukats mindre el genom att använda “sova”.

Brytpunkten, baserat på dessa mätpunkter ger att jag borde stänga av datorn om jag inte ska använda den på 17,35 timmar!

Det är ju inte en uttömmande undersökning, men borde ju i alla fall ge en pekare på elförbrukningen för just mig och min dator som jag använder den idag.

Kränkning genom tiderna

Intressant om dåliga historiekunskaper, vad som kränker folk och den moderna versionen av personlig integritet i ett historiskt perspektiv.

Det jag tyckte var intressant var hur kränkningsförfarandet gått från rivirkränkning (som kräver en rivirkultur), personliga påhopp (som kräver en individkultur), till hederskränkning (som kräver ngn form av hederskultur), till kränkning av kollektiv (som kräver identifiering med ett kollektiv) till det vi har nu, åsiktskränkning – som alltså kräver en åsiktskultur! Det känns som att vi rest en del när det gäller samhällsutveckling för att nå dit vi är idag. De flesta andra kränkhetsgraderna finns ju fortfarande kvar i någon form idag (t.ex. påhopp av favoritlag i ngn sport etc).

Vad är nästa fas i utvecklingen av identitet? Jag är min … 🙂

Läs den era fegisar!

http://magasinetneo.se/artiklar/krankta-av-fakta/

Why rewarding “correct” actions is good

Here is an example of what can happen if a system rewards incorrect actions: Giving bar ratings to make comments visible. The linked post gives examples of people giving one star ratings to make their comment visible. This behavior is not that weird actually if one looks at the motivation of people who write reviews; these people write reviews not to be kind to a developer, but to share their opinion. Their motivation to write the review is to have other people read them. So if the system shows 1 star
comments more than 5 star comments, the way to get other people to read your comment is to give the app a 1 star review.

Good example of the importance of looking at more than just usability when building software and ecosystems.

Jumpstarting NiMH batteries that won’t charge

WIN! I had a few NiMH batteries that my charger would not charge. I thought they were broken, but found out that you can sometimes jump charge them a bit and they work again.

So I hooked up an DC adapter set to 12v to them for 2 seconds and then put them into the charger and now they are charging again!

Update: A note for future reference — positive to positive, negative to negative.

20140106-103615.jpg

20140106-103652.jpg

Append to attribute values using jQuery

Quite a productive day today, here’s another note to self containing a nice jQuery snippet that appends a string to a given attribute of a certain tag. I got the snippet from stackoverflow (of course).

<script>
  $.fn.appendAttr = function(attrName, suffix) {
    this.attr(attrName, function(i, val) {
        return val + suffix;
    });
    return this;
  };
</script>

I am doing some content work in a mixed php/perl/legacy web environment. I added some code to the part of the system that I have access to that hides the content I am working on unless I add a &preview in the URL. Because I part of the system that generates the menus, I had to add the &preview manually. This snippet allows me to stay in preview mode once I have entered preview mode.

<script>
  $( document ).ready(function() {
    if (window.location.href.match(/&preview$/).length > 0) {
        $( "a").appendAttr('href', '&preview')
    }
  });
</script>

Yay.

Zotero + Ulysses 3 + pandoc workflow

Ok, just a quick post as a note to self on my Ulysses 3 + Zotero workflow:

Zotero settings

Zotero has a hidden preference setting called extensions.zotero.recursiveCollections (or just recursiveCollections if using the desktop version). Setting the value of this to true, instead of the default false value, selecting a folder also displays the contents of its sub-folders. I think this behaviour makes sense for a document management system (where finding a document is more important than knowing where it resides).

To change the value of extensions.zotero.recursiveCollections, just go to about:config, find the preference name and then double click the value.

Login over SSH using SSH key

I just set this up and it works like a charm. However I imagine that I won’t be doing this every day, so I am writing this note to my future self.

How logging in on a remote server using an SSH key works (intuition)

This is sort of my non-expert, but technically viable understanding of how all of this magic works.

  1. Create a pair of keys using the command ssh-keygen – one public key, and one private key.
  2. Upload the public key (that can be used to confirm the identity something generated using of the private key I believe), to the server (each user has a ~/.ssh/authorized_keys on the server).
  3. Make sure the .ssh directory on the server is only readable by your user.
  4. Make sure the directory where you store your key pair on your local computer is also only readable by you.
  5. When logging in, point ssh to use your private key, for the correct user on the remote server.

Commands

Create your ssh key pair using

ssh-keygen -t rsa -b 2048 -f ~/.ssh/id_rsa -C "Enter an optional comment about your key"

You can use another name than id_rsa. A public companion with the suffix .pub will also be created. You do not have to enter a passphrase, e.g. when using the key via a script.

Protect your local .ssh directory using the following:

chmod 700 ~/.ssh && chmod 600 ~/.ssh/* 

Upload the public key via ssh:

cat ~/.ssh/id_rsa.pub | ssh user@remote-server.com 'cat - >> ~/.ssh/authorized_keys'

Protect the .ssh directory on your remote server (remote shell) using:

chmod 600 ~/.ssh/authorized_keys && chmod 700 ~/.ssh/

Login using

ssh -i ~/.ssh/id_rsa user@remote-server.com

where id_rsa is your private key.