Fixing wifi dropouts on Raspbian / Raspberry Pi

From this article, if you’re using one of the Wifi dongles on a Pi 1 or 2 (Pi3 has built in wifi), you can prevent the random dropouts during periods of inactivity by:

sudo nano /etc/modprobe.d/8192cu.conf

and then paste in and save this:

options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

and then reboot.

Inline text replacement with sed

Replacing values in files is incredibly easy with sed. Here’s some examples:

 

sed 's/match/replace/g' file.txt

Find match, replace with replace, globally (all matches), in file.txt

 

sed 's/match/replace/g' file.txt > file2.txt

Same as before, but write results to new file, file2.txt

 

sed -n 's/match/replace/p' file.txt

-n suppresses output of the results, but /p prints out just the matching patterns that are replaced.

 

sed -i.old 's/match/replace/g' file.txt

Replace matches in the input file with inline replace (-i), renaming original file file.txt.old and writing inline replace results to file.txt

 

Taking screenshots on Raspbian / Raspberry Pi

Install scrot (if not already installed): sudo apt-get install scrot

To pick a window, run ‘scrot -s’ and then click on the window that you want to capture. Screenshot is saved in your home dir by default.