Category Archives for commandline

Install Gearman from source on Ubuntu 18.04

I tried to install Gearman on my Ubuntu 18.04 Docker container and encountered a lot of issues.

This write-up is to save you some valuable time of your life.

TL;DR

To get there, I encountered the following issues:

configure: error: Unable to find libevent

Fix: apt install -y libevent-dev

configure: error: Could not find a version of the library!

Fix: apt install -y libboost-all-dev

Installing the PHP client libraries for Gearman

If you intend to use PHP to talk to your Gearman service, use the following to get the libraries installed.

Note: you might not need the last line. This is to enable the Gearman PHP extension in Docker.

Automatisch bestanden verwerken en mailen met Hazel


Als ik een factuur binnenkrijg, wil ik dat deze netjes gearchiveerd wordt in de juiste directory én dat de factuur verstuurd wordt naar het speciale e-mailadres van mijn boekhouding zodat hij daar verwerkt kan worden.

Om dat handmatig te doen ben je niet lang bezig en het is ook niet moeilijk Maar het wordt wél vervelend om het steeds maar weer opnieuw te doen. Steeds weer dezelfde handelingen. Continue reading


Vagrant box updaten


Vagrant boxes zijn handige images van virtuele machines. Maar vaak zijn ze outdated en moet je ze eerst updaten voor je ze kunt gebruiken.

Ik doe daarom regelmatig een (automatische) update van mijn veelgebruikte images en bewaar ze centraal zodat ik snel een up-to-date image heb als ik wil gaan ontwikkelen.

TL;DR

Continue reading

Gitlab CI upload artifact fails: too large


Today I wanted to add a package-job to my Gitlab CI as instructed in this nice Gitlab tutorial.

I created the tar-file but when it came to uploading it failed with Request entity too large.

It took me some digging, but this is how I fixed this (note, the Nginx proxy was the one giving me a hard time).

Step 1: Set the maximum artifacts size

In your gitlab, go to Settings > Continuous Integration and Deployment > Maximum artifacts size (MB) and set it to the desired value. The default is 100MB.

Step 2: Set the nginx upload size

In the gitlab.rb file, mine at /etc/gitlab/gitlab.rb, set or uncomment the following line.

 

 

And reconfigure gitlab to get this to work.

Step 3: (optional) update your proxy(!)

I run gitlab on docker containers. On the server, I run nginx as a proxy to redirect requests for gitlab to these containers.

I failed to update the proxy configuration to allow the POST-ing of data to the containers.

As I use nginx, this is the line I added. For Apache, just google and you’ll find your answer.

This will set no limits on clients sending data.

For reference, this is my whole nginx vhost file.

Don’t forget to reload nginx.

 

Change mysql_ to mysqli_ functions


In the process of upgrading PHP5.3 code I had to change all deprecated mysql_* functions to their mysqli_* counterparts.

For a lot of functions the signature stayed the same.

But mysqli_query and mysqli_connect have differences. So you can’t just find and replace them.

Instead of doing this manually, I wanted to find and replace recursively while changing the order of the arguments.

In vim:

Using sed:

Recursively changing all files:

Note that sed cannot do non greedy matching.

That’s why we’re searching for anything but the separator until the separator like this:

It basically states: get everything except for the comma until you get a comma (which is the first one to appear).


>