Skip to content

Instantly share code, notes, and snippets.

View mrpatrick's full-sized avatar

Patrick Tully mrpatrick

View GitHub Profile
mrpatrick /
Created October 28, 2016 15:15
mysqldump tabels with regex. This is useful if you want to ONLY dump wp_* tables within a larger database. From:
mysql -N -uroot -e 'show tables like "wp\_%"' mydb | xargs mysqldump -uroot mydb > /tmp/wp_tables_prod.20161028.sql
mrpatrick /
Created August 9, 2016 20:59
Check the diff between branches and revert single file from specific commit
# Check the diff between branches
git diff release-v2.0.0..Develop public/wp-content/themes/mytheme/my-page.php
# revert single file from specific commit
git checkout 26608ec4a393b0086e02851b6d6f6b72af265a67 public/wp-content/themes/mytheme/my-page.php
# commit (the diff won't show until it's commited)
git commit
# re-diff file (will show no diff)
mrpatrick /
Created August 2, 2016 16:31
Create new wordpress admin user using wp-cli / docker
docker run -e --user=apache -i -t -w /var/www/ --volumes-from PROJECTNAME_PROJECTNAME_1 --link channelone_db_1:db_1 /.composer/vendor/wp-cli/wp-cli/bin/wp --allow-root --path=/var/www/html user create admin --role=administrator
mrpatrick / auto-rsync.el
Created June 29, 2016 18:57 — forked from mtmtcode/auto-rsync.el
auto-rsync.el - Emacs minor mode to execute rsync automaticlly
;;; auto-rsync-mode -- minor mode for auto rsync
;; Author: @l3msh0
;;; Example
;; (require 'auto-rsync)
;; (auto-rsync-mode t)
;; (setq auto-rsync-dir-alist
mrpatrick /
Created March 10, 2016 15:30 — forked from rmohr/
fixed salt boostrap file because of moved corp repositories
#!/bin/sh -
# vim: softtabstop=4 shiftwidth=4 expandtab fenc=utf-8 spell spelllang=en cc=120
# DESCRIPTION: Bootstrap salt installation for various systems/distributions
mrpatrick / lti_testing_tool
Created March 8, 2016 16:19
LTI Testing Tools
mrpatrick / mysqlcli_sphoinx
Created January 20, 2016 20:03
Connect to sphinx from mysql commandline. Use sphinxQL
mysql -P9306 --protocol=tcp
mrpatrick /
Last active January 5, 2016 21:34
Wordpress CLI for dockerenv projects Some useful wp-cli commands to run that allow you to search/replace and update to your dev/stage domain names. Update params as needed (i.e. docker tag, project_name, etc)
# Update wp home/siteurl vars
docker run -e --user=apache -i -t -w /var/www/ --volumes-from MYPROJECTNAME_MYPROJECTNAME_1 --link MYPROJECTNAME_db_1:db_1 /.composer/vendor/wp-cli/wp-cli/bin/wp --allow-root --path=/var/www/html option update siteurl ""
docker run -e --user=apache -i -t -w /var/www/ --volumes-from MYPROJECTNAME_MYPROJECTNAME_1 --link MYPROJECTNAME_db_1:db_1 /.composer/vendor/wp-cli/wp-cli/bin/wp --allow-root --path=/var/www/html option update home ""
# Update all wp post / image data that contain source url's
# REMOVE --dry-run to actually execute
docker run -e --user=apache -i -t -w /var/www/ --volumes-from MYPROJECTNAME_MYPROJECTNAME_1 --link MYPROJECTNAME_db_1:db_1 /.composer/vendor/wp-c
docker stats $(docker ps | awk '{if(NR>1) print $NF}')
mrpatrick / table_names_by_engine.sql
Created October 19, 2015 17:50
show table names by engine
SELECT table_name, engine FROM INFORMATION_SCHEMA.TABLES order by engine;