Debugging latency using curl
I had an issue recently where I had to debug why a request to a website was taking such a long time. After a bit of searching around, I found the following bit of code:
I had an issue recently where I had to debug why a request to a website was taking such a long time. After a bit of searching around, I found the following bit of code:
Multiple times I've had to extract certificates from PFX files, and have them converted to PEM. This little script does everything:
To convert a Putty public SSH key to an OpenSSH public key, run:
I encountered an issue today where someone requested that we keep the 10 newest backup files, while the rest of them (the oldest) were deleted. So I made this little script:
#!/bin/bash
FILE_DIR="/home/jorge/backup/"
NUMBER_OF_FILES="$(ls -t $FILE_DIR | wc -l)"
RETAIN=10
if [ "$NUMBER_OF_FILES" -ge "$RETAIN" ]; then
cd $FILE_DIR
ls -t | sed -e "1,$RETAIN d" | xargs rm -f
fi
This can be modified to match with any type of file or filename.
I have been working with Linux for years, and I've always used screen when working in the terminal. I even wrote a small introduction to screen over 10 years ago.
So you can imagine my surprise when I at a very late point found out about tmux. It has completely changed the way I work, and boy do I love it.
To delete all files in a directory, between two dates, use the find command: