Skip to content

Instantly share code, notes, and snippets.

View mrpatrick's full-sized avatar

Patrick Tully mrpatrick

View GitHub Profile
@mrpatrick
mrpatrick / mysqldump_regex_tables.sh
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: http://stackoverflow.com/questions/5268936/mysqldump-only-tables-with-certain-prefix-mysqldump-wildcards
mysql -N -uroot -e 'show tables like "wp\_%"' mydb | xargs mysqldump -uroot mydb > /tmp/wp_tables_prod.20161028.sql
@mrpatrick
mrpatrick / branch_diff_rever_single_file.sh
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
mrpatrick / wp-cli-new-admin.sh
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 docker.io/avatarnewyork/dockerenv-apache:php56 docker-umask-wrapper.sh /.composer/vendor/wp-cli/wp-cli/bin/wp --allow-root --path=/var/www/html user create admin myemail@myhost.com --role=administrator
@mrpatrick
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
mrpatrick / bootstrap-salt.sh
Created March 10, 2016 15:30 — forked from rmohr/bootstrap-salt.sh
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
#======================================================================================================================
#
# FILE: bootstrap-salt.sh
#
# DESCRIPTION: Bootstrap salt installation for various systems/distributions
#
# BUGS: https://github.com/saltstack/salt-bootstrap/issues
@mrpatrick
mrpatrick / lti_testing_tool
Created March 8, 2016 16:19
LTI Testing Tools
http://ltiapps.net/test/tc.php http://ltiapps.net/test/tp.php
@mrpatrick
mrpatrick / mysqlcli_sphoinx
Created January 20, 2016 20:03
Connect to sphinx from mysql commandline. Use sphinxQL
mysql -P9306 --protocol=tcp
@mrpatrick
mrpatrick / wp-cli_dockerize.sh
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 docker.io/avatarnewyork/dockerenv-apache:php56 docker-umask-wrapper.sh /.composer/vendor/wp-cli/wp-cli/bin/wp --allow-root --path=/var/www/html option update siteurl "http://MYPROJECTNAME.stage.avatarnewyork.com/"
docker run -e --user=apache -i -t -w /var/www/ --volumes-from MYPROJECTNAME_MYPROJECTNAME_1 --link MYPROJECTNAME_db_1:db_1 docker.io/avatarnewyork/dockerenv-apache:php56 docker-umask-wrapper.sh /.composer/vendor/wp-cli/wp-cli/bin/wp --allow-root --path=/var/www/html option update home "http://MYPROJECTNAME.stage.avatarnewyork.com/"
# 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 docker.io/avatarnewyork/dockerenv-apache:php56 docker-umask-wrapper.sh /.composer/vendor/wp-c
docker stats $(docker ps | awk '{if(NR>1) print $NF}')
@mrpatrick
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;