Export image file statistics to csv

To get a CSV export of all image files with name, last access date, last change date, last modification date and filesize in byte in a folder including all subfolders, you can use this linux command: $> find . -regex “.*\.\(jpg\|gif\|png\|jpeg\)” -type f -printf “%p,%AY-%Am-%AdT%AT,%CY-%Cm-%CdT%CT,%TY-%Tm-%TdT%TT,%s\n” > filestat_data_20141201.csv or separated by tabs: $> find . -regex […]

Get Mailcatcher working on Linux

To get Mailcatcher (http://mailcatcher.me/) running under PuPHPet-based Vagrant (http://puphpet.com) I had to implement the following shell script in puphpet/files/startup-always/correct_mail_catcher.sh: #!/bin/sh sed -i “s/^sendmail_path=\/usr\/local\/rvm\/wrappers\/default\/catchmail -f$/sendmail_path=\/usr\/local\/rvm\/wrappers\/default\/catchmail -f mailman@local.sheldon.dev/g” /etc/php.d/zzzz_custom.ini echo “SET sendmail_path” The script adds a value to the -f param and that fixes the issue, that no mails are collected by mailcatcher. Versions: Vagrant: 1.6.2 Puppet: 3.4.3 OS: CentOS 6.5 (Final) / […]

Linux – Solve “Too many authentication failures for X” error

If you got the “Too many authentication failures for X” error on trying to connect to a server over ssh you can use the -o parameter to set the PubkeyAuthentication option to no. ssh -o PubkeyAuthentication=no root@host With that parameter your machine won’t try to send all your public keys any more on ssh connect. […]

Get a list of partitions

To get a list of your currently mounted partitions: $> sudo blkid -o list -w /dev/null Result device fs_type label mount point UUID —————————————————————————————————————————————————————————————- /dev/sda1 ext4 / 79012107-aeb7-4f72-95ca-a9ffaa9f502b /dev/sda5 swap <swap> 34e355d7-dd93-45f7-9696-02c6d4ebb8e8 /dev/sdb1 ntfs /media/7EEFE87C38D4D6CF 7EEFE87C38D4D6CF  

Linux – Get information about installed memory

On Ubuntu you’ll get the all memory (RAM) information with: $> cat /proc/meminfo Example output: MemTotal: 32829172 kB MemFree: 27614092 kB Buffers: 350460 kB Cached: 2232256 kB SwapCached: 0 kB Active: 2629788 kB Inactive: 1925788 kB Active(anon): 1989372 kB Inactive(anon): 443036 kB Active(file): 640416 kB Inactive(file): 1482752 kB Unevictable: 6056 kB Mlocked: 6056 kB SwapTotal: 0 […]

Copy system image to SD-Card

To get a bootable SD-Card from an image file (*.img) you can run teh dd command like tahe $> sudo dd if=/home/bravehartk2/Dropbox/Elektrotechnik/Banana/Raspbian_For_BananaPi_v3_0.img of=/dev/mmcblk0 bs=1M && sync This creates the necessary boot bartition and system partition on device  /dev/mmcblk0. To get a list of your mounted partitions look here.  

Associative arrays (hash, dictionary) on bash

This is how to create associative arrays (hash, dictionary) on bash: #!/bin/bash if [ “$1” == “help” ] then echo “Help”; echo “USAGE:”; echo “========”; echo “purge_landingpage_varnish.sh LIVE|STAGE”; exit 0; elif [ $1 ] then DOMAINS[‘LIVE’]=”www.ask-sheldon.com”; DOMAINS[‘STAGE’]=”stage.ask-sheldon.com; REQUEST_DOMAIN=””; if [ “$1” == “LIVE” -o “$1” == “STAGE” ] then REQUEST_DOMAIN=${DOMAINS[“$1”]}; else echo “You have to give […]

SSH key authentication

Generate ssh key $> ssh-keygen Start ssh agent $> ssh-agent /bin/bash Add ssh key $> ssh-add ~/.ssh/id_rsa List all used ssh keys $> ssh-add -l Show public key $> cat ~/.ssh/id_rsa.pub Copy key to remote host via ssh $> ssh-copy-id -i id_rsa.pub ssh-user@host.domain If ssh-copy-id isn’t available on the respektive system, you can use the […]