Snippets of all helpful commands
Run this after clone to restore state
ionic state restoreImport large database
mysql> SET GLOBAL FOREIGN_KEY_CHECKS=0;
mysql -h yourhostname -u username -p databasename < yoursqlfile.sql
mysql> SET GLOBAL FOREIGN_KEY_CHECKS=1;(with progress bar)
pv yoursqlfile.sql | mysql -uxxx -pxxxx databasenameExport/dump database
mysqldump -u username -p dbname > dbexport.sqlUpdate MySQL server version to 5.6
sudo apt-get purge mysql-server*
sudo apt-get install mysql-server-5.6Dump specific table
mysqldump -u root -p dbname tablename > db_table.sqlDump specific table with limited rows
mysqldump -u root -p dbname tablename --where="true limit 100" > db_table.sqlDump database skipping specific table
mysqldump -u USERNAME -p PASSWORD DATABASE --ignore-table=DATABASE.table1 > database.sqlExport the entire database structure, but exclude certain tables data from export
mysqldump -u USERNAME -p PASSWORD DATABASE --ignore-table=DATABASE.table1 > table1_exluded_database.sql
mysqldump -u USERNAME -p PASSWORD DATABASE table1 --no-data > table1_only_no_data.sqlJust for reference: https://gabi.dev/2016/05/17/fast-data-import-trick/
Install Specific Version (e.g 5.2)
// Create a Laravel project
composer create-project laravel/laravel projectName "5.2.*"
// Create a Lumen project
composer create-project laravel/lumen projectName "5.2.*"Generate Key
php artisan key:generateDisable CSRF token for a specific url Go app/Http/Middleware, Open VerifyCsrfToken.php. Add the url in the following block for which token verification will be disabled.
protected $except = [
‘api/*’,
‘task/saveTask’,
];To access project from other device, run this within your project root
php -S 192.168.0.104:8000 -t publicToken mismatch with AJAX post In head section that is common to every page, add the following line:
<meta name=”_token” content=”{!! csrf_token() !!}”/>Call ajax in the following way.
$.ajax({
type: “POST”,
headers: {‘X-CSRF-Token’: $(‘meta[name=_token]’).attr(‘content’)},
url : “url where you want to submit”,
data : dataString,
success : function(status) {
}
});Create Model from existing database
composer require reliese/laravel
Add the service provider to your config/app.php file Reliese\Coders\CodersServiceProvider::class . Publish the config file with php artisan vendor:publish --tag=reliese-models . Make sure your database is correctly configured in config/database.php and .env files. And finally issue the command: php artisan code:models. This package will scan your database and create all models for you.
500 Internal Server Error
For solving the problem run following commands through terminal.
sudo chmod 755 -R laravel_blog
and then type below command to allow laravel to write file to storage folder
chmod -R o+w laravel_blog/storage
This two commands solves the problem. :D
Create tar.gz
tar czf new-tar-file-name.tar.gz file-or-folder-to-archiveExtract tar.gz
tar -xzf tar-file-name.tar.gzRun command from history
history
!800 //use number of command you want to runSearch from history Use Ctrl+R in terminal & search for expected command
Clear cache
sync && echo 3 | sudo tee /proc/sys/vm/drop_cachesInstall deb file using terminal
sudo dpkg -i app_to_install.deb && sudo apt-get install -fList Wifi hotspot connected devices
arp -a**ssh into host
ssh user@sitename.com -p portNo**Delete numbered files in a given range
rm filename.php.{100..200}Check available language syntax for md (https://support.codebasehq.com/articles/tips-tricks/syntax-highlighting-in-markdown)