fedora aeroplane mode always on

Under Fedora 23, somehow the aeroplane mode went on (plane icon shown in top right corner). I tried to switch it off but could not. After a reboot, the aeroplane is still switch on and there is no way to switch it off. So, neither wire connection nor wifi connection can be switch on.

After a while and some browsing, this solution worked for me:

Note, however, that on my system rfkill was not installed… so i got the RPM (rfkill-0.5.6.fc23.x86_64.rpm) from another source, copied it on a usb key and install it as follows:

Posted in Linux | Tagged | Leave a comment

packet_write_wait: Connection to XXX : Broken pipe

In general, I can connect to a remote machine via SSH without any troubles but occasionally in some particular setup, although I can connect to the remote machine and type commands in a shell, the connection is broken after a few minutes of connection.

This happens when we do not interact with the terminal (i.e., we do not type anything on the keyboard).

In such case, the following error message appears:

Solution:

On the host, add those lines in the file .ssh/config

If the file config does not exist, just create it.

The ServerAliveInternal pings the server with a null packet every 30 seconds. As for the second line, I have not check whether it is required or not.

Posted in Linux | Tagged | Leave a comment

pytest-cov collects no data on Travis

I recently switched from nosetests to pytest and pytest-cov for one of my Python project (http://easydev-python.readthedocs.io).

Locally, everything seemed to work fine and once on Travis, all tests passed as expected.

Yet, before the coverage report, I noticed this warning:

and more importantly, the final coverage reported was 0% !!

I later realised that one __init__.py file in the test/ directory was present locally but not in the github source code. After a commit, travis found the missing file and the coverage came back to normal.

So, this __init__.py seems important for pytest-cov

Posted in Python | Tagged , , | 2 Comments

Remove extension in a bash script

Imagine a bunch of files with extension fastq.dsrc, the following script will decompress the files by looping over the N files. One issue was to remove the extension in the script. See below the usage of //

Posted in Linux | Tagged | Leave a comment

git synchronisation of a forked repository

Let us assume you have forked a repository (from https://github.com/project/repository_name). You now have a local version at a given time of the repository repository_name.

Time flyes and you come back to the local repository and you are not synchronised anymore. So, you need to fetch the new commits from the upstream repo, pull and push into your repository. this is done as follows:

Posted in Uncategorized | Leave a comment

gimp: how to make a transparent background

How to make a transparent background/selection on an image using GIMP

    1. Open your image.
    2. Select the area you want to make transparent.

    1. Select the appropriate selection tool from the Tool window or the Tools – Selection Tools menu on the Layer window. I usually use the magic wand/fuzzy select (Select contiguous region) tool or the Select regions by color tool.
    2. Click in the region you want selected. Use shift-click to add more regions/colors.Tip: It’s easier if you zoom in (View – Zoom menu) to see finer details of exactly what you’re selecting.

    3. In the Layer window (the one showing your image), select Layer – Transparency – Add Alpha Channel.If this is blanked out then it’s already done. This makes sure your image can store transparency data
    4. Select Edit – Clear. This makes the selection transparent.
    5. Save the file. Note: If you save it as a PNG file, be sure to select the ‘Save colour values from transparent pixels’ option in the Save as PNG dialog box.

Posted in photos | Tagged | Leave a comment

lost your linux root password ?

Lost your root password ?
=========================

Under Fedora, at boot time, press e, select the kernel and add 1 (run level), which will let you enter into a shell session, where you can edit the /etc/passwd file to reset the password.

Posted in Linux | Tagged | Leave a comment

vim: multiple buffers

In order to work with several view ports of the same file in the same Vim window, type:

You may also open another file in the same window. To do so issue the command::

To switch between buffers, use ctrl+w

To open a vertical buffer use :vsp filename.

Posted in Linux | Tagged | Leave a comment

vim: create function to remove white spaces

In the .vimrc file, add the following lines ( here ^M is a special character for the return carriage created using CTRL+V):

those functions call then be called within vim typing:

some Explanation of the function removeWhiteSpace().

  1. first line replaces a line that starts and ends with white spaces
  2. second line replaces a single white space that is alone on a line.
  3. third line replaces the end of a line that finishes with trailing spaces
  4. same as 3 but for the single white space case
Posted in Linux | Tagged | Leave a comment

yumex-dnf is locked

Under Fedora 23, starting yumex-dnf, I got a message that yumex-dnf was locked. I could not find any lock file in /var/cache/dnf and therefore was stuck. Finally, running

did kill the faulty process and could start yumex-dnf again…

Posted in Linux | Tagged | 5 Comments