Categories
Tech Tips

How to find files modified more than X days ago

search

Find files modified more than 48 hours ago:

$ find /path -mtime +1

Find files modified more than n=90 days ago (cutoff by the hour, not the day).

$ find /path -mtime +89

Note the +(n-1) in command. Many online articles got this wrong by simply putting +90.

Categories
Tech Tips

How to turn off Facebook’s “Do you know so-and-so” (and other) notifications on Android

  1. Open the Facebook app
  2. Click on the hamburger button (displayed as ≡) near the top-right corner of screen
  3. Scroll down and tap on Account Settings > Notifications
  4. Under the “How You Get Notifications” section, select “Mobile”
  5. Tap on the notifications that you want to turn off
Categories
Tech Tips

How to prevent accidental keyboard input in a Linux terminal

In a multi-monitor setup, sometimes I type in the wrong window without knowing and end up spamming WeeChat IRC.

To prevent that, I now use gnome-terminal and turn on “Read-Only” mode to disable typing. This useful feature is, however, not available in other terminals. Please share in the comments if you know of alternatives.

2018 Mar 27 UPDATE: xfce4-terminal also has a “Read-Only” mode.
2018 May 7 UPDATE: konsole too.

Categories
Tech Tips

How to change sshd default port on firewalld

Instead of messing around with the ports directly with RHEL7/CentOS7 firewall-cmd, I’ve decided to update the port number in the ssh.xml service file instead. Think it’s cleaner this way.

For example, here are the steps to change sshd port from the default 22 to 9876:

1. Make a copy of the default ssh service file:
cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/

2. Inspect current firewall settings
iptables -nL | grep -e 22 -e 9876
ACCEPT     tcp  —  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 ctstate NEW

3. Edit /etc/firewalld/services/ssh.xml to change port number
From: <port protocol=”tcp” port=”22″/>
To: <port protocol=”tcp” port=”9876″/>

4. Change /etc/ssh/sshd_config port to 9876

5. Restart sshd
systemctl restart sshd

6. Notice that sshd now listens on new port
netstat -punta

7. Reload firewalld, which will pick up the new port in ssh.xml
firewall-cmd –reload

8. Inspect new firewall settings, notice port changed
iptables -nL | grep -e 22 -e 9876
ACCEPT     tcp  —  0.0.0.0/0            0.0.0.0/0            tcp dpt:9876 ctstate NEW

9. Test

Categories
Tech Tips

Cannot download HP printer driver using Chromium/Firefox on Linux

Problem: Somehow the “Software & Drivers” option does not show up when I try to download the printer driver of HP LaserJet Pro MFP M127fn from the official HP website using Chromium, Firefox, Opera and most web browsers on Linux.

Solution: Use Konqueror on Linux or another OS.

Categories
Tech Tips

Wordfence update failed: Could not copy file

If your Wordfence is not updating to newer version properly due to “Could not copy file” error, try deleting the leftover folder “wordfence.tmp” from /path-to-webroot/wp-content/upgrade/wordfence.tmp, then try again.

Categories
Tech Tips

How to reset lost root password on Raspberry Pi running Arch Linux

Assumption: SD is not encrypted

Plug SD onto another working computer, look for the “cmdline.txt” file and edit it by appending “init=/bin/sh” after “rootwait”. Save the file, remove the SD and plug it back to the RPi and boot.

You’ll be dropped into a shell. Change your passwd, then hit CTRL-ALT-DEL to trigger a reboot. Switch off the RPi when the shutdown completes, just before the boot starts. Unplug the SD and plug it onto the other working computer. Remove “init=/bin/sh” from “cmdline.txt” file.

Plug the SD back onto the RPi, boot and you can now login with the newly reset password.

Categories
Tech Tips

How to fix network print queue installation error 0x0000007e on Windows

Printer-Error

Problem:

The print queue of a HP printer on a Windows 2003 Server (clustered) already has its 32-bit driver installed.

For my new 64-bit Windows 7 client to use the print queue, I installed the 64-bit printer driver on the server.

However, when I connect to the print queue on the 64-bit Windows 7 client, at the end of the installation, it will fail with error:

Windows cannot connect to the printer
Operation failed with error 0x0000007e

Solution:

Delete the “CopyFiles” key from HKLM\Cluster\Resources\<LongString>\Parameters\Printers\<QueueName>

Non-clustered server may have the key at HKLM\SYSTEM\CurrentControlSet\Control\Print\Printers\<QueueName>. Just do a search in regedit using your QueueName to find the right location.

Remember to backup the key before changing the registry.

Categories
Tech Tips

How to stop IBus from removing your xmodmap mappings


If the use of IBus removes your xmodmap keymaps in X, try enabling the “Use system keyboard layout” option under the “Advanced” tab in the IBus Preferences.

Versions:
– ibus 1.5.5-1
– xorg-xmodmap 1.0.8-1

Categories
Tech Tips

Why is Chrome browser not saving my WordPress login


Some WordPress plugins that protect your login page may be the culprit. Try disabling them to see if Chrome prompts to save the login. Don’t forget to re-enable them after you’ve managed to save your password in Chrome.