Check These Out
Using the sed -i (inline), you can replace the beginning of the first line of a file without redirecting the output to a temporary location.
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"
}
use vim like less command pager but with color highlighting = pretty :p
also u can use /usr/share/vim/vim73/macros/less.sh
Tries to switch all audio devices to the A2DP profile for optimal sound quality. Useful for bluetooth speakers and headphones that always power up in HSP/HFP mode. Note however that this command is only a shorthand for the GUI, so it cannot fix stubborn BT controllers that leave your device stuck in HSP mode until a manual re-coupling.
Find all pngs in directory structure and pngcrush them, none destructive. You can just remove the "{}.crush" part if you want destructive.
probably only works if you have one graphics card.
used this: http://www.cyberciti.biz/faq/howto-find-linux-vga-video-card-ram/
as reference
can be expanded, for example:
$ lspci -v -s `lspci | awk '/VGA/{print $1}'` | sed -n '/Memory.*, prefetchable/s/.*\[size=\([^]]\+\)\]/\1/p'
will just get the amount of prefetchable memory
compare to:
$ lshw -C display
which does not give the size (it does give byte ranges and you could calculate the size from that, but that's a pain)
Also uses a command which is not standard on linux; wheras lspci is a core utility provided by most systems
Lists all macros and their values defined by gcc.
If you want a password length longer than 6, changing the -c6 to read -c8 will give you 8 random characters instead of 6. To end up with a line-feed, use this with echo:
# echo `< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6`
Modern systems need higher strenght, so add some special characters:
# < /dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8
displays time in seconds since January 1, 1970 UTC