How to Not Get Scammed by Taxi Drivers in the Israel's Ben-Gurion Airport

tl;dr: use the official taxi service that is right outside the airport, on the left when you leave through the door. You will pay an official fixed price and you will get a slip with information about your driver. Do not ever talk with random taxi drivers who will be waiting in groups and who will be offering you a lift. With international travel becoming cheaper and cheaper, more and more people are travelling to foreign countries. Even though it sucks but it is mathematically inevitable that sooner or later we will run into problems while doing so. So it is only sensible to prepare to deal with these problems beforehand. Especially if they are well known then it makes no sense not to know about them. ...

November 17, 2017 · 4 min · giedrius

Confusion With File Redirection And sudo

Introduction I have noticed that newbies sometimes fail to understand why, for example, sudo echo “hi” > /tmp/test will create a file /tmp/test with whatever effective user ID and effective group ID the command is ran with. They fall into the trap thinking that root:root will be the owner of /tmp/test. However, that is certainly not true. This blog post will try to clarify why this happens and what the user can do to avoid this issue. This occurs due to peculiar parsing rules defined in POSIX. We will examine the standards which detail this behaviour, the source code of the popular shells bash/zsh, and some methods on how to avoid this problem with, for example, tee(1). ...

October 31, 2017 · 6 min · giedrius

Review of Dale Carnegie's "How to Win Friends and Influence People" for programmers

Programmers and IT people are often shunned for being shy, timid, fearful, or just in general - we are being thought of someone who have no social (soft) skills. If you can in any way identify with this sentiment - you definitely would be rewarded deeply for reading this book and implementing the suggested tips in your own life. But let us start at the beginning - who is the author, who is he known for, and so on, and then I will tell you why you should deliciously digest this book. ...

October 25, 2017 · 6 min · giedrius

Making Unwinding Functions in C Simple: Do Not be Afraid of Using Gotos

Intro Today I wanted to talk about unwinding and releasing resources in C functions. Let’s begin by stating that there are three main techniques for handling errors in the C programming language. Sometimes more than one technique may be used. Here is a list of them: You must test the value functions return. Abnormal value indicates that some kind of error has happened and a normal value indicates that it was successful; There is an external variable whose value you must check. For example, the POSIX variant of this is to have an variable called errno that changes to 0 when nothing bad happened and it has some kind of other value when an error occurs; You pass a pointer to a function. The function changes the value of the variable it points to or even calls it with certain arguments if it is a function pointer depending on the result. I have not mentioned one method but some people use atexit(3) to register functions that will be called at the end of a program which will release resources. However, this is unusual so I have not included it in the list.This is very much related to our topic because when an error occurs, you will have to handle it. That process includes releasing the resources which were acquired before in the function. Especially if you are deep down in your function and then an error occurred, the choice that you make in how to release the resources will matter a lot so it is important to make the correct decision. In C++ you have the destructors and so on but how are you going to do that in C? Are you going to sprinkle all of your error paths with: ...

October 22, 2017 · 7 min · giedrius

Do not forget to open 443 port while using ovftool on ESXi hosts and deploying to a vCenter

There is a pretty neat tool called ovftool that makes it easy to deploy an OVA/OVF from any source or extract the contents of an OVA. Ordinarily people would run it on their own machines but it is possible to run it on an ESXi host as well as per these articles: http://www.virtuallyghetto.com/2012/05/how-to-deploy-ovfova-in-esxi-shell.html, https://gist.github.com/ruzickap/fda71997083a41b0c6cd. However, if you tried that and tried to deploy the OVA on another vCenter from an ESXi machine you would have ran into a similar error as per this fictional example: ...

October 12, 2017 · 2 min · giedrius

Ar KAM gali manipuliuoti sugeneruotus skaičius taip, kad į šauktinius būtų pakviesti tik atitinkami asmenys?

