Why Privacy Matters by Glenn Greenwald

For the last couple years, mass surveillance has been on the rise. Both governments and private entities alike track our every move online. As a result, our privacy has increasingly eroded. Under such circumstances, it is ever more important to fight for our right for it. But the problem is, that majority of population seems apathetic to this. If you are one of such people, I recommend watching the following TED talk by Glenn Greenwald. It nicely sums up why privacy matters.

Why Privacy Matters by Glenn Greenwald

Blog Terminal - A Wordpress Terminal Plugin

You might have noticed a new entry quietly appearing on the project page. So, let me introduce it to you. The new entrant is Blog Terminal, a Wordpress plugin for drawing a terminal-like box, complete with prompt. If you have read some of my other blog posts, Blog Terminal is what powers the terminal boxes in them. For the longest time I have used Post Terminal plugin by Brandon Griffith. But there were some things I did not like about it. Namely, it was not possible to draw a terminal without a prompt (for showing example configs). Furthermore, since it did not take advantage of many of the Wordpress APIs, the code was unnecessarily complicated. This made it hard to add new features. Therefore, I have decided to completely rewrite it.

Read more…

Steam Not Working on OpenSuse? Here’s a Quick Fix

After a couple of busy weeks, I finally found myself with some free time. There were a couple of interesting game releases that I wanted to check out. Unfortunately, that did not go so well in OpenSuse, with Steam not working. I was welcomed by the following error:

symbol lookup error: /usr/lib/libxcb-dri3.so.0:
undefined symbol: xcb_send_request_with_fds

It seems that Steam does not work as smooth in OpenSuse as in Ubuntu. Luckily, the fix was quite easy. You can disable the library in question using an environment variable. So I just set it when launching Steam:

$ host +x
$ LIBGL_DRI3_DISABLE=1 steam

Once I did that, the Steam launched normally and updated itself. After that, the problem disappeared, therefore I could just can run Steam normally. Time to try out Shieldbreaker, the new Darkest Dungeon DLC, with Steam controler. If you still have trouble running Steam, this might help you. Meanwhile, here’s hoping that the Steam Linux Integration project comes to Opensuse as well, for a seamless Steam experience.

Vim Tips for Increased Productivity

Vim does not need to be introduced. Due to its steep learning curve, it is often considered the bane of new Linux users. But once you get the hang of it, there’s no denying, that it’s a very powerful tool. In this post I would like to share some Vim tips, that I’ve learned over the years, that will improve your productivity. It is not aimed at Vim beginners. If you are just starting out with Vim, I recommend the excellent Byte of Vim by Swaroop C H.

Save file without sudo

I think we’ve all been in this situation - you make edits to some system configuration and when you try to save them, you realize you don’t have sufficient privileges. No need to worry, you can save it with sudo straight from Vim, using this command:

:w !sudo tee "%" > /dev/null

Since I find myself myself in such situations a lot, I have mapped it to :W command in my vimrc:

$ echo 'command W w !sudo tee % > /dev/null' >> .vimrc

Read more…

Assign Your Raspberry Pi Static IP in Couple Steps

Due to its availability, Raspberry Pi is an ideal candidate to run a simple server. After the initial setup, it will use DHCP to connect to your network. That means, each time you restart the Pi or your router, it might end up with a different IP address. This not ideal, as you will need to take a note of the new IP to connect to your services. In order to avoid reconfiguring your computers all the time, you should assign your Raspberry Pi static IP. This post will show you how to do it for ethernet connection on Raspbian, but the steps are the same for a wireless connection. Start by connecting to your Pi. When you do, you can see the current network settings by running:

$ cat /etc/network/interfaces

It should look something like this:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo 
iface lo inet loopback
iface eth0 inet dhcp

The entry you need to change is for the eth0 interface. That is the default ethernet adapter. In order to use a static IP, you have to provide IP address, network, network mask, broadcast and default gateway. So, let’s get them.

Read more…

Run Docker Container as Regular User

Docker has become omnipresent in recent years. However, by default, it requires root privileges to run containers. Obviously, this is not good security-wise. But a simple change will allow you to run docker container as a regular user. In the examples below, I am using Ubuntu 17.04, but the commands should be the same for any Linux distribution.

Add user to docker group

First of all, what happens if you try to run docker without sufficient privileges? You can see the output below:

$ docker run hello-world
docker: Got permission denied while trying to connect to the Docker daemon
socket at unix:///var/run/docker.sock: Post https://%2Fvar%2Frun%2Fdocker.sock/v1.28/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.

Docker allows users in docker group to run containers. You can check which users the group contains by running:

$ cat /etc/group | grep docker docker:x:140:

In the example above, the group does not include any users. Therefore, you need root privileges to run containers, as shown by the error above. This is the default setting. To add your user to the docker group, run this command:

sudo usermod -a -G docker user

Read more…

Managing Vim Plugins Easily Using Git

Managing Vim plugins can quickly get messy. Fortunately, there are several solutions to this problem. My favorite one is Pathogen by Tim Pope. It makes it easy to install plugins in their own private directories and automatically load them. And combining it with Git will make your Vim configuration easily portable across computers.

