Monday 11 December 2017

Set git ssh auth on linux

Trivial story, but... Sometimes simple things are made very difficult.

Say your user is john. Put to /home/john/.ssh/github (c:\Users\john\.ssh\github\ or %USERPROFILE%\.ssh\github\ on windows) your private ssh key, set access mode read/write to just your user (chmod or, say, in Double Commander). You generate this key file through, say, PuttyGen. Then, in /home/scd/.ssh (ssh_config in c:\Program Files\Git\etc\ssh\ on windows) create a ssh_config text file and put there:

Host github.com
    IdentityFile ~/.ssh/github/private-ssh

On windows: add AddKeysToAgent yes to the beginning, change ~/ to the value of %USERPROFILE%/. On Windows, this referenced key file needs to be converted to OpenSSH format.

Done.

Monday 15 September 2014

Nginx service failover to 1x1 gif with timeout

That's what I love nginx for. Really simple and declarative. At 8086 we have a service that is non-stable, at 8091 there is virtual gif substitutor. On 300ms timeout there will be 1x1 gif as a response. Nginx resides on 8090 for presentation.

http {
  include mime.types;
  default_type application/octet-stream;
  upstream backend {
    server localhost:8086;
    server localhost:8091 backup;
  }
  server {
    listen 8090;
    server_name localhost:8090;
    location /sf.gif { empty_gif; }
    location / {
      proxy_pass http://backend;
      proxy_next_upstream error timeout
        invalid_header http_500 http_502 http_503
        http_504 http_403 http_404;
      proxy_connect_timeout 300ms;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For
        $proxy_add_x_forwarded_for;
      proxy_redirect off;
    }
  }
  server {
    listen 8091;
    server_name localhost:8091;
    location / {
      rewrite ^ http://localhost:8090/sf.gif redirect; }
    location ^ {
      rewrite ^ http://localhost:8090/sf.gif redirect; }
  }
}

Saturday 17 May 2014

Efficient RAW processing

Don't struggle with RAW any more, there is a solution:
  1. Superfast view and choose best RAW shots by ranking: http://www.fastrawviewer.com/. Just download and use all the time. Released 3 days ago, I'm really happy. Very fast.
  2. Extract JPEG previews from your RAW: http://www.picurl.org/blog/2009/07/18/ultra-fast-raw-to-jpeg-conversion-with-exiv2/. In short, if you are a Nikon-guy, then get exiv2 and typically run exiv2 -ep3 *.NEF on your folder.

Thursday 1 May 2014