Check These Out
In this example 'git' is the user name and the output format is YAML but you can change this to XML or JSON, eg: curl http://github.com/api/v1/json/usernamehere
You can ask repeatedly for a non-blank password using this function:
function read_password() {
while [ ! -n "$USER_PASSWORD" ]; do
read -s -p"Password: " USER_PASSWORD
if [ ! -n "$USER_PASSWORD" ]; then
echo "ERROR: You must specify a valid password, please try again"
fi
echo
done
}
Also you can set a time out (in seconds) to write the password
read -t 10 -s -p"Password: " USER_PASSWORD_VARIABLE
if [ ! $? -eq 0 ]; then
echo "Time out!"
fi
Fir3net.com
In this example, file contains five columns where first column is text. Variance is calculated for columns 2 - 5 by using perl module Statistics::Descriptive. There are many more statistical functions available in the module.
in loop, until the last port (65535), list all opened ports on host.
in the sample I used localhost, but you can replace with any host to test.
This set of commands was very convenient for me when I was preparing some xml files for typesetting a book. I wanted to check what styles I had to prepare but coudn't remember all tags that I used. This one saved me from error-prone browsing of all my files. It should be also useful if one tries to process xml files with xsl, when using own xml application.
I have come across a situation in the past where someone has unlinked a file by running an 'rm' command against it while it was still being written to by a running process.
The problem manifested itself when a 'df' command showed a filesystem at 100%, but this did not match the total value of a 'du -sk *'.
When this happens, the process continues to write to the file but you can no longer see the file on the filesystem. Stopping and starting the process will, more often than not, get rid of the unlinked file, however this is not always possible on a live server.
When you are in this situation you can use the 'lsof' command above to get the PID of the process that owns the file (in the sample output this is 23521).
Run the following command to see a sym-link to the file (marked as deleted):
$ cd /proc/23521/fd && ls -l
Truncate the sym-link to regain your disk space:
$ > /proc/23521/fd/3
I should point out that this is pretty brutal and *could* potentially destabilise your system depending on what process the file belongs to that you are truncating.
This is a two part command that comes in really handy if you're running commands that take longer than you're willing to wait. The commands are separated by the semicolon(;) The first command is whatever you're attempting to do. The second commands emails you after the job completes.
Creates a new video file with video stream copied from input file and a different audio stream
This command will format your alias or function to a single line, trimming duplicate white space and newlines and inserting delimiter semi-colons, so it continues to work on a single line.