Nors man politika atrodo kaip nuobodus dalykas tačiau kadangi šitas liečia ir mane, ir kadangi niekas apie tai nekalbėjo tai nusprendžiau parašyti straipsnelį apie tai kas yra PRNG ( pseudo-random number gene rator arba pseudo-atsitiktinis skaičių generatorius), kaip jis naudojamas šauktinių generavimo programoje ir kodėl tai yra problematiška. Įžanga 2015-aisiais metais Lietuva atkūrė šauktinių tarnybą po agresyvių Rusijos veiksmų Krymo pusiasalyje ir suaktyvėjusios Rusijos karinės veiklos Kaliningrado krašte. Nepaisant to, kad, mano nuomone, tokia loterijos principu paremta tvarka yra palyginti amorali ir neteisinga, egzistuoja ir kita įdomi pusė — pats sąrašo generavimas. Valdininkai visada gynėsi, kad šauktinių generavimas yra visiškai skaidrus ir nekorumpuotas, nes yra visuomenės atstovai, nepriklausomi stebėtojai generavimo metu ir taip toliau ad nauseum. Mums pasisekė, kad pati KAM publikuoja sąrašo generavimo kodą, nes jį išanalizavę pamatysime, kad egzistuoja specialiai palikta spraga, kuria pasinaudojus galima labai lengvai iš anksto numatyti sugeneruoto šauktinių sąrašo turinį. Nesunku bus suprasti kaip tai gali išnaudoti korumpuoti asmenys iš KAM, kad sugeneruotame sąraše neliktų asmenų, kurie, pavyzdžiui, sumokėjo kyšį. ...

September 30, 2017 · 6 min · giedrius

Short tale about proxies and /etc/hosts on GNU/Linux

I encountered an interesting behavior the other day when trying to use HTTP and/or HTTPS proxy on a GNU/Linux machine. cURL and friends read environment variables called http_proxy and https_proxy. So, you are thinking, if one wants to have “global” proxy settings, one just has to create a new executable file that is only writable by root in /etc/profile.d with content like this: #!/bin/sh export http_proxy=”http://1.2.3.4” export https_proxy=”$http_proxy” However, you might just notice an confusing occurrence when trying to use hostnames like localhost to refer to your own machine. Unfortunately, the priority is given to the proxy setting regardless if the hostname is static (i.e. it is in /etc/hosts) and it resolves to a local IP like 127.0.0.1. It could happen that your proxy will be a bit stupid and resolve localhost to its own (or even a different) IP, and then you will get burned because you want to refer to your computer with it, not the proxy IP. It has potential to especially be confusing if the output will be very similar to what you are expecting. This can happen when e.g. you are trying to set up a simple web server on your machine and the proxy responds with a place holder page. I can confess that I fell into this trap but I will not anymore. ...

September 2, 2017 · 3 min · giedrius

On Trustworthiness of Sources While Gathering Information About Software

Time and time I see people who follow all these random online tutorials and then when something does not work they become dazed and confused. “Why this does not work? But this tutorial shows that it should work” – I see similar questions occasionally in various forms on forums and IRC. I think people do not realize that there is some kind of hierarchy of trustworthiness of information sources. We should be conscious of that hierarchy when looking for information and remember it when we notice that something is not correct or up-to-date. ...

August 27, 2017 · 5 min · giedrius

Experience with Audio Books: 24 hour edition

Recently I have been trying out a pretty old phenomena by now that is called “audio books”. Well, what is it actually? It literally is just how it is called. These are audio records where someone is reading the book that you are interested in. It mostly took off after Apple released the iPod and now it is available everywhere because high-speed internet connections are attainable by the general public and services exist like Audible where you can purchase audio books and download them easily. Obviously, they let you get the same content from books that you would otherwise get by reading but it has some downsides as well. Well… what are they? I will present my own point of view after finishing almost two books in approximately 24 hours of listening. ...

August 19, 2017 · 4 min · giedrius

Why You Should Read Programming Books

Nowadays it seems like we are on an information highway and it is very hard to keep up with all the knowledge. Especially this is acute when considering how many websites there are on the Internet and how long it would take you to read and understand them all. However, there is a solution – books offer a way to get condensed information from the field experts and learn a lot of things. Many people think that this is only true for other fields except programming. But I think that is false. In software development, a lot of things are timeless as well and they do not change so often. Let me present this and other arguments in more detail, and try to convince you to pick up a programming book and read it. ...

August 16, 2017 · 4 min · giedrius