How to spin down USB hard drive for safe removal

Let’s assume you are running a Debian-based system and have a hard drive at /dev/sdc with a partition /dev/sdc1
mounted. To safely remove the hard drive, first you need to unmount all its
partitions. In this case you may do:

udisks --umount /dev/sdc1

and then spin the disk down with:

udisks --detach /dev/sdc

You should the notice (usually, hear) the disk spin down.

Please note, that we are referring here to the device sdc not its partition

Thanks, user76204.

Remove all .pyc files from a git repository

When working on Python project you may sometimes forget to .gitignore your
*.pyc files and end up having them tracked by the repo.

To fix this you need use git rm:

find . -name "*.pyc" -exec git rm -f {} \;

Then, add a line:


to the .gitignore file in the repository root to have them permanently

Credit goes to Yuji.