Check These Out
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
Works recusivley in the specified dir or '.' if none given.
Repeatedly calls 'find' to find a newer file, when no newer files exist you have the newest.
In this case 'newest' means most recently modified. To find the most recently created change -newer to -cnewer.
I use terminal with black background on the Mac. Unfortunately, the default ls color for the directory is blue, which is very hard to see. By including the line above in my ~/.bash_profile file, I changed the directory's color to cyan, which is easer to see. For more information on the syntax of the LSCOLORS shell variable:
$ man ls
I tested this command on Mac OS X Leopard
The output of ifconfig is localized, using it will fail in non-English environment. "ip" command in iproute2 provides a consistent output and thus is more robust
(relies on 'imagemagick')
This command will convert all .pdf files in a directory into a 800px (wide or height, whichever is smaller) image (with the aspect ratio kept) .jpg.
If the file is named 'example1.pdf' it will be named 'example1.jpg' when it is complete.
This is a VERY worthwhile command! People pay hundreds of dollars for this in the Windows world.
My .jpg files average between 150kB to 300kB, but your's may differ.
Replace 'csv_file.csv' with your filename.
The only zipped version of an album available for download is the lossy mp3 version. To download lossless files, because of their size, you must download them individually. This command scrapes the page for all the FLAC (or also SHN) files.
This command generates a pseudo-random data stream using aes-256-ctr with a seed set by /dev/urandom. Redirect to a block device for secure data scrambling.
This commando copies the file (which must reside in the current directory) to //<server>/<share-name>/<subdirectory>/<file> through the CIFS protocol (Samba share or Windows Share). It doesn't require you to mount the filesystem first.
--directory "<subdirectory>" may be omitted in order to copy the file the the root of the share.
The "%password" part may also be omitted. If doing so, smbclient will ask for the password interactively.
To copy a file from a Windows/Samba share, change "put" for "get".
$ smbclient --user=user%password --directory "<subdirectory>" --command "get <file>" //<server>/<share-name>