Skip to content

Instantly share code, notes, and snippets.

View WillSquire's full-sized avatar

Will Squire WillSquire

View GitHub Profile
@WillSquire
WillSquire / edit_hosts.md
Created February 20, 2018 16:44
Edit hosts file (on Mac)

To edit hosts file:

sudo nano /etc/hosts
@WillSquire
WillSquire / ip.md
Created February 16, 2018 13:02
Retrieve IP address via shell

To retrieve an IP address via shell:

nslookup example.com
@WillSquire
WillSquire / ip.md
Created February 16, 2018 13:02
Retrieve IP address via shell

To retrieve an IP address via shell:

nslookup example.com
  • entity_browser: Doesn't do much without configuration. media_entity_browser is basically a configured version of this for browsing images, videos, etc. Might be better to do manually as it can integrate with inline_entity_form
  • contact_storage: Aims to bring Drupal's core contact form module towards D7's webform and entityform modules
  • restui: Useful when using the REST API to exposed endpoints, but can be done in views instead.
  • webform: Look to replace with core's contact_form when it has features like multi-page support, email / handlers (user selectable, ideal for CRM), etc.
  • inline_entity_form: For creating and editing entities on the same page.
@WillSquire
WillSquire / services_on_ports.md
Created September 25, 2017 15:22
Show what services are running on what ports

To show what services are running on what ports:

netstat -tulpn
@WillSquire
WillSquire / php_email_test.md
Last active September 20, 2017 09:45
Test PHP is able to send mail
@WillSquire
WillSquire / drush_administer_users.md
Last active August 25, 2017 15:41
Administer users with Drush

Create user:

drush ucrt example_username --password="example_password" --mail="[email protected]"

Update user password:

drush upwd example_username --password="example_password"
@WillSquire
WillSquire / remove_binary_logs.md
Last active August 2, 2017 16:27
Remove binary logs

Locate and edit my.cnf files on the system, commonly located at /etc/mysql/my.cnf on Ubuntu.

Comment out (using #) any lines that begin with log-bin and expire_logs_days in the my.cnf file and save to disable the binary logs.

Restart the MySQL/MariaDB or equivelent service. For example:

sudo service mariadb restart

Previously created binary logs will not yet be removed. To remove any previously created binary logs, see here

@WillSquire
WillSquire / purge_binary_logs.md
Last active July 11, 2017 13:46
Purge binary logs

Login to MySQL (requires a root account or equivilant):

mysql -u <username> -p

To purge binary logs before the last 3 days:

PURGE BINARY LOGS BEFORE NOW() - INTERVAL 3 DAY;
@WillSquire
WillSquire / export_import_db_cli.md
Last active July 15, 2017 17:17
Export/Import database dump via command line

Export a database dump via command line:

mysqldump -u <username> -p <databasename> > <filename.sql>

Import database dump via command line:

mysql -u <username> -p <databasename> < <filename.sql>