How to Prevent Raspberry Pi Zero from Blanking or Sleeping
I was setting up a Raspberry Pi Zero in an office to use for displaying a slide show of pictures on a TV in the waiting room and dismayed to learn it would constantly go to sleep after a few minutes. I researched and tried setting the consoleblank=0 in config.txt with no luck along many other solutions, but learned none of them worked for the Raspberry Pi Zero.
sudo apt-get update && sudo apt-get install xscreensaver
I’m not sure why, but I got an error that some dependencies were not installed. If that happens to you as well, run this command in terminal:
sudo apt-get --fix-missing
and then run the install for xscreensaver again
sudo apt-get install xscreensaver
NowĀ under Preferences, you’ll see a new option for screen saver:
On the Display Modes tab, you’ll see a drop down for Mode. Choose “Disable Screen Saver”:
Your raspberry pi zero will now no longer go to sleep.
One-line snippet to update linux and apps on Ubuntu using apt-get
I find myself using this command on Digitalocean droplets fairly often and am sharing in case anyone else finds it useful. Use this one line to install all updates, security fixes, and system upgrades.
sudoĀ apt-getĀ updateĀ &&Ā sudoĀ apt-getĀ upgrade &&Ā sudoĀ apt-getĀ dist-upgrade
How to test email sending in Laravel 5.3 using artisan tinker
I’m building a Laravel app and ran into an error when trying to send mail but wasn’t getting an error back since the request was postedĀ through ajax. If you’re trying to troubleshoot it, artisanĀ tinker app is very useful to get more information on the error.
Fire up terminal/command line and run:
php artisan tinker
and then run the following snippet:
\Mail::raw('hello world', function($message) {
$message->subject('Testing email')->to('test@example.org');
});
You should either see a success/null message if everything was correct, or an error with details on what went wrong.
The error I encountered required configuring 2FA in Gmail or you can choose setting the insecure app option up to send through Gmail for testing.
How to repair permissions on Linux Apache /var/www/html folder
I recently ran into an issue where I could no longer FTP files to my Linux droplet when multiple users were uploading to the server. The server kept the user as the owner despite me adding them to the www-data group. This fix comes from my ex-boss, James TomasinoĀ who was kind enough to provide some help since I was stumped.Ā I’m sharing in case anyone else runs into the same issue and finds it useful.
You’ll need to fire up terminal, ssh to the server, and then execute these commands:
cd /var/www sudo chmod 775 html sudo chgrp www-data html sudo chmod g+s html
+s makes permissions sticky so that all files will inherit from the parent directory. This was the setting I was missing.
Open upĀ /etc/ssh/sshd_config. I use nano so:
sudo nano /etc/ssh/sshd_config
Hit CTRL+W and look for “subsystem” which is typically located near the bottom of the file. Change
subsystem sftp /usr/lib/openssh/sftp-server
to
subsystem sftp /usr/lib/openssh/sftp-server -u 0002
If you already have files in the HTML folder, you’ll want to run these commands to reset the permissions:
cd /var/www/ sudo chgrp -R www-data html find . -type f -exec chmod 664 {} \; find . -type d -exec chmod 775 {} \;