Homestead Vagrant xdebug3 vscode phpspec

Reset to original state ./vagrant destroy –force && ./vagrant up .vscode/launch.json { “version”: “0.2.0”, “configurations”: [ { “name”: “Listen for Xdebug”, “type”: “php”, “request”: “launch”, “port”: 9003, “log”: true, “pathMappings”: { “/home/vagrant/homestead.test”: “/home/chris/code/homestead.test” } } ] } Start an ssh session ./vagrant ssh Create the xdebug log file sudo touch /var/log/xdebug.log && sudo chmod 777… Continue reading Homestead Vagrant xdebug3 vscode phpspec

Selenium with Python

Create a virtual environment python3 -m venv env Get gekodriver (for FireFox) It needs to be in the PATH (using Ubuntu here) sudo mv geckodriver /usr/local/bin/geckodriver Activate the virtual environment source env/bin/activate Install Selenium pip install selenium The script from selenium import webdriver from import By from selenium.webdriver.common.keys import Keys from import… Continue reading Selenium with Python

Captive portal

When connected to a wifi captive portal and the login screen won’t appear, try any of the following: (from a Chromium browser)


WooCommerce Documentation WooCommerce Action and Filter Hook Reference

Scaffold Symfony app from existing database

Prepare for a new run rm -r src/Entity/* rm -r src/Form/* rm -r src/Controller/* rm -r src/Repository/* rm -r templates/* Copy in a backup of base twig template cp base.html.twig templates/ Generate entities from an existing database bin/console doctrine:mapping:import “App\Entity” annotation –path=src/Entity bin/console make:entity –regenerate App Make CRUD for each new entity bin/console make:crud MyEntity… Continue reading Scaffold Symfony app from existing database

Categorised as Symfony

Query DNS data

dig Query for information on all DNS records dig ANY Query for A records dig A host, nslookup and dig share similar functionality. whois Return information about a domain name registration, including the name servers it is configured to work with whois

WordPress debugging

To turn on debugging add the following to wp-config.php // Turn debugging on define(‘WP_DEBUG’, true); // Tell WordPress to log everything to /wp-content/debug.log define(‘WP_DEBUG_LOG’, true); // Display error messages define(‘WP_DEBUG_DISPLAY’, true); Write to /wp-content/debug.log error_log(‘logging message here…’);

Backup mysql database via socks tunnel

The following bash script will open a socks tunnel with a remote host and use a local mysqldump cli tool to backup a mysql database. #!/bin/sh DT=$(date ‘+%Y-%m-%dT%H:%M:%S’) SUFFIX= FILENAME=$DT$SUFFIX BACKUPSPATH= USER= IP= PORT= DBUSER= DBPASS= DBNAME= echo “Opening socks tunnel to $IP” echo “Writing $FILENAME” ssh -f -L $PORT:$PORT $USER@$IP sleep 10; \ mysqldump… Continue reading Backup mysql database via socks tunnel

Dockerized phpmyadmin

Phpmyadmin is available as a Docker image. The mysql server connection parameters are provided when the container is instantiated. docker run -d –name pma_local \ –network=docker_network \ -e PMA_HOST=db \ -e PMA_PORT=3306 \ -e PMA_USER=root \ -e PMA_PASSWORD=password \ -p 8080:80 phpmyadmin/phpmyadmin –network The docker network the phpmyadmin container will join. PMA_HOST, PMA_PORT Name and… Continue reading Dockerized phpmyadmin