Category Archives for commandline

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.


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).

Disable xdebug for one run

This script disables xdebug for one run. No more error-messages like:


This is what you’ll get

We’ll create a script which will:

  • disable xdebug
  • run your command
  • enable xdebug

the script we’ll name php-no-xdebug (or whatever you like)

With Xdebug (note the last line)

Without Xdebug (note the missing last line)

The script php-no-xdebug

Create the script /usr/local/bin/php-no-xdebug with the following contents.

and make it executable

That’s it! Run it like this: