Depending on your needs, you should consider using filter_var() with the FILTER_VALIDATE_BOOLEAN flag. filter_var( ‘true’, FILTER_VALIDATE_BOOLEAN); // true filter_var( 1, FILTER_VALIDATE_BOOLEAN); // true filter_var( ‘1’, FILTER_VALIDATE_BOOLEAN); // true filter_var( ‘on’, FILTER_VALIDATE_BOOLEAN); // true filter_var( ‘yes’, FILTER_VALIDATE_BOOLEAN); // true filter_var( ‘false’, FILTER_VALIDATE_BOOLEAN); // false filter_var( 0, FILTER_VALIDATE_BOOLEAN); // false filter_var( ‘0’, […]
Show which git tag you are on
Show all tags on current HEAD (or commit) git tag —points-at HEAD
PHPUnit: How do I create a function to be called once for all my tests
Take a look at setUpBeforeClass(). For the one time tearDown you should use tearDownAfterClass();. Both this methods should be defined in your class as static methods.
How do I change my locale to UTF-8 in CentOS?
In CentOS try with system-config-language command. That’s the CentOS way ? Also you can try with: localedef -c -f UTF-8 -i en_US en_US.UTF-8 export LC_ALL=en_US.UTF-8
SSH connection problem with “Host key verification failed…” error
«Host key verification failed» means that the host key of the remote host was changed. SSH stores the host keys of the remote hosts in ~/.ssh/known_hosts. You can either edit that text file manually and remove the old key (you can see the line number in the error message), or […]
SQLite General error: 1 Cannot add a NOT NULL column with default value NULL
This is (what I would consider) a glitch with SQLite. This error occurs whether there are any records in the table or not. When adding a table from scratch, you can specify NOT NULL. However, you can’t do this when adding a column. SQLite’s specification says you have to have […]
Iptables rule-set so that a docker container can access a service on a host IP
Container communicates with host using docker0 interface. To allow traffic from container add: -A INPUT -i docker0 -j ACCEPT
Can I automatically add a new host to known_hosts
Set the StrictHostKeyChecking option to no, either in the config file or via -o : ssh -o StrictHostKeyChecking=no [email protected]
Host unreachable inside Docker container
I know it is an old question but for anybody coming here, the solution, at least on Linux, is to allow incoming network packets to host from docker bridge network by modifying the iptables of the host as following: sudo iptables -I INPUT -i docker0 -j ACCEPT It translates to […]
Restrict Internet Access — Docker Container
Network creation for access internet docker network create —subnet=172.19.0.0/16 internet Network creation for block internet access docker network create —internal —subnet 10.1.1.0/24 no-internet If you want to connect docker container into internet docker network connect internet container-name If you want to block internet access docker network connect no-internet container-name