…that works in nginx:

add_header Content-Security-Policy
    "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' agilob.disqus.com disqus.com a.disquscdn.com referrer.disqus.com;
      img-src 'self' agilob.disqus.com disqus.com a.disquscdn.com referrer.disqus.com;
      style-src 'self' 'unsafe-inline' agilob.disqus.com disqus.com a.disquscdn.com referrer.disqus.com;
      font-src 'self';
      frame-src 'self' 'unsafe-inline' agilob.disqus.com disqus.com a.disquscdn.com referrer.disqus.com;
      object-src 'none'";

For a reason FreeBSD doesn’t support Qt5 build tools out of box. There are a few problems that have to be solved before you can run qmake && make to build a project. Firstly, my default setup didn’t have QMAKESPEC specified, add this line to your .bashrc/.zshrc:

export QMAKESPEC=freebsd-g++

Also add this line to specify Qt5 theme:

export QT_QPA_PLATFORMTHEME=qt5ct

Continue reading

I recently acquired “new” netbook, it’s so old that most people would call it ancient. Its CPU is only 32 bit architecture, it’s not capable of playing 2k videos in 30fps, its computing power is lesser than my ARM tablet, but it still works, so why not use it for something.

I got it from a friend who was using Fedora. It was slow, even with openbox. dnf update was taking from a few to several minutes, I had to install something faster. At first, Debian with LXDE. First installation attempt failed with some problem with GRUB, it wasn’t a good sign, I didn’t investigate the problem to get it working asap. I restarted bootloader installation with LILO which succeeded. Debian was still slow. Package installation was taking long, deb processing was taking long and I was sitting there and waiting for it to finish. Launching Firefox was taking even 30 seconds, videos on youtube were lagging even on 30fps. I really expected more from this 10 years old hardware. I decided to use it for my experiments and try something new. I decided to look at BSDs. OpenBSD would work here, it’s fast, secure and it like ideology behind it, but I don’t think it would work on semi-destkop netbook for me. I read about DragonFlyBSD and was impressed what creators did with kernel and distribution, wanted to give it a try, but they don’t support i386. There are two BSD distributions dedicated for desktop computers, DesktopBSD and PC-BSD, I didn’t know with which one to go, so I took FreeBSD, they provide i386 memstick installer, so it was easy since beginning, or at least it was specific which image should be used.

Continue reading

GitLab.com is a competitor of Github. It’s a service provider for git-based source code repositories that offers much more than it’s bigger brother. In this post I will try to convince you to try it out for your next project.

GitLab is not only a simple git hosting; its features impact the whole development process, the way of contributing to a project, executing and running tests, protecting source code from changes, more and more.

gitlab-logo-squareContinue reading

This year (2016) and last year, a few new laws were introduced by Cameron’s government, so I decided to get myself VPN. First, I tried a lifetime TigerVPN for 30$, nice deal. Unfortunately, TigerVPN doesn’t fully support Linux OpenVPN implementation. Connection is dropped when reaching ~900kb/s upload+download; network-manager tells that server time outed and it never reconnects due to… an authentication problem.

So I started looking for other affordable solutions. Two biggest competitors are PIA and TorGuard. I started reading discussions on reddit about those two, and it seems, there are very little differences. I was given a rolling promotion code for TorGuard, a 50% discount code that can be used after my 2 years long service comes to an end. It’s good.

Continue reading

My major project in Java (Android) involved image manipulation where I used JHLabs. I found there was no easy way to add JHLabs support for Android without extracting sources and manually adding them to the project. So there it is now:
https://gitlab.com/agilob/JHLabs_android

It’s compatible with gradle build system, so you can easily add it to your gradle project.

To use it in your project:

  1. Go to the main folder of your application
  2. mkdir third_party
  3. Edit settings.gradle and add this line
    include 'third_party:jhlabs2'
  4. Add this line to your dependencies:
    compile project(':third_party:jhlabs2')
  5. It should be done now!

You can see it working in my project!

I saw such question on SO. There was no solution with RegEx so… I was bored I think.

public static boolean isValid(String ip) {
    boolean isvalid;
 
    isvalid = ip.matches(
            "(([0-9]|[0-9]{0,2}|1[0-9]*{0,2}|2[0-5][0-5]|0{0,3}).){3}" +
             "([0-9]|[0-9]{0,2}|1[0-9]*{0,2}|2[0-5][0-5]|0{0,3})"
    );
 
    return isvalid;
}

Continue reading

which every user should have to improve their privacy, security, save RAM and CPU

 

Also check out configuration guide for µBlock.

You can work with SQL queries in Qt and SQL in many different ways, here I will show you how I came up with a working method. To keep things simple, I am not going to use any UI to print or edit queries. It will be just source code and stdout, as a database engine I will use SQLite3.

After you created your project, edit project.pro and locate line:

QT       += core

Modify this line by adding `sql`:

QT       += core sql

Since now, when you compile your project, QtSql module will be linked to the project:

g++ -Wl,-O1 -Wl,-O1,--sort-common,--as-needed,-z,relro -o QtSql main.o   -lQt5Sql -lQt5Core -lpthread

Continue reading