exiftool: renaming pictures

rename pictures according to their exifdata time stemp:

exiftool "-FileName<CreateDate" -d "%Y%m%d_%H%M%S_%%c.%%e" .

http://www.sno.phy.queensu.ca/~phil/exiftool/#filename

 

Advertisements

raspi: log network traffic (vnstat)

to monitor the network traffic one can use the tool vnstat

  1. install vnstat
  2. setup database for interface: vnstat -u -i eth0
  3. start/enable service
  4. usage: update database: vnstat -u
  5. usage: query database: vnstat -q

troubleshooting: when systemctl status shows that database couldnt be created, just do this:

sudo chown -R vnstat:vnstat /var/lib/vnstat

source: wiki.archlinux.org

raspi: automatically spin external hdd down

the raspberry pi cannot spin external hard drives down. the program hdparm worked perfectly for me.

i followed this guide (htpcguides.com). just some slight little twitch i found on some other website: the device path in the /etc/hdparm.conf file should rather be the one from /dev/disk/by-uuid/… as the raspi might mount the external drive to different /dev/sdX paths. furthermore, the drive shouldnt be spun down more than need be. dont choose any spindown times lower than 15min.

$ cat /etc/hdparm.conf
/dev/disk/by-uuid/ffd9b0a1-931f-4795-85ba-28c58719a938 {
	spindown_time = 180
	write_cache = on
}

Note: The spindown_time value is multiplied by 5 and you have the total time in seconds. So a value of 120 yields 10 minutes (120*5=600).

the power managment (should the drive even be spun down) is set via the “advanced power managment” (-B) flag.

From ArchWiki: Set the Advanced Power Management feature. Possible values are between 1 and 255, low values mean more aggressive power management and higher values mean better performance. Values from 1 to 127 permit spin-down, whereas values from 128 to 254 do not. A value of 255 completely disables the feature.

for example: $ sudo hdparm -B 127 /dev/sda

raspi: install torrent server

the raspberry pi is a perfect device for a 24/7 torrent server. one can install the torrent server: deluge.

i followed this guide (howtogeek.com) to install the deluge server, accessible via deluge-console and deluge thin-client (remote).

in short:

sudo apt install deluged deluge-console
deluged
sudo pkill deluged
nano ~/.config/deluge/auth
deluged
deluge-console: {
config -s allow_remote True
config allow_remote
exit }
sudo pkill deluged
deluged

Start deluge daemon at bootup (follow this guide: link):

  1. remove script from /etc/init.d/deluge…
  2. create systemctl unit
  3. enable unit file

git ignore files (especially global)

one can create gitignore files for specific repos and also globally.
github offers gitignore templates for lots of different things: frameworks, languages, editors, operating systems, etc. (link: github-ignore-templates).

the templates should be copied to some file (~/.gitignore_global) and applied with this command:
git config --global core.excludesfile ~/.gitignore_global

examples: