måndag 28 augusti 2017

How to show nicely formatted source code in your blogger posts

I haven't dug deep into this, but so far the site below has been enough.

http://codeformatter.blogspot.se/

  • Copy and paste the code you want formatted into the top form
  • Click "Format Source Code" button
  • Copy the generated html code and paste it into your post in html mode

Time to clean up the repo? Commands to list and sort git branches

As a preparation for a future branch cleanup in our git repos at work I googled for and tried a few branch listing and sorting commands that might come in handy.

List branches 
sorted by last commit date
 git for-each-ref --sort=committerdate refs/remotes/ --format='%(committerdate:short) %(refname:short)'  

Example result
 2016-09-05 origin/PBI-0096  
 2016-10-02 origin/PBI-146   
 2016-11-25 origin/PBI-1320  

List branches 
with age and last committer name 
sorted by last commit date
 for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r  

Example result
 2016-10-06 16:17:17 +0200 11 months ago by Harry Potter     origin/PBI-88  
 2016-10-05 14:24:24 +0200 11 months ago by Joe Labero    origin/PBI-146  
 2016-09-02 12:10:17 +0200 12 months ago by Nicola Tesla    origin/PBI-0096  

List branches 
with age and last committer name 
sorted by last committer
 for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --pretty=format:"%Cred %cn %>|(40) %Cblue %ar %>|(80) %Creset" $branch | head -n 1` $branch; done | sort -r  

Example result
 Harry Potter 3 days ago origin/PBI-5124  
 Harry Potter 8 weeks ago origin/PBI-4584  
 Harry Potter 2 days ago origin/PBI-5129  
 Joe Labero 7 weeks ago origin/PBI-4590  
 Joe Labero 6 weeks ago origin/PBI-4742  

onsdag 9 augusti 2017

Anyone else having the same kind of double vision?

I think I've had double vision for a long time, but maybe it has become worse the last five years or maybe it just has started to bug me more than before.

Here are two examples that show how text can appear for me.

Here are some characteristics of the phenomenon:

  1. The duplicate image is less prominent than the original image, it's like a shadow of the original image. The color of the duplicate looks like a washed-out version of the original.
  2. The duplicate image always appear moved upwards compared to the original.
  3. The duplicate appear the same when using both eyes or one eye at a time, regardless of which eye I look with.
  4. The farther away from the original I am, the higher up the duplicate appear.
  5. The duplicate disappears when looking through the top edge of the glasses. Looking through a small hole also makes it disappear.













I've been to an ophthalmologist three times. The first time he suspected an incipient cataract or keratoconus (a bulging cornea). But after my two revisits both those suspicions got depreciated. And no new ideas came up :(
I also have a minor squint, but that can't be the source of the problem since the duplicate appears even when I look with one eye at a time.

I don't know the exact strength of my glasses, but it is around -6 for both eyes. The values for the astigmatism correction I have no clue about, have to check it up...

The double vision really bugs me when:
  • Trying to help someone with his code by sitting beside him and look at the code on his monitor from the side. The duplicate characters make the code unreadable.
  • Meeting persons on the street. Since faces also get distorted by the double vision, it makes it hard to know if it's a person I know or not until coming pretty close.
  • Looking at subtitled movies on the TV
  • Driving in darkness, it's hard to read signs from far away

So, since both the ophthalmologist and the optician are clueless, it would be nice to know if anyone else has experienced this, or even better, if anyone knows what it could be and how to fix it!