Skip to content

Instantly share code, notes, and snippets.

@zakgreene
Last active August 1, 2019 21:38
Show Gist options
  • Save zakgreene/ec8de7b8a124db93b26f to your computer and use it in GitHub Desktop.
Save zakgreene/ec8de7b8a124db93b26f to your computer and use it in GitHub Desktop.
Cheat sheet for common web dev commands

Web dev cheat sheet

Things I don't remember offhand and have to look up. Now they're all in one place.

Command line

Make a file executable

chmod +x [file path]

Copy a file

cp [original file path] [new path]

Move a file

mv [original file path] [new path]

SSH

ssh [username]@[host IP or domain] -p [port]

MySQL

Dump a database

mysqldump -h [host IP] -P [port] -u [db user] -p[db pass] [db name] > [local file path].sql

Wordpress

Create user in Wordpress database

INSERT INTO `[db-name]`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`, `display_name`) VALUES ('1000', 'tempuser', MD5('Str0ngPa55!'), 'tempuser', 'support@wpwhitesecurity.com', '0', 'Temp User');

Make user an admin

INSERT INTO `[db-name]`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '1000', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');

INSERT INTO `[db-name]`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '1000', 'wp_user_level', '10');

Git

Change remote URL

git remote set-url [remote name] [URL]

Undo a commit while keeping changes to files

git reset --soft HEAD [file path]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment