Check These Out
The same as the other two alternatives, but now less forking! Instead of using '\;' to mark the end of an -exec command in GNU find, you can simply use '+' and it'll run the command only once with all the files as arguments.
This has two benefits over the xargs version: it's easier to read and spaces in the filesnames work automatically (no -print0). [Oh, and there's one less fork, if you care about such things. But, then again, one is equal to zero for sufficiently large values of zero.]
eg:
Already running cmd
$sleep 120
Substitution cmd
$c=$(pgrep sleep) && sleep 5 && kill $c
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"
}
Doubt it actually generates valid mac addresses but this version doesn't need any external commands so it runs much faster.
Much shorter as well.
Very simple web server listening on port 80 will serve index.html file or whatever file you like pointing your browser at http://your-IP-address/index.html for example.
If your web server is down for maintenance and you'd like to inform your visitors about it, quickly and easily, you just have to put into the index.html file the right HTML code and you are done! Of course you need to be root to run the command using port 80.
Put it into your sh startup script (I use
alias scpresume='rsync --partial --progress --rsh=ssh'
in bash). When a file transfer via scp has aborted, just use scpresume instead of scp and rsync will copy only the parts of the file that haven't yet been transmitted.
Apart from an exact copy of your recent contents, also keep all earlier versions of files and folders that were modified or deleted.
Inspired by EVACopy http://evacopy.sourceforge.net
Uses the python-based AWS CLI (https://aws.amazon.com/cli/) and the JSON query tool, JQ (https://stedolan.github.io/jq/)
Shorten any Url using bit.ly API, using your API Key which enables you to Track Clicks
I have it as a Function in my .bash_aliases
[code]
shorten ()
{
longUrl=$1;
curl "http://api.bit.ly/shorten?version=2.0.1&longUrl=LONG_URL_YOU_WANT_SHORTENED&login=rungss&apiKey="
}
[/code]
Here is an Output showing the Function Detail..
[konsole]
bijay@bijay:$ type shorten
shorten is a function
shorten ()
{
longUrl=$1;
curl "http://api.bit.ly/shorten?version=2.0.1&longUrl=$longUrl&login=rungss&apiKey=R_48d7e0b40835b09e3861bd455f7abec7"
}
[/konsole]