Skip to content

Tag: linux

Set env variable in sudo when provisioning Vagrant

I’m trying to install a python package in a Vagrant box that runs in Ubuntu 14 with sudo, this package requires to set an env variable before. I have tried the following commands, but it did not recognize the env variable when provisioning Vagrant: sudo AIRFLOW_GPL_UNIDECODE=yes sudo pip install apache-…

Clone a folder / raid on a folder?

I have two hard drive of 4Tb connected to my raspberry pi. Let’s call them A and B. I have some folders on A that have to be copied on B. At all the time, something like a RAID10 on some folder. So, if I copy test.jpg in disk A, test.jpg has to be copied on disk B. If I

How do I create a file I can stream data to in Python?

I’d like to create a file similar to those under /dev that I can stream lines of text to without actually writing anything to the disk. I want to still be able to read this stream like a regular text file. Answer Call the os.mkfifo function, then open the file it creates as normal. Anything that gets wr…

Understanding read syscall

I’m reading man read manual page and discovered that it was possible to read less then the desired number of bytes passed in as a parameter: It is not an error if this number is smaller than the number of bytes requested; this may happen for example because fewer bytes are actually available right now (…

Using sed with regex to match varying lines

I’m having some issues used sed to match a regex pattern. An example would be with the following lines: spring-core-4.0.0 should be spring-core-4.1.0 spring-web-4.0.0 should be spring-web-4.1.0 I want the regex to match any characters in between spring and the version number. I’m not sure if I nee…