Skip to content

Instantly share code, notes, and snippets.

@bvipul
Last active December 11, 2017 09:14
Show Gist options
  • Save bvipul/c227756faba03be60a534a2d4d367836 to your computer and use it in GitHub Desktop.
Save bvipul/c227756faba03be60a534a2d4d367836 to your computer and use it in GitHub Desktop.
General Commands used daily
//For defining specTest Class using phpspec
//The Main Spec Class would be prompted to you when running below command
bin/phpspec describe primeFactors
//For running tests
bin/phpspec run
//update npm
npm i -g npm
//use fuser to kill process at ports
fuser [port]/tcp
//then
kill whichever port
//Stash changes in branch
git stash //make stash of current branch
git stash pop [<stash>] // get the stash name by calling git stash list
//making migration
php artisan make:migration migration_name --table= || --create=
//crontab entry
* * * * * php /var/www/html/[project]/artisan schedule:run 1>> /dev/null 2>&1
//rsync command for remote to local file transfer
rsync -azP user@server:[path].[ext] [path].[ext]
//DB import command if .gz (zip) is available
zcat [path_of_file].sql.gz | mysql -u 'root' -p [db_name]
//DB import command
mysql -u root -p [db_name] < [path_of_file].sql
//DB export command
mysqldump -u [user] -p [db_name] [,--routines] > [path_of_file].sql
//DB export command with gzip
mysqldump -u userName -p (passwordPrompt) yourDatabaseName | gzip -c > output.gz
//Taking backup of DB command in php
system('mysqldump --opt -h ' . env('DB_HOST') . ' -u ' . env('DB_USERNAME') . ' -p\'' . env('DB_PASSWORD') . '\' ' . env('DB_DATABASE') . ' --routines > ~/Desktop/export.sql');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment