In this tutorial, we gonna download YouTube live stream video in chunks for the given interval. We gonna run few commands in the terminal for this task, you can use any programming language to do the same to automate things. FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. Using… Continue reading How to download YouTube live stream video in chunks
Category: Unix/Linux
How to create an SSH shortcut
In this post, I would like to show you a quick way to SSH into VMs. Using this approach you don’t have to type ssh -i ..etc every time. Let’s open your ~/.ssh file and create a file called config and copy below shown text to it,
1 2 3 4 5 6 7 8 9 10 |
Host app HostName ec2-xxxxx.us-east-2.compute.amazonaws.com User ubuntu Port 22 IdentityFile ~/.ssh/arjunphp-app.pem Host jenkins Hostname ec2-xxxxx.us-east-2.compute.amazonaws.com User ubuntu IdentityFile ~/.ssh/arjunphp-jenkins.pem |
If you get Permission denied issues, change the file… Continue reading How to create an SSH shortcut
How to send emails from shell script using sendgrid
In my recent project, we have developed a small process monitoring system to check the health of the process and it should send emails if the process goes down. For sending emails we have used SendGrid and below is the shell script model which we have used to send the email.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
#!/bin/bash SUBJECT=""; SENDGRID_API_KEY="" EMAIL_TO="" FROM_EMAIL="" FROM_NAME="" MESSAGE=""; REQUEST_DATA='{"personalizations": [{ "to": [{ "email": "'"$EMAIL_TO"'" }], "subject": "'"$SUBJECT"'" }], "from": { "email": "'"$FROM_EMAIL"'", "name": "'"$FROM_NAME"'" }, "content": [{ "type": "text/plain", "value": "'"$MESSAGE"'" }] }'; curl -X "POST" "https://api.sendgrid.com/v3/mail/send" \ -H "Authorization: Bearer $SENDGRID_API_KEY" \ -H "Content-Type: application/json" \ -d "$REQUEST_DATA" |
How to disable IPv6 on Ubuntu
In this post, I will show you disabling IPv6 on your Ubuntu machine. Before going further, let’s check the current status of the IPv6 on your machine. To check the status, open up the terminal and enter the following command /proc/sys/net/ipv6/conf/all/disable_ipv6 if the return value is 1, then IPv6 is already disabled and if the… Continue reading How to disable IPv6 on Ubuntu
How to delete files older than X days in Linux
In this post, I am gonna show you how to write a simple shell script to delete files from a directory if the files are older then X days. We gonna use find utility function to search and find the files from the given specific directory. Command to delete files older then 10 Days
1 |
$ find /var/www/app/csv -type f -name *.csv -mtime +10 -exec rm {} \; |
… Continue reading How to delete files older than X days in Linux
How to install the management plugin, RabbitMQ
By default, RabbitMQ does not embed a web-based management console but offers it as an optional plugin. This management console makes it very easy to peek into a running RabbitMQ instance, so we definitely want to have it installed from the get-go. The Debian package has installed several scripts, one of them being rabbitmqplugins, whose… Continue reading How to install the management plugin, RabbitMQ
How to install and setup RabbitMQ on Ubuntu 16.04
In this post, I will show you how to install RabbitMQ on Ubuntu 16.04. We can install RabbitMQ easily using Ubuntu’s package manager, apt. The apt is package manager allows us to install most software pain-free from a repository maintained by Ubuntu. What is RabbitMQ? RabbitMQ is a robust messaging system for building applications and… Continue reading How to install and setup RabbitMQ on Ubuntu 16.04
.dockerignore
In this post will show you how to use the .dockerignore. It will help reducing Docker image size, speedup docker build and avoid unintended secret exposure. .dockerignore behaviors same as .gitignore, it removes the extra unwanted files from your image, so you only end up with the files you need for running your application. The… Continue reading .dockerignore
How To Stop and Remove All Docker Images, Containers, and Volumes
In this guide, I will show you simple tips to stop and remove containers, docker images, and values. List all Docker Images
1 |
docker images -q |
Removing Docker Image or images
1 2 3 4 |
// to remove one specific image docker rm image1 // to remove two (more) specific images, just mention list docker rm image1 image2 |
Removing All Docker Image
1 |
docker rmi $(docker images -q) |
Remove a container(s)
1 2 3 4 |
// to remove one specific container docker rm container1 // to remove two (more) specific container, just mention list docker rm container1 container2 |
Remove a container and its volume
1 |
docker rm -v container_name |
List all containers (only IDs)
1 |
docker ps -aq |
Stop all running containers… Continue reading How To Stop and Remove All Docker Images, Containers, and Volumes
How to determine the version of bash
In this post, I would like to show you a very trivial example, which will help you to find the version of the bash that you are running. The easiest way to determine the version of bash that you are using is to print the value of an environment variable. The following command will display… Continue reading How to determine the version of bash