vsftpd con utenti mysql e custom chrooted homedir

vsftpd con utenti mysql e custom chrooted homedir

I motivi per i quali possiamo voler scegliere vsftpd come server ftp, sono innumerevoli e non saranno oggetto di questo articolo. Mi limito a dire che personalmente, l’ho scelto per la sua sicurezza, snellezza, prestazioni. Del resto, si tratta di una soluzione scelta da redhat e consigliata da ibm. Come al solito, tutto parte dalle …

Read More Read More

colword : A command line word highlighter

colword : A command line word highlighter

I often prefer just to hilight some words rather than grep them, it’s good not to loose the contexst. colword is a very basic version of grep but it does not suppress any line, it just colors the matched word. It’s super easy to use:

colworld’s source code

 

Bash scripting: Apply a firewall rule dynamically by reading a log file

Bash scripting: Apply a firewall rule dynamically by reading a log file

Some years ago, I needed to apply hundreds of firewall rules dynamically by reading a log file. It was basically a DDos attack and the requests were easily identifyable since the attacker’s software was using the protocol HTTP/1.0. I solved by pipeing some unix standard commands:  tail, grep, awk, iptables

Recap: tail -f continuously reads  …

Read More Read More

Angular: Manually update a model from inside its custom validator avoiding loops

Angular: Manually update a model from inside its custom validator avoiding loops

I know, it could sound weird, in another post I will give more details about this need of mine. Now I want to focus on the problem: If you update a model inside its own custom validator, it will trigger the validator again in a devastaing loop. I was looking for a way to update …

Read More Read More

How to calculate the file size from a base64 string in javascript

How to calculate the file size from a base64 string in javascript

A base64 string looks like this: data:​image/​png;​base64,iVBORw0KGgoAAAANSUhEUg[…] To calculate the size you have to: remove the header (data:​image/​png;​base64,) remove the “=” chars used as padding multiply for 3/4 The code:

Set a dynamic configuration object in the app by reading it from the server

Set a dynamic configuration object in the app by reading it from the server

What we are going to achieve is:  Having just one place (the server!) where to set some config parameters. (Those are useful for both server and client) If later we decide to change a parameter like the size limit of file uploading, we will just change it in the server, we will not have to …

Read More Read More

JAVASCRIPT: Validating an alpha input field in an internation/multilangual project

JAVASCRIPT: Validating an alpha input field in an internation/multilangual project

Validating an alpha input field in an internation/multilangual project, is not easy as it seems. Javascript does not support unicode out of the box. Regex like /^[A-Za-z]$/ would never work with strings like 愚蠢的人讀了 or успокойсяЯпростопошутил At the beginning I used something like:

It works, but everybody knows how important is to keep the …

Read More Read More

Angular *ngfor: How to interate over an object

Angular *ngfor: How to interate over an object

Let’s suppose we receive from an api an object like:

*ngfor does not handle it out of the box, yet. (I’ve seen some proposal on github) The solution is to use a pipe. If you use ionic-cli

Template

Controller //nothing special here Module

Pipe

  Done 🙂