Install Pathogen

So how do we set it up? First of all, prepare a Git repository for your Vim plugins:

$ git init .vim
$ mkdir .vim/bundle

Next, get Pathogen. To makes things easier, we will add it as Git submodule:

$ git submodule add https://github.com/tpope/vim-pathogen bundle/pathogen
$ ln -s autoload bundle/pathogen/autoload

Furthermore, to enable Pathogen, you must add the following lines to your .vimrc:

execute pathogen#infect() syntax on filetype plugin indent on

Managing Vim plugins

Now you can happily start adding other plugins as submodules. Here is an example using Vim Sensible:

$ git submodule add https://github.com/tpope/vim-sensible bundle/vim-sensible

In order to update them later, just run:

$ git submodule update --remote --merge

Finally, if you ever need to delete them later, follow these steps:

$ git submodule init bundle/vim-sensible
$ git rm bundle/vim-sensible
$ rm -Rf .git/modules/bundle/vim-airline
$ git commit

Synchronize everything

Just one thing is missing to make the setup perfect. Ideally, your vimrc would be stored along with the plugins. I prefer dotfiles for the job. For it is simple and ready to install using pip. So let’s do that:

$ sudo pip install dotfiles

Then create a folder for your Vim configuration (which you can use for other configurations as well):

$ git init Dotfiles

Finally, add the Vim configuration files:

$ dotfiles --add ~/.vimrc
$ dotfiles --add ~/.vim

Voilà. At last, you can keep the changes to your Vim settings and plugins safely versioned now. And to set them up on a new computer, you just need to clone the repository, install dotfiles and run:

$ dotfiles --sync

Can’t get easier than that. Now, head over to see some of my Vim tips.

Make Ansible Playbook Distribution Agnostic

I’ve been thinking about switching to a rolling distribution on my working machine for quite some time. Because the packages in Ubuntu repositories are just too outdated for my needs and I want to save myself the headache of PPAs. And when Ubuntu announced dropping Unity in favor of Gnome, my mind was made up. I would use a rolling distro on my main computer and Ubuntu 16.04 elsewhere.

Unify package installation

In the end, I decided to go for OpenSuse. Since I use an Ansible playbook to setup my machines, it would take no time to have it up an running. Or so I thought. However, there was a little caveat. As my playbook used the apt module to install software, it would obviously not run on OpenSuse. Luckily, since the version 2.0, Ansible provides a platform-agnostic package manager module. It is called simply package. As a result, installing packages across different distributions is as easy as running:

---
- name: Install packages
  become: yes
  package:
    name: git
    state: present

Or is it? While it may work in the case of Git, not all packages have a same name in different Linux distributions. So you have to set up variables for those: First of all, defaults in vars/default.yml:

apache_package: apache2

Then, for Debian family vars/Debian.yml

---
apache_package: apache2

And for Redhat family vars/Redhat.yml

---
apache_package: httpd

Afterwards, just include them in your tasks:

 - include_vars: "{{ item }}"
   with_first_found:
     - "{{ ansible_os_family }}.yml"
     - "default.yml"

 - name: Install Apache
   become: yes
   package: name: "{{ apache_package }}"
   state: present

Read more…

Powerfish Gets New Features and Support for Themes

I dedicated couple evenings to Powerfish lately, resulting in a host of new features. If you don’t know what I’m talking about, Powerfish is an elegant and informative prompt for the Fish shell inspired by Powerline. Without further ado, let’s see what is new.

New features

First of all, Powerfish now fully supports the Vi keybindings. So there is no ugly box showing the current mode at the beginning of the prompt anymore. A small change, but definitely visible, if you use the Vi mode, like me. There are also two new flags in the prompt. One displays the number of background jobs, and another one shows if the last command failed. The Git flags were overhauled as well. Now they show number of untracked, modified, staged, stashed and conflicting files. If you don’t care about the concrete numbers, there is an option to display only the flags.

Read more…

Setup Mosh - SSH’s Cousin for Mobile Era

SSH, while an indispensable tool, is starting to show its age in certain situations. We have all experienced the lag when using cell phone tethering or finding your remote connections hanging in limbo when resuming your laptop from sleep. No wonder - the first release of SSH came out over twenty years ago and the landscape was very different back then. It was an age of desktop workstations and cable networks. When SSH was designed, nobody thought people would be working on laptops, switching between wifis and mobile connections. Mosh - short for mobile shell - aims at those users. It uses state machines on both client and server and only communicates the changes between them, lowering bandwith use and decreasing latency. It uses SSH for authetification, which greatly simplifies its setup. Once the connection is established, it communicates through encrypted UDP datagrams, which makes it more resilient to IP address changes and connection dropouts. As you can see, it is a handy tool to have when you are on the go. So how to get it running?

Install

Mosh needs to be installed on both the server and the client. In most package managers, the package is called simply mosh. For example, on Debian and Ubuntu derived systems, you can install it with:

$ sudo apt install mosh

Read more…