Skip to main content
Luxian's Notes

Main navigation

  • Home
User account menu
  • Log in
By luxian, 25 July, 2017

How to commit whitespace and coding standard changes in legacy code

The project I'm working on has inconsistency issues when it comes to coding style. Even though it's a Drupal project, it doesn't follow Drupal's coding standards and on top of that the .php files are saved using various character encoding and line endings. This forced me to develop a workflow that I use before changing legacy files which helped me to keep changes history readable.

Committing together a file encoding change, white-space conversion and a bug-fix will be a source of regret if you ever have to look at that diff again. Most likely you will pull your hair out trying to figure out what is a code change and what's only a code style fix. That's why I separate the coding standard fixes in a single commit before doing anything else. This commits will be easy to ignore when checking history and can provide a cleaner diff for the changes that follow.

The steps I follow are:

Tags

  • coding
  • git
By luxian, 19 July, 2017

Disable Apache 2.x logging for favicon.ico or apple-touch-icon

One of the features I like in nginx is the ability to disable logging for certain paths. For example whenever a browser sends a requests for a favicon.ico which doesn't exists the web server will respond with a 404 error but will also write the request to access_log and error_log -- which is totally useless. Most of the time nobody cares about these favicon and apple-touch-icon requests, so logging them is quite useless and is just a waste of CPU cycles and IO throughput.

If you use nginx is quite easy to disable logging for them with something like

location = /favicon.ico { 
  access_log off; 
  log_not_found off; 
} 

But Apache is more tricky to set up, the log configuration is not very straightforward. So here is what I was able to find on this subject after some hours of searching.

Tags

  • server
  • apache
By luxian, 14 July, 2017

Ulauncher is my new favorite app launcher for Linux.

Some time ago I wrote about Mutate. After a few weeks of using it I decided I need something better. Mutate had a major drawback, it couldn't handle properly .desktop files. That means that some apps were displayed with the wrong or missing icon and Chrome Apps did not work. For example when I tried to open Wunderlist (Chrome App) it will open just another Chrome window. It works well if I use normal app menu.

After trying to fix it myself for a while I gave up. The project is almost abandoned on Github.

This is how I ended up installing Ulauncher which works great with .desktop files. So no more issues with opening Chrome Apps or wrong app icons. It's also fast and reliable.

It was very easy to install following the instruction from the Github repository. The only problem I had was the autostart. By default it adds only the following line to autostart:

ulauncher --hide-window

But in my case that location was not in the $PATH variable, so I had to write the full path to Ulauncher in there.

 

Tags

  • linux
By luxian, 14 June, 2017

Drifting with machine learning

These people were able to make an algorithm that can control an RC car to drift in circles and it looks pretty cool: Autonomous Drifting using Machine Learning.

Another experiment like this involves RC offroad car that ends up driving very agressive: Autonomous self-driving RC offroad car 90 mph.

 

 

Tags

  • Machine Learning
By luxian, 9 March, 2017

Extract SSH public key from private key

In the last couple of days I spent a lot of time debugging the deployment script called via GitLab CI. The script worked well on one server (dev), but failed on the second one (prod).

GitLab CI was using a docker container with an injected SSH private key to connect to server and run some scripts. The whole setup was exactly as described in the official tutorial. From the beginning I was surprised to see that public key was never added to the container. But since it did the job well  I didn't spend too much time to see how it actually works.

When I tried to make deployment work for a second server, things didn't work so smoothly. It refused to connect over SSH. After some digging and with ssh debugging enabled it was clear that the public key used by CI container was missing from the authorized_keys file on that server. The authorized_keys file was big on the first server, the one that work, and I had no idea which key was the one I needed to copy over. So I tried to see if I can extract the public key from the private key. To my delight, this seems to be a very easy task. You just need to run the following command:

ssh-keygen -y -f ~/.ssh/id_rsa

Where ~/.ssh/id_rsa is the file with your private key. This command will print the associated public key. With this key in place, the deployment script worked without issues.

Lessons learned:

  • private keys contain the public key so in case you lose it you can re-create it
  • I need a better systems for deploying and managing authorized_keys across all the servers

Tags

  • linux
By luxian, 28 February, 2017

Deep learning gallery: Quadcopter trail navigation

Deep Learning Gallery

I have deeplearninggallery.com in my bookmarks for quite some time but I didn't have time to check until today. As you probably guessed by the domain name itself, it's a gallery with a lot of cool deep learning projects. It's worth checking it out.

To stir your curiosity is a cool project I saw today:

Quadcopter trail navigation in forest

Project goal was to make a drone that can follow a trail through the forest using only one camera (no 3D images). You can see the results in the video. They pretty much did it. If you want to read more, you will find more links in the video description.

 

 

 

Tags

  • Deep Learning
  • Artifical Intelligence
By luxian, 13 February, 2017

Google's AI becomes aggresive in stressful situation

Actually this is not something very new if you have read all the previously recommended links in the article that started this serie "Artificial Inteligence". This new article is proving that depending on environment (how abundant resources are, goal definition and the connections between AI agents) the behavior of AI can be either aggressive or highly cooperative.

The full story can be found in the article Google's New AI Has Learned to Become "Highly Aggressive" in Stressful Situations. Following quotes are from it:

(...) the message is clear - put different AI systems in charge of competing interests in real-life situations, and it could be an all-out war if their objectives are not balanced against the overall goal of benefitting us humans above all else.

(...) the initial results show that, just because we build them, it doesn't mean robots and AI systems will automatically have our interests at heart.

 

Tags

  • Artifical Intelligence
  • Google AI
By luxian, 8 February, 2017

Bye bye Nylas! Hello again Thunderbird!

I'm not sure when I started using Nylas N1, but I think it was almost a year ago. It started as a very promising project. It has all the features I need:

  • multi platform (Windows, OS X, Linux)
  • snooze function (as a free service)
  • nice interface

I switched to it immediately after Mailbox was shut down by Dropbox. The snooze functionality was - and still is - a very cool and useful feature. But until now - no one figured it out how can this be implemented as a free service/mail client. Keeping servers up and running to move emails around is apparently very expensive. Dropbox couldn't afford it and Nylas either. 

The latest changes from Nylas started to remind me about Mailbox. The hype passed and now to company behind it works hard to come up with a business model around it. They switched to a subscription model, which in my opinion is a good decision, but I think the prices are too big. 

$9 per month is too much for a good looking mail client. It doesn't bring much more than the web interface. It doesn't have a mobile app (I hope they don't try to port the Electron app) and doesn't sync your accounts around devices like Mailbox had. I appreciate them for keeping it open source (in theory you can still run it for free if you compile it yourself and run it on your own server).

Maybe we are not ready yet for good email clients if we still need to run them in the cloud. Maybe we have to wait until mail servers like Google Mail/Inbox or Outlook 365 come up with an API that support Snooze/Delay functionality.

Tags

  • mail clients
  • thunderbird
By luxian, 24 January, 2017

Why all world maps are wrong

I think most of the people are already aware that world maps are actually distorted version of reality. Today I found video that explains this better: Why all world maps are wrong

By luxian, 15 January, 2017

What you should know before buying phones from China

Why I don't fall for the cheap phones with top specs from less know phone manufacturers from China

Tags

  • cheap phones
  • china
  • android

Pagination

  • First page
  • Previous page
  • Page 1
  • Page 2
  • Current page 3
  • Page 4
  • Page 5
  • Next page
  • Last page

Pages

  • Contact
  • My tech
  • Wishlist
RSS feed
Powered by Drupal