3rd December 2015
Midnight Commander is a convenient two-panel file manager with tons of features.
You can create hard links and symbolic links using C-x l and C-x s keyboard shortcuts. However, these two shortcuts invoke two completely different dialogs.
While for C-x s you get 2 pre-populated fields (path to the existing file, and path to the link – which is pre-populated with your opposite file panel path plus the name of the file under cursor; simply try it to see what I mean), for C-x l you only get 1 empty field: path of the hard link to create for a file under cursor. Symlink’s behaviour would be much more convenient…
Fortunately, a good man called Wiseman1024 created a feature request in the MC’s bug tracker 6 years ago. Not only had he done so, but he had also uploaded a sample mc user menu script (local copy), which works wonderfully! You can select multiple files, then F2 l (lower-case L), and hard-links to your selected files (or a file under cursor) will be created in the opposite file panel. Great, thank you Wiseman1024!
Word of warning: you must know what hard links are and what their limitations are before using this menu script. You also must check and understand the user menu code before adding it to your mc (by F9 C m u, and then pasting the script from the file).
Word of hope: 4 years ago Wiseman’s feature request was assigned to Future Releases version, so a more convenient C-x l will (sooner or later) become the part of mc. Hopefully.
Posted in *nix, how-to, Notepad | No Comments »
26th July 2015
A few days ago, my Mi Band (version 1) stopped properly tracking sleep and counting steps. Here is a full list of symptoms:
- synchronization appears to work correctly;
- total count of steps is updated, but when you click it – there are no per-hour details;
- in the older app version: after sync completes, there is no green message “Updated X items”;
- night sleep tracker does not update at all: neither total hours slept, nor per-hour details;
- the band is otherwise functional, e.g. “Find the band” works – it vibrates and flashes diodes.
Warangelo00 found a solution, which worked for me (and no, you do not need to hard reset the device):
note: the fix below will most probably not work for Mi Band 2, see comments; iPhone owners may try switching iPhone from AM/PM (12-hour clock) to 24-hour clock to fix the non-synchronization problems with MiBand2 – please write in the comments if this method works for you.
- enable Bluetooth, if it is disabled;
- start Mi Fit, go to Play –> Incoming call (or, in older app version, Settings – Incoming calls);
- enable it – set to On;
- now call your mobile phone from a different one – wait for the band to vibrate and flash lights;
- you should now be able to refresh Mi Fit main page, and see both current day and previous night per-hour details; in the older app version, it should also show the green “Updated X items” message after syncing;
- you can now disable incoming calls notification if you don’t need it.
According to Holly, the trick may also work for Mi Pulse.
Not sure if this fix will last, but it did help me – thanks, Warangelo00!
Posted in Hardware, how-to | 42 Comments »
28th February 2015
After fixing offline uncorrectable sector warning email, I have taken a closer look at my /etc/smartd.conf, and now it looks like this:
DEFAULT -d sat -H -f -p -t -W 0,40,45 -n standby -S on -m email@example.com
# Attributes 1, 230, and 231 are very important (-r 1! -r 230! -R 230! -r 231! -R 231!), but likely covered by -t.
/dev/sda -s (S/../../6/01|L/../(01|02|03|04|05|06|07)/7/00) -C 0 -I 189 -I 194
# -a implies -f and -p (through -t)
DEFAULT -d sat -a -I 194 -W 0,40,45 -n standby -o on -S on -m firstname.lastname@example.org
/dev/sdb -s (S/../../6/02|L/../(01|02|03|04|05|06|07)/7/02)
# This drive does not decrement Offline_Uncorrectable (198) after re-allocation,
# so only monitoring for increase, not for non-zero value.
/dev/sdc -s (S/../../6/03|L/../(01|02|03|04|05|06|07)/7/04) -U 198+
# This drive has 40 “normally”.
/dev/sdd -s (S/../../6/04|L/../(01|02|03|04|05|06|07)/7/06) -W 0,42,45
Note: explanations below are intentionally simplified; please consult man smartd.conf for more precise, complete, and up-to-date information.
Ok, so what do these settings mean, and how is this different from default settings?
Read the rest of this entry »
Posted in *nix, how-to, Notepad, Software | No Comments »
26th February 2015
A few days ago my smartd daemon (from the smartmontools package) notified me about a +1 increase in Current_Pending_Sector (197) and Offline_Uncorrectable (198) SMART attributes. The 2.5″ Fujitsu laptop hard-drive these appeared on is very old, and it also has been working 24/365 since a little over a year.
Running a short SMART self-test (
sudo smartctl -t short /dev/sdc) produced a read error at sector 1289:
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
1 Short offline Completed: read failure 80% 22339 1289
Looking at the partition table of /dev/sdc, we see that this sector is outside of the only RAID partition on the disk, which starts at sector 2048:
Device Boot Start End Blocks Id System
/dev/sdc1 2048 117209087 58605088 fd Lnx RAID auto
Read the rest of this entry »
Posted in *nix, how-to, Software | 1 Comment »
25th August 2014
There are quite a lot of posts on how to do this, but my differs a tiny little bit, so I’m saving it for my own future reference, and also for the benefits of the wider audience.
I am updating a multisite Drupal 6 installation. To the best of my knowledge, the only difference for Drupal 7 is that instead of the site_offline D6 variable the maintenance_mode variable is used in D7.
On Debian stable and later, you can
sudo aptitude install drush and then just use it immediately after that.
Note: I recommend
su webuser (or
sudo -s followed by
sudo -s -u webuser) before you run any non-testing drush commands, where webuser is the user which owns your web-exposed files (e.g. Debian’s default is, I think, www-data). I’ve seen a lot of recommendations to run drush as a super-user, but that does not make sense, and may actually cause problems with file ownership.
One last thing before we start: if your drush seems to work fine but hangs when untarring modules – check this solution.
Read the rest of this entry »
Posted in *nix, Drupal, how-to, Notepad, PHP, Programming, Software, Web | 1 Comment »
18th October 2013
The usual, or even classical way is to create the list of installed packages with
sudo dpkg --get-selections > package_list, and then restore when/if necessary with
cat package_list | xargs sudo apt-get -y install.
As VihangD points out in his serverfault answer, the same can be achieved with aptitude, while also excluding dependent, automatically installed packages (which are included by the classical method). To create the list of packages, run
aptitude search -F '%p' '~i!~M' > package_list. Here,
-F '%p' asks aptitude to only print package names (instead of the default output, which also contains package state and description); search term ‘~i!~M’ asks for all non-automatically installed packages.
To install packages using the created list, run
xargs aptitude --schedule-only install < package_list; aptitude install. The first of these two commands instructs aptitude to mark all the packages from the list as scheduled for installation. The second command actually performs the installation.
Hamish Downer suggests an alternative way of getting the initial package_list: using the deborphan utility,
deborphan -a --no-show-section > package_list. This command asks deborphan to show a list of packages, which have no dependencies on them. Sounds very similar to what we did with aptitude above, but using deborphan will most likely result in a much shorter list of packages (on my system, deborphan printed 291 package names, aptitude printed 847, and dpkg printed 3650 package names). One more potentially important difference between aptitude- and deborphan-produced package lists is that aptitude only specifies package architecture when it is different from native (e.g. 'googleearth:i386' on a 64-bit system), while deborphan specifies architectures for all the packages (resulting in e.g. 'google-talkplugin:amd64' and 'googleearth-package:all' on a 64-bit system).
Posted in *nix, how-to, Notepad | 2 Comments »
7th August 2013
SPF is nice for protecting your mail server from spam, but sometimes there is a need to bypass SPF checking. For example, if you rely on 3rd party servers to do spam protection for you
- MX records point to the spam protection mail servers, which then
- connect to my server and deliver (hopefully spam-free) mail.
Problem: some senders (like last.fm) do have proper, strict SPF records. Tumgreyspf on my server then rejects emails relayed through the spam-protection service.
If these spam protection relay servers are the only which send mail to your server, then it makes sense to fully disable/uninstall tumgreyspf. Putting tumgreyspf into the permanent “learning mode” (set
defaultSeedOnly = 1 in
/etc/tumgreyspf/tumgreyspf.conf) may not fix the SPF problem described above, as SeedOnly seems to only affect greylisting, and not rejecting unauthorized senders.
Solution: whitelist relay server IPs.
Read the rest of this entry »
Posted in *nix, how-to, Software | No Comments »