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"
}
This function takes a word or a phrase as arguments and then fetches definitions using Google's "define" syntax. The "nl" and perl portion isn't strictly necessary. It just makes the output a bit more readable, but this also works:
$define(){ local y="$@";curl -sA"Opera" "http://www.google.com/search?q=define:${y// /+}"|grep -Po '(?/dev/null;}
M - current revision, N - older revision
Converts a number of bytes provided as input, to a human readable number.
A function for streaming youtube to mplayer.
The option "-g" for youtube-dl tells it to output the direct video URL, instead of downloading the video.
"-fs" tells MPlayer to go FullScreen, and "-quit" makes it less verbose.
Requires: youdube-dl ( http://bitbucket.org/rg3/youtube-dl/ )
(Tested in zsh)
Create/open/use an encrypted directory
encfs needs to be installed
During creation easiest to use default values
The encrypted files will be in ~/.crypt and you will work as usual in ~/crypt
To close the encrypted directory run:
fusermount -u ~/crypt
When you switch off the computer the encrypted directory will be automatically closed
This example uses /home/user/crypt as encrypted directory
I use ubuntu linux 8.04 and I am also the creator of www.minihowto.org
can show module other
Look for an rpm that supplies a specific file that you don't yet have installed.
extremely useful when you need something and don't know where it is.. or what its called.
note: uses grep like syntax.
If your admin has disabled Apache's directory index feature but you want to have a cheap way to enable it for one folder, this command will just create an index.html file with a link to each file in the directory (including the index.html file, which is not ideal but makes the command much simpler). The HTML isn't even remotely compliant, but it could easily be improved on. Also, the command needs to be run each time a file is added or removed to update the index.html file.
Goes through all files in the directory specified, uses `stat` to print out last modification time, then sorts numerically in reverse, then uses cut to remove the modified epoch timestamp and finally head to only output the last 10 modified files.
Note that on a Mac `stat` won't work like this, you'll need to use either:
$ find . -type f -print0 | xargs -0 stat -f '%m%t%Sm %12z %N' | sort -nr | cut -f2- | head
or alternatively do a `brew install coreutils` and then replace `stat` with `gstat` in the original command.