Showing posts from October, 2016

How to comment multiple lines in Pycharm

If you have a latin keyboard without numpad or any without slash key, maybe you couldn't use the shortcut enabled in Pycharm to comment multiple lines (Ctrl+Slash).
To change this shortcut, you must create a default keymap copy to edit it, just clicking on Copy button.
Go to File/Settings... and write keymap

Now, filter by comment and add a new keystroke, like Shift+3

Enjoy it!

How to install pyqtgraph in Ubuntu 16.04

If you need any python module, the best alternative to install it is thrught pip:

sudo pip install pyqtgraph

but, I don't know why, if you try import pyqtgraph it doesn't recognize:

Python 2.7.12 (default, Jul  1 2016, 15:12:24) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyqtgraph as pg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pyqtgraph

Don't remember that always you can use apt-get for the same:

sudo apt-get install python-pyqtgraph

Now, you can see all examples with the following command:

python -m pyqtgraph.examples

Enjoy it!

Debug SDN Ryu controller with Pycharm

If you want debug your Ryu App, you need execute ryu-manager throught Pycharm.
To do it, you need execute the following python script in the same folder where you have the ryu app. I got the script from

#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from ryu.cmd import manager def main(): sys.argv.append('--ofp-tcp-listen-port') sys.argv.append('6633') sys.argv.append('simple_switch_13') sys.argv.append('--verbose') sys.argv.append('--enable-debugger') manager.main() if __name__ == '__main__': main()
Where simple_switch_13 is your Run with Shift+F9 in Pycharm.
If you choose any line in your Ryu app to debug, the console will show you the data about this variable like the following screenshot:

How to use Syntax Highlighter on Blogger

You can see this video to know how to modifiy your blogger template to enable Syntax Highlighter.

If you want add more brushes, you can add the code in this url to your blogger template:

Run wireshark as unprivileged user (without root)

If you want to run wireshark without sudo, you will get this error and you couldn't capture traffic:

To fix it, you must run these codes, and later reboot your machine:

sudo groupadd wireshark
sudo usermod -a -G wireshark $USER
sudo chgrp wireshark /usr/bin/dumpcap
sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap
sudo dpkg-reconfigure wireshark-common

How to import a graphml topology in mininet

If you want to load topologies in your network emulation with mininet, the best option is use grahpml format. I compared a lot extesions available from Gephi and Cytoscape (software for work with topologies) and graphml is one of the extensions that gives more information about the topology.
You can export your topologies and save information like label, geolocalization, delay, bw, loss, etc.

If you want real topologies, you can get them from Topology Zoo website.
To import these topologies to mininet, you can use Auto-Mininet (for mininet 2.0.0):

git clone
cd assessing-mininet/parser
./ -f Chinanet.graphml -o

  File "test", line 44
    Xi'an = self.addSwitch( 's18' )
SyntaxError: invalid syntax

As you see, the script has incompatibility with names with special c…

How to install Gephi 0.9.2 snapshot version

To install the lastest version, proceed to download it from github:

git clone
cd gephi
mvn clean install

command not found: mvn

To install maven, install it from repositories:

sudo apt-get install maven
mvn clean install
cd modules/application  
mvn nbm:cluster-app nbm:run-platform

This last command will call to the following sentence to run gephi.

/bin/sh -c /home/dragonx/Downloads/gephi/modules/application/target/gephi/bin/gephi --userdir /home/dragonx/Downloads/gephi/modules/application/target/userdir -J-Dnetbeans.logger.console=true -J-ea --branding gephi --jdkhome /usr/lib/jvm/java-8-openjdk-amd64

You can use it to create a .desktop file in your desktop to run it.

[Desktop Entry]
Comment="Start Gephi"
Exec= /bin/sh -c /home/dragonx/gephi/modules/application/target/gephi/bin/gephi --userdir /home/dragonx/gephi/modules/application/target/userdir -J-Dnetbeans.logger.console=true -J-…

Change 8 spaces identation by default in vim by 4 spaces

To follow PEP-8 standar, for identation (tabs) it's recommended 4 spaces, not 8 as vim uses by default.
To change this value, just add these lines to your vimrc file (usually located in /etc/vim/vimrc).

filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab

if for some reason you need disable any command, just put an exclamation sign at the end of the command. For example:

To enable number lines, use: set number
To disable it, use: set number!

Mininet + Ryu + Faucet + Gauge + Influxdb

First, to install faucet proceed to download it:

pip install

or from the github:

git clone

I had a problem to run gauge with this installer (maybe dependencies or something else). When I run gauge I got this error:

raise SystemError('__init__ called too many times')
SystemError: __init__ called too many times

If you have the same issue reported as #19 or you want ot avoid it, they recommend to download the ryu-faucet VM to work on it:

The user is root and password is faucet
I prefer work with byobu, to manage a lot tabs. To install on the VM just run:

zypper install byobu

If you try to run the ./ including in the faucet folder, you will see the following error:

Traceback (most recent call last):
  File "./", line 29, in <module>

How to control a MagicBlue LED bulb with Linux

If you want to control your LED bulbs throught bluetooth, I recommend MagicBlue LED bulbs. Does not have an official API, but exists an unofficial on

First, I installed an old version of magicblue (gattlib based), but I'm going to tell you the steps if you need to solve it for a similar app.

