Skip to content

Instantly share code, notes, and snippets.

View WillSquire's full-sized avatar

Will Squire WillSquire

View GitHub Profile
@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

To test PHP's mail function sends mail via the command line:

php -r 'mail("recipient_email@example.com","Subject","Body");'

Tip: Use an email spam tester to debug (such as http://www.isnotspam.com)

@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="example@example.com"

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>
@WillSquire
WillSquire / ansible_upgrade_macos.md
Last active August 30, 2017 20:52
Upgrade Ansible on MacOS

Install Xcode and possibley Command Line Tools also to install compliers needed.

MacOS needs pip resources for the system, as such it's best to ignore upgrading these on the whole system with --ignore-installed:

sudo pip install --ignore-installed --upgrade ansible