Regular expression to match string not containing a word.

The fact that regex doesn’t support inverse matching is not entirely true. You can mimic this behavior by using negative look-arounds:


1
^((?!hede).)*$

The regex above will match any string, or line without a line break, not containing the (sub) string ‘hede’.As mentioned, this is not something regex is “good” at (or should do), but still, it is possible.

Explanation

“Regular expression to match string not containing a word.”Continue reading

DROP ALL TABLES в MySQL

The heading at this note is a bit wrong. In MySQL there is no such command, and it would be desirable, that it was. Sometimes there are problems in which we want to remove all tables of a DB, but not her (that there were its parametres, such as access rights, codings, etc.). To solve such problem it is possible with the help command:

a=name;b=pass;c=base;mysqldump -u$a -p$b --add-drop-table --no-data $c|grep ^DROP|mysql -u$a -p$b $c

The first command of the conveyor we create «dump» the databases, consisting of every possible DROP TABLE, but without the data. The second command we choose only the lines beginning with DROP, and at last, we fill in the received commands in MySQL.

Monitor Varnish with Zabbix

Add the following to the end of /etc/zabbix/zabbix_agentd.conf
# Varnish Keys
UserParameter=varnish.stat[*],(test -f /usr/bin/varnishstat && varnishstat -1 -f $1 | awk ‘{print $$2}’)

Restart the Zabbix agent
/etc/init.d/zabbix-agent restart

Scroll to top