Posts Tagged with tutorials
[update][tutorial] reduce memory usage in Google Chrome Browser
Google Chrome informed me that the great suspender extension contains malware. Here is a screenshot of the malware alert.
I installed this extension to save memory by suspending inactive tabs. But Google Chrome browser, now, has a similar functionality, so, I don’t need this extension anymore.
I uninstalled the Chrome extension. Then checked Memory Saver option in Chrome Settings (as you can see in the below image).
Memory Saver option is to free up memory from inactive tabs.
[tutorial] How to rate limit http requests in Laravel ?
Rate Limiting is the process of limiting the number of requests per minute sent to a web application is often necessary to protect against attacks trying to saturate your server or to brute force authentication forms.
So Laravel framework has a rate limiting mechanism, which we will use now to rate limit http requests per minute for all routes or some of them. You can rate limit for all users or per user.
convert old('d') to $model->d in Laravel using regular expressions (RegEx)
While developing a website in PHP Laravel, I reused create.blade.php as edit.blade.php. So I need to edit some things, especially the input values.
In create.blade.php we use old('something') to retain the current <input> value by the user.
But in edit.blade.php we use $model->something to get the <input> value from the project backend.
So, I need to convert every old() to $model. But I am too lazy to rewrite all of them manually.
How to upgrade npm in Laravel Sail ?
When I stop the vite live server sail npm run dev of Laravel 10 by ctrl + c, the CLI tells me to upgrade npm with this message.
npm notice npm notice New patch version of npm available! 9.6.4 -> 9.6.5 npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.5 npm notice Run npm install -g npm@9.6.5 to update! npm notice Here is a screenshot of the npm upgrade notice.
Upgrade npm inside Laravel Sail Docker environment You can not just run npm install -g npm@9.
View time taken of last command in Fish shell
Just use $CMD_DURATION to get the time taken running the last command.
To make your prompt give you the elapsed time for every command you run in Terminal, add this function in your Fish config file ~/.config/fish/config.fish.
function fish_prompt; echo "$CMD_DURATION "; end The prompt will be like that.
I hope this helps you. You know someone will benefit from this, share it with him/her, a friend or colleage.
[Fixed] curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
This error appears in too many cases, for example: when you are trying to ..
upgrade Flutter via flutter upgrade. upgrade a homebrew cask via brew upgrade --cask --greedy. push to GitLab. curl some file from the internet. the errno 54 (error number 54) means “Connection reset by peer”, which basically indicates a generic network connectivity problem. So, It’s a network issue. If your internet is very slow and there are hiccups with network, you will face this error.
How can I convert MP4 video to MP3 audio with FFmpeg?
Sometimes, you need to extract audio or music from a video. Or you need to convert a video into an audio file. The command is simple. Here is the command to convert MP4 to MP3 file.
ffmpeg -i video.mp4 audio.mp3 Alternative commands to convert MP4 to MP3 file
ffmpeg -i video.mp4 -b:a 192K -vn music.mp3 or use this faster command (see benchmarks below).
ffmpeg -i video.mp4 -vn audio.mp3 You can use all of the above three commands to convert mp4 into mp3 on Mac OS or any Linux based operating system, but not on Ubuntu.
ssh Handshake Failed Unable to Authenticate | Github Actions
I have set up the github action to deploy laravel website using appleboy ssh-action but all actions failed with this weird error message.
2022/09/03 23:46:24 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain The fix is simple. just change the permission of authorized-keys by this command.
chmod 700 ~/.ssh/authorized_keys If it works, share it with a friend or colleage.
How to get your Mac's serial number?
Every Mac device has a serial number that tells its unique story. Mac serial numbers can show information such as purchase, manufacturing, or configuration details. However, they can also be a security risk when left unprotected.
Depending on if you can access the device, are logged into your Apple account, or still have the original packaging, there are several ways to check your Mac’s serial number.
Check the Underside of Your Mac Serial numbers are printed or engraved on the underside of your iMac, MacBook, or Mac Mini.
10 Things You Must Do After Buying a New Mac
Set Up Your Apple ID When you set up your Mac, you’re required to sign in to your Apple account. If you skipped it earlier, now is the time to do it via the Apple menu > System Preferences > Sign In.
You can’t use the App Store, download updates, or use iCloud without logging into an Apple ID, so you definitely should.
Activate Service and Support Coverage A key thing to do is activate your Mac’s Service and Support Coverage.