sudo apt-get install python3-pip 
sudo pip3 install setuptools bluepy
git clone
cd magicblue
sudo python3.5 install 
sudo magicblueshell

ImportError: No module named 'gattlib'
pip3 install gattlib
/usr/bin/ld: cannot find -lboost_python-py34
    collect2: error: ld returned 1 exit status
    error: command 'x86_64-linux-gnu-g++' failed with exit status 1

pip3 download gattlib
tar xvzf ./gattlib-0.20150805.tar.gz
cd gattlib-0.20150805/
sed -ie 's/boost_python-py34/boost_python-py35/'
pip3 install .

sudo magicblueshell

Name         Mac address 
----         ----------- 

read command in zsh throws error

If you want emulate pause command in your shell, read is the most used command.
In bash works without problems:

read -p $'Press enter to continue...\n'

... but in zsh the argument -p is for coprocess, for that reason returns:

read: -p: no coprocess

To have a generic code to emulate pause command (independent of your shell), is better use the following sentence:

printf 'Press enter to continue...\n';read ans

Enjoy it!

How to accept pull request and update your master branch on github

If you have a project on github, probably you receive many pull request to update your project.
To test the new branch, just write:

git fetch origin pull/1/head:branch_name

where 1 is the pull request number
To push the new files, just write:

git push origin branch_name

If you want copy this branch to the master, just write:

git push -f origin branch_name:master

For more information, visit

Compile faster throught a RAM disk

Compile programs takes a long time.
Do you have an SSD and it takes more time than with your old HDD? A good solution is create a RAM disk and compile on them.
First, you need to create a disk on your RAM (I chose 1Gb size)

sudo mkdir /mnt/tmpfs
sudo mount -o size=1G -t tmpfs none /mnt/tmpfs

Now, for test the speed, procced to create a file on it with dd:

dd if=/dev/zero of=file bs=1M count=100

On Ram disk (1.8 GB/s):

On SSD disk (172 MB/s):

It's a great difference!
Enjoy it!

How to install Wireshark 2.3 on Ubuntu 16.04 with Iperf dissector compatibility

To install this last version of wireshark, follow these steps:

tar xvf wireshark-2.3.0-947-g5a12a5e.tar.xz
cd wireshark-2.3.0-947-g5a12a5e

./ 1: ./ libtool: not found

You must have libtool 2.2.2 or later installed to compile Wireshark.
Download the appropriate package for your distribution/OS,
or get the source tarball at

Libtool usually already exists in the system, but with a different name. To solve it, just create a symbolic link with the name that expected:
sudo ln -s /usr/bin/libtoolize /usr/bin/libtool
Now, continue:
./ ./configure  --with-lua

checking for the location of lua.h... not found

configure: error: Lua support was requested, but is not available

You need to install liblua5.2-dev, because liblua5.3-dev is not recognized by wireshark by default. Wireshark for windows and OSX are based on liblua5.2.

sudo a…

Add Valgrind to CLion

Valgrind is an open-source memory debugger and you can use throught CLion (C IDE). I found this site where they show step by step how to add valgrim as external application to CLion.

But... some mistakes that you could eventually find:
1.- You must install clang and obiously valgring:
sudo apt-get install clang valgrind
2.- Modify the path to valgrim in Replace /usr/local/bin/valgrim by /usr/bin/valgrim
3.- You can find external tools configuration on: File/Settings.../Tools/External Tools
4.- If you want the real icon to put it on toolbar, follow these commands:
wget convert logo_valgrind.png -resize 16x16 logo.png
Now you can choose it to your toolbar

If you run your code and you got no errors but suppressed errors, don't be afraid:

You can see suppressed errors in /usr/lib/valgrind/default.supp 
Also, the suppressed errors are j…

How to create a C project with CLion

If you create a new project on CLion, it will be a C++ project.
If you want a C project, for the moment (2 years ago that users are asking the same to JetBrains here) you will need to edit CMakeLists.txt file:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
set(SOURCE_FILES main.c)

Now, rename your main.cpp to main.c

Enjoy it!

Remember CLion (Jetbrains suite) it's free for students
Free for students: Professional developer tools from JetBrains — Nicolás Boettcher (@nicoboettcher) October 4, 2016
I enjoy student life — Nicolás Boettcher (@nicoboettcher) October 4, 2016

SNMP + Telegraf + InfluxDB

First, install telegraf from github with the branch to fix-snmp-not-in-mib branch, that solves the issue #1833

git clone -b fix-snmp-not-in-mib --single-branch

After, I searched all MIB about an specific interface through bash language:

ID=`snmpwalk -v2c -c public localhost | grep "ifName.*STRING: $IFACE" | sed 's/\./ /g' | tail -n1 | awk '{print $2}'`
snmpwalk -v2c -c public localhost | grep "^IF-MIB::if.*\.$ID"

It outputs a lots MIBs, but most relevants are:

IF-MIB::ifName.2 = STRING: enp3s0
IF-MIB::ifDescr.2 = STRING: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express
IF-MIB::ifType.2 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifMtu.2 = INTEGER: 1500
IF-MIB::ifSpeed.2 = Gauge32: 10000000

IF-MIB::ifHighSpeed.2 = Gauge32: 10
IF-MIB::ifPromiscuousMode.2 = INTEGER: false(2)
IF-MIB::ifConnectorPresent.2 = INTEGER: true(1)

IF-MIB::ifPhysAddress.2 = STRING: AB:57:40:85:bc:35