<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rajdatt kokate on Medium]]></title>
        <description><![CDATA[Stories by Rajdatt kokate on Medium]]></description>
        <link>https://medium.com/@rajdattkokate?source=rss-25e35f64f08------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*d6TfAFiirmVDZDjq</url>
            <title>Stories by Rajdatt kokate on Medium</title>
            <link>https://medium.com/@rajdattkokate?source=rss-25e35f64f08------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:29:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rajdattkokate/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Deploying Jenkins CI/CD on Kubernetes with Automation and Monitoring]]></title>
            <link>https://medium.com/@rajdattkokate/deploying-jenkins-ci-cd-on-kubernetes-with-automation-and-monitoring-02a7cb9b05b2?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/02a7cb9b05b2</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[jenkins-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Fri, 13 Oct 2023 14:46:38 GMT</pubDate>
            <atom:updated>2023-10-13T14:46:38.525Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYUS7Bcdy9Fh8Tb9pdzkpg.png" /></figure><p>Introduction: In today’s fast-paced software development environment, automation and efficient monitoring are key to successful Continuous Integration and Continuous Deployment (CI/CD) pipelines. Kubernetes, with its container orchestration capabilities, provides a great platform for deploying CI/CD tools like Jenkins. In this blog, we will walk you through the step-by-step process of deploying Jenkins on Kubernetes using an Operator, managing Jenkins pipelines as code, and implementing monitoring with Grafana Loki, Promtail, and Prometheus.</p><h3>Prerequisites:</h3><p>Before we get started, you’ll need the following:</p><ol><li>A running Kubernetes cluster.</li><li>kubectl command-line tool configured to access your cluster.</li><li>Helm for package management.</li><li>A basic understanding of Kubernetes and Jenkins.</li></ol><p><em>Let’s start🏌️‍♂️</em></p><h3>Cloud Setup</h3><ol><li>AWS cloud <a href="https://aws.amazon.com/">https://aws.amazon.com/</a></li><li>New User / Account: IAM user -&gt; power : policy: admin access</li><li>password (key) access / secret key</li></ol><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -</p><h3>CLI setup</h3><ol><li>Aws CLI download for Windows:</li></ol><pre>https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html</pre><p>2. login in CLI # aws configure</p><p>3. eksctl tool: To install Kubernetes</p><pre>https://github.com/eksctl-io/eksctl/releases/tag/v0.161.0</pre><p>4: store files in this Folder</p><p><strong>cd C:\Program Files\Kubernetes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*hm91HiZbINI61figwkgSeA.png" /></figure><p>Now create IAM User on Aws account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*paMk9ZpbPb4n6EdET6S4ew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*MHH1ClWo6Zf8qyEhJnnKSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*EQjm-HdEWTxgMENmsHpN_g.png" /></figure><p>Now copy this <strong>access key and secret key &amp; Now use this access key and secret key to configure AWS.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*LsaSslgm7fBHK36jlTPESw.png" /></figure><p>After configuring AWS, we will install <strong>eksctl</strong></p><p>Go to below link and download eksctl zip file for <strong>eksctl_windows_amd64.zip.</strong></p><p><a href="https://github.com/eksctl-io/eksctl/releases/tag/v0.162.0">Release eksctl 0.162.0 (permalink) · eksctl-io/eksctl</a></p><p>After downloading create a folder say<strong> awsekstools</strong> and extract downloaded data into that folder. And setup is environment variable path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJiOEH-pGvnt-ny-nGOxmA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*mN6gR077zIzJvwH2DXJqDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*AaLZziPEefKwb4vkFH0paA.png" /></figure><p>Now check it on your command line .By typing eksctl.exe version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*dfZiFwiKCbpq3q9y44fDig.png" /></figure><p>After successfull installation of eksctl step forward to helm &amp; Kubectl.</p><h3>Helm Installation</h3><p><em>Visit the official Helm Release page on GitHub.</em></p><p><a href="https://github.com/helm/helm/releases"><strong>https://github.com/helm/helm/releases</strong></a></p><p>Locate the Windows <a href="https://phoenixnap.com/glossary/amd64">amd64</a> download link from the Installation platform list and select it to download.</p><p>Then unzip into new folder let’s kubernetes folder and unzip file is helm.exe. By doing this steps you can access helm cmd on cmd line.</p><p>After this install kubectl command via installing software from below link</p><p><a href="https://dl.k8s.io/release/v1.28.2/bin/windows/amd64/kubectl.exe"><strong>https://dl.k8s.io/release/v1.28.2/bin/windows/amd64/kubectl.exe</strong></a></p><p>Same steps you have to follow for both helm and kubectl copy path and new path edit in environmental variable.Then you are able to run helm.exe and kubectl.exe command run on command line.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*SGp1IkUg4W5iLHga6fWcuw.png" /><figcaption>helm command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*154EqxhlXGOP037piTVe3A.png" /><figcaption>kubectl command</figcaption></figure><blockquote><strong><em>Now let’s do practical</em></strong></blockquote><h3>Step 1: Deploy Jenkins Using a Kubernetes Operator</h3><p><em>For reference visit the GitHub</em></p><p><a href="https://github.com/vimallinuxworld13/devops_workshop_eks_jenkins_loki_operator#devops_workshop_eks_jenkins_loki_operator">devops_workshop_eks_jenkins_loki_operator</a></p><p>Use git-bash command line for smooth experience. Download from below link.</p><p><a href="https://git-scm.com/download/win">https://git-scm.com/download/win</a></p><p><strong>Install Kubernetes over AWS cloud</strong></p><pre>eksctl create cluster - name mycluster1 - region=us-east-1</pre><p><strong>This command creates an Amazon Elastic Kubernetes Service (Amazon EKS) cluster named “mycluster1” in the “us-east-1” AWS region. Some time some region not work so try on different region for launching your cluster.</strong></p><pre>kubectl create namespace lwns</pre><p><strong>This command creates a new Kubernetes namespace named “lwns.”</strong></p><h3>Step 2: Manage Jenkins Pipeline as Code</h3><pre>helm repo add jenkins https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart</pre><p>This command adds a Helm repository named “Jenkins” to your Helm configuration. The repository is located at the specified URL, which contains Helm charts for deploying Jenkins using the Kubernetes Operator.</p><p><strong>If this command does not work on your computer due to network restrictions or firewall issues, you may need to use a VPN to access the repository. Follow the steps below to use a VPN:</strong></p><p><strong>Download VPN from Here:</strong></p><p><a href="https://drive.google.com/file/d/1wyyPF_r9jRGwn5vK-184blDhwz1deRJu/view?usp=sharing">urban-vpn-2-2-13-0.exe</a></p><ul><li><strong>Once connected to the VPN, retry the `helm repo add` command.</strong></li></ul><pre>helm install my-jenkins-operator jenkins/jenkins-operator -n lwns - set jenkins.enabled=false</pre><p><strong>This command uses Helm to install a Kubernetes application named “my-jenkins-operator” from the “jenkins/jenkins-operator” Helm chart. The application is deployed in the “lwns” namespace.</strong></p><pre>Curl https://raw.githubusercontent.com/dilip8700/devops_workshop_eks_jenkins_loki_operator/main/jenkins_instance.yml &gt;&gt; jenkins_instance.yml</pre><p><strong>Use this command to create a Kubernetes YAML file.</strong></p><pre>kubectl apply -f jenkins_instance.yml</pre><pre>kubectl - namespace lwns get secret jenkins-operator-credentials-example -o &#39;jsonpath={.data.user}&#39; | base64 -d</pre><p><strong>This is used to retrieve sensitive information such as usernames stored as secrets in a Kubernetes cluster.</strong></p><pre>kubectl - namespace lwns get secret jenkins-operator-credentials-example -o &#39;jsonpath={.data.password}&#39; | base64 -d</pre><p><strong>This is used to retrieve sensitive information such as passwords stored as secrets in a Kubernetes cluster.</strong></p><pre>kubectl - namespace lwns port-forward jenkins-example 8080:8080</pre><p>This command sets up a port-forwarding connection in the “lwns” namespace, forwarding local port 8080 to port 8080 on the Kubernetes pod named “Jenkins-example.” This enables you to access the Jenkins web interface running inside the “Jenkins-example” pod through your local machine’s web browser by opening <a href="http://localhost:8080./"><strong>http://localhost:8080</strong>.</a></p><p>Above all step command wise run in gitbash below is screenshot of this please refer this for your future practical it will help for you lots’s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mW300cIqb2lwY7qO4C-YSQ.png" /></figure><h3>Step 3: Monitoring with Grafana Loki, Promtail, and Prometheus</h3><pre><br><br>helm repo add grafana https://grafana.github.io/helm-charts</pre><ul><li><strong><em>This will add a repo in the helm chat for Grafana.</em></strong></li></ul><pre>helm repo update</pre><p><strong><em>It will update the helm repo</em></strong></p><pre>helm.exe upgrade - install loki grafana/loki-stack - set grafana.enabled=true,prometheus.enabled=true,prometheus.alertmanager.persistentVolume.enabled=false,prometheus.server.persistentVolume.enabled=false</pre><p><strong><em>Use this command to install Loki, Grafana, and Prometheus.</em></strong></p><pre>kubectl patch svc loki-grafana -p &#39;{&quot;spec&quot;: {&quot;type&quot;: &quot;LoadBalancer&quot;}}&#39;</pre><p>This command modifies a Kubernetes service named “loki-grafana” by changing its type to “LoadBalancer.” The LoadBalancer type allows external access to the service, typically by assigning it a public IP address for internet accessibility.</p><pre>kubectl get svc loki-grafana -o jsonpath=&#39;{.status.loadBalancer.ingress[0].hostnam</pre><p>This command gives you the hostname of the load balancer which you can use to connect.</p><p><strong><em>AWS Loadbalancer takes 2 min to set up so wait for 2 minutes.</em></strong></p><pre>kubectl get secret loki-grafana -o go-template=&#39;{{range $k,$v := .data}}{{printf &quot;%s: &quot; $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{&quot;\n&quot;}}{{end}}&#39;</pre><p><strong><em>This command will give you a Grafana username and password.</em></strong></p><p>All above command related Grafana is below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FKk4jJojUv1YcijmbNYMrQ.png" /></figure><h3>Conclusion:</h3><p>In this blog, we’ve covered the step-by-step process to deploy Jenkins on Kubernetes using an Operator, manage Jenkins pipelines as code, and set up monitoring using Grafana Loki, Promtail, and Prometheus. Automating your CI/CD pipelines and monitoring infrastructure ensures efficient and reliable software delivery. Stay tuned for part two, where we’ll dive deeper into advanced Jenkins pipeline configuration and monitoring.</p><p>Feel free to add your own code, configuration, and details to make this guide tailored to your specific needs. Happy automating and monitoring!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02a7cb9b05b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Fun Linux Commands: A Playful Journey into the Terminal]]></title>
            <link>https://medium.com/@rajdattkokate/exploring-fun-linux-commands-a-playful-journey-into-the-terminal-1429d4faafe1?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/1429d4faafe1</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[funcommands]]></category>
            <category><![CDATA[explore]]></category>
            <category><![CDATA[sharing]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Thu, 05 Oct 2023 13:14:46 GMT</pubDate>
            <atom:updated>2023-10-05T13:14:46.863Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*3fSVwcI4K_ts3dv_dm3LpA.png" /></figure><p>Hey there, fellow Linux enthusiasts! 👋 Are you tired of the same old routine in the terminal? Ready to add a dash of fun and whimsy to your command-line adventures? Well, you’re in for a treat! In this blog post, we’re going to dive into the world of quirky and entertaining Linux commands that can bring a smile to your face as you work with your terminal.</p><h3>The Joy of Easter Eggs 🥚</h3><p>Linux, known for its powerful command-line interface, also hides a few surprises in the form of “Easter eggs.” These are hidden functionalities or jokes tucked away by developers for adventurous users to discover. Let’s embark on a quest to find and explore some of these delightful Linux Easter eggs.</p><h3>1. The “sl” Command 🚂</h3><p>sl is a command that prints a steam locomotive moving accross the terminal. In order to install the software, epel repository must be present. to install epel repo use the command below.</p><pre>dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm -y<br><br>dnf install sl -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*uo_QV1XM6hQBd9cg1ZKVXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oq1418eMZJpW0JJpQFP3zg.png" /></figure><p>The output of sl command is like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9LHv-m6xUybpNZMg6UYlZg.png" /></figure><p>sl provides some options with man command</p><pre>#using all the three options together<br>sl -alF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*PYsoiIrlCNvl4i7I55HQqg.png" /></figure><h3>2. The “cowsay” Command 🐄</h3><p>“Cowsay” is a command that allows you to make a cow (or other animals) say whatever you want. It’s a fun way to display text in the terminal, and you can get creative with your cow’s dialogue.</p><p>cowsay is a command that draws a cow and the inout is shown as its thought or as it is saying it. The output of various optons are as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fgoMKIn-ZJf-YJS9ymbjdg.png" /></figure><pre>cowsay -g hhihello</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*UYCxkf9LzwLf0iY9gLGb7A.png" /></figure><pre>cowsay -b hhihello<br>cowsay -d hhihello<br>cowsay -y hhihello</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*83YEhCmZr2Cei3tJaHH3eQ.png" /></figure><pre>cowsay -cr  goodmorning</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*r3giR4Gke7pH721EyHIgrw.png" /></figure><h3>Building Your Collection of Fun Commands 📜</h3><p>Now that you’ve discovered a couple of fun Linux commands, why stop there? The Linux community has created a plethora of entertaining and quirky commands that you can explore. To make things even more interesting, I’ve compiled a comprehensive document showcasing a variety of these commands along with screenshots to help you get started.</p><p>[Insert link to your document here]</p><h3>Sharing the Fun 🌐</h3><p>Don’t keep all this fun to yourself! Share your newfound knowledge of fun Linux commands with your friends and fellow Linux enthusiasts. Spread the joy of playful terminal interactions.</p><h3>Conclusion 🎉</h3><p>Linux is not just about serious work; it can also be a source of amusement and creativity. By exploring fun commands like “sl” and “cowsay,” you can add a touch of whimsy to your Linux journey. So, go ahead, try them out, and let your terminal sessions be filled with laughter and enjoyment.</p><p>Happy Linux-ing! 🐧✨</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1429d4faafe1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Zenity: A Comprehensive Guide with Screenshots]]></title>
            <link>https://medium.com/@rajdattkokate/demystifying-zenity-a-comprehensive-guide-with-screenshots-b8db654c6234?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8db654c6234</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[zenity]]></category>
            <category><![CDATA[exploration]]></category>
            <category><![CDATA[funcommands]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Thu, 05 Oct 2023 12:40:37 GMT</pubDate>
            <atom:updated>2023-10-05T12:40:37.629Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you often find yourself looking for user-friendly ways to interact with your Linux system through scripts or simply for personal use? If so, Zenity might just be your new best friend. Zenity is a fantastic tool that allows you to create graphical user interfaces (GUIs) for your Bash scripts, making it easier than ever to gather user input, display messages, or even create simple desktop applications.</p><p>In this comprehensive guide, we’ll explore the world of Zenity and provide you with a detailed understanding of its various options and capabilities. We’ll also accompany our explanations with screenshots to ensure you can follow along effortlessly.</p><h3>What is Zenity?</h3><p>Before diving into the specifics, let’s clarify what Zenity is. Zenity is a command-line utility for Linux that lets you create dialog boxes, or graphical pop-up windows, from your scripts or directly from the terminal. These dialog boxes can display various types of widgets, such as text entry fields, buttons, checkboxes, and more, allowing you to interact with users in a friendly and intuitive manner.</p><p><strong>How you can install Zenity?🤔</strong></p><pre>yum whatprovides zenity<br>yum install zenity-3.32.0-8.el9.x86_64</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hBdl_7MGKCc6FKc7UMQ67w.png" /><figcaption>1</figcaption></figure><p>Zenity supports many options for this we have to check the manual for this man zenity</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3AQLiXi8FoIn5vQBfCHPZw.png" /></figure><p>Now, let’s break down some of the most commonly used Zenity options with real-world examples.</p><h3>Here are a few Zenity commands:🔰</h3><p><strong>1. Displaying Information Messages</strong></p><p>One of the simplest things you can do with Zenity is to display information messages. This is achieved using the --info option:</p><pre>zenity --info --text=&quot;Hello, Medium readers! This is an information message.&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*G4-GzOqVVJKLbzahBAo5wQ.png" /><figcaption>2</figcaption></figure><p><strong>2. Zenity with a calendar option</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*Y0tKkXQXCdbcBJJbWu9HRQ.png" /></figure><p>3. <strong>Zenity with Warning option</strong></p><p>When you use Zenity with the --warning option, it creates a dialog box with a warning icon and displays a warning message to the user. Here&#39;s how you can use it:</p><pre>zenity --warning --text=&quot;hi close doorrrrrrr&quot;</pre><p>When you run this command, Zenity will open a dialog box with a warning icon and the message “This is a warning message.” The user can then take appropriate action based on the warning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*Z9cCDDO4l99OoYcq17fU1A.png" /></figure><p>4. <strong>Zenity with password option</strong></p><pre>zenity --password --username</pre><p>When you run this command, Zenity will open a dialog box that ask for a username and password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*WNUY0za3DScF_clLMLH3jQ.png" /></figure><p><strong>5. Yes/No Confirmation</strong></p><p>Sometimes you need a simple yes or no answer from the user. Zenity makes this easy with the --question option:</p><pre>zenity --question --text=&quot;Do you want to proceed?&quot;<br>if [ $? = 0 ]; then<br>    echo &quot;You chose to proceed.&quot;<br>else<br>    echo &quot;You chose to cancel.&quot;<br>fi</pre><p>We can add above script in bash file make it excecutable by givig file permission. And use for daily task of office work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*_TlM0IkX9vuxQcgSJzNnyw.png" /></figure><h3>Conclusion</h3><p>Zenity is a versatile and user-friendly tool that simplifies the process of creating graphical interfaces for your Linux scripts. With options for displaying messages, gathering user input, and even monitoring progress, it’s a must-have in any Linux developer’s toolbox.</p><p>So go ahead, give Zenity a try, and unlock a world of possibilities for your Linux scripting adventures. With its ease of use and powerful capabilities, you’ll wonder how you ever managed without it. Happy scripting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8db654c6234" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleash the Power of Python and Tkinter: Building a Versatile GUI Menu]]></title>
            <link>https://medium.com/@rajdattkokate/unleash-the-power-of-python-and-tkinter-building-a-versatile-gui-menu-27ab18ca4278?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/27ab18ca4278</guid>
            <category><![CDATA[menu-design]]></category>
            <category><![CDATA[multifunctional]]></category>
            <category><![CDATA[python-tkinter]]></category>
            <category><![CDATA[gui]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Sat, 09 Sep 2023 17:41:41 GMT</pubDate>
            <atom:updated>2023-09-09T17:41:41.361Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r4vAUL9LEHV63s6hIHGkiw.png" /></figure><p>🚀 In today’s blog, we’re diving into the world of Python and Tkinter to create an interactive GUI menu with a range of functionalities, from executing Linux terminal commands and sending automated emails to live swapping images and launching EC2 instances using the Boto3 library. This versatile menu will also incorporate voice command recognition, allowing you to control various applications on your Windows system. Let’s explore the code behind this exciting project!</p><h3>Setting Up the Environment</h3><p>Before we dive into the code, ensure you have the required libraries installed. You can install them using pip:</p><pre>import os<br>import tkinter as tk<br>import speech_recognition as sr<br>import boto3<br>from tkinter import simpledialog<br>import webbrowser<br>import pywhatkit  as pyk<br>import time<br>from cvzone.FaceDetectionModule import FaceDetector<br>import cv2</pre><h3>Voice Recognition with SpeechRecognition</h3><p>Our GUI includes a voice recognition feature powered by the SpeechRecognition library. This allows users to issue voice commands, such as opening applications or executing actions. The code listens for voice input and converts it to text for processing.</p><pre>import speech_recognition as sr<br><br>def process_voice_command():<br>    recognizer = sr.Recognizer()<br>    with sr.Microphone() as source:<br>        print(&quot;Listening...&quot;)<br>        recognizer.adjust_for_ambient_noise(source)  # Adjust for background noise<br>        audio = recognizer.listen(source)<br><br>    try:<br>        # Recognize the audio and convert it to text<br>        command = recognizer.recognize_google(audio).lower()<br>        print(&quot;You said:&quot;, command)<br>        return command<br>    except sr.UnknownValueError:<br>        print(&quot;Sorry, I didn&#39;t understand that.&quot;)<br>        return &quot;&quot;<br>    except sr.RequestError:<br>        print(&quot;Sorry, there was an issue connecting to the service.&quot;)<br>        return &quot;&quot;</pre><h3>Launching EC2 Instances with Boto3</h3><p>Our GUI also integrates with the Boto3 library to launch Amazon EC2 instances. Users can specify the Amazon Machine Image (AMI) they want to launch, and the code handles the EC2 instance creation.Also in this i have already configure my aws account details in command line through, that why i dont need to put my aws account details. So make sure you configure you aws account in command line. I will give link below to configure account.</p><p><a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">Installing or updating to the latest version of the AWS CLI</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*X6eT5E8LIZOVNadOCoRusA.png" /></figure><pre>import boto3<br>from tkinter import simpledialog<br><br>def on_key_press2():<br>    amis = [<br>        &quot;ami-0c38b9e37c107d921&quot;, &quot;ami-0f8e81a3da6e2510a&quot;,<br>        &quot;ami-0dc8c969d30e42996&quot;<br>    ]<br>    ami = &quot;&quot;<br><br>    def on_ec2_click(choice):<br>        if choice == &quot;ubuntu&quot;:<br>            ami = amis[0]<br>        elif choice == &quot;amazonlinux&quot;:<br>            ami = amis[1]<br>        elif choice == &quot;rhel&quot;:<br>            ami = amis[2]<br><br>        ec2_client = boto3.client(&quot;ec2&quot;)<br>        ec2 = ec2_client.run_instances(<br>            ImageId=ami,<br>            InstanceType=&#39;t2.micro&#39;,<br>            MaxCount=1,<br>            MinCount=1<br>        )<br><br>    def submit():<br>        choice = USER_INP<br>        main_choice = choice.lower()<br>        on_ec2_click(main_choice)<br><br>    USER_INP = simpledialog.askstring(title=&quot;EC2&quot;,<br>                                      prompt=&quot;Enter Name of AMI..&quot;)<br><br>    print(USER_INP)<br>    submit()</pre><h3>Sending Emails with pywhatkit</h3><p>Our GUI enables users to send emails using the pywhatkit library. Users input the recipient’s email address, and the code sends an email with a specified subject and message.</p><pre>import pywhatkit  as pyk<br><br>def on_key_press4(email_id):<br>    pyk.send_mail(&quot;rajdattkokate3099@gmail.com&quot;, &quot;hwdd gxzz fscl yhli&quot;, &quot;GUI Based Mail&quot;, &quot;HIII EVERYONE GOOD MORNING&quot;, email_id)<br>    print(&quot;Email sent to:&quot;, email_id)</pre><h3>What is Tkinter?</h3><p>Tkinter is a standard Python interface to the Tk GUI toolkit. It’s the most commonly used library for creating GUI applications in Python due to its simplicity and ease of use. Tkinter provides a wide range of widgets (buttons, labels, text boxes, etc.) and tools to create interactive graphical applications.</p><h3>Setting Up the Environment</h3><p>Before we dive into the code, make sure you have Tkinter installed, as it comes pre-installed with most Python distributions.</p><h3>Creating the Main Window</h3><p>To begin, we create the main Tkinter window using the tk.Tk() constructor. We set the window title, background color, and size.</p><h3>Adding Buttons</h3><p>Our menu will consist of several buttons that trigger different actions. We create buttons using the tk.Button() widget. Here&#39;s an example of creating a button:</p><h3>Running the Application</h3><p>The final step is to run the Tkinter application. We achieve this with the root.mainloop() function, which keeps the GUI running until the user closes it.</p><p>Now, you have a basic understanding of how to create a Python menu using Tkinter. You can customize and expand upon this menu, adding more buttons and functionality as needed for your project.</p><p>With Tkinter, you can build user-friendly interfaces for a wide range of applications, from simple menus to complex desktop software.</p><p>So, go ahead and explore the possibilities of Tkinter to create your own GUI applications in Python!</p><p>Now time to integrate all function in one code with gui form</p><pre>import os<br>import tkinter as tk<br>import speech_recognition as sr<br>import boto3<br>from tkinter import simpledialog<br>import webbrowser<br>import pywhatkit  as pyk<br>import time<br>from cvzone.FaceDetectionModule import FaceDetector<br>import cv2<br><br><br>#break this code in two part form here <br><br><br>def process_voice_command():<br>    recognizer = sr.Recognizer()<br>    with sr.Microphone() as source:<br>        print(&quot;Listening...&quot;)<br>        recognizer.adjust_for_ambient_noise(source)  # Adjust for background noise<br>        audio = recognizer.listen(source)<br><br>    try:<br>        # Recognize the audio and convert it to text<br>        command = recognizer.recognize_google(audio).lower()<br>        print(&quot;You said:&quot;, command)<br>        return command<br>    except sr.UnknownValueError:<br>        print(&quot;Sorry, I didn&#39;t understand that.&quot;)<br>        return &quot;&quot;<br>    except sr.RequestError:<br>        print(&quot;Sorry, there was an issue connecting to the service.&quot;)<br>        return &quot;&quot;<br><br>    <br>    <br>def on_key_press1():<br>    command = process_voice_command()<br><br>    if &quot;run&quot; in command or &quot;execute&quot; in command or &quot;open&quot; in command or &quot;start&quot; in command:<br>        if &quot;explorer&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;explorer&quot;)<br>        elif &quot;notepad&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;notepad&quot;)<br>        elif &quot;chrome&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;chrome&quot;)<br>        elif &quot;microsoft&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;start microsoft-edge:&quot;)<br>        elif &quot;calculator&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;calc&quot;)    <br>        else:<br>            print(&quot;Command not supported.&quot;)<br><br>    elif &quot;goodbye&quot; in command:<br>        print(&quot;Goodbye! Have a great day!&quot;)<br>        root.destroy()  # Close the Tkinter window<br>        quit()<br><br>    elif &quot;stop&quot; in command:<br>        print(&quot;Stopping the voice recognition system.&quot;)<br>        root.destroy()  # Close the Tkinter window<br>        quit()<br><br>    else:<br>        print(&quot;Command not supported.&quot;)<br><br>        <br>        <br>        <br># Function for Ec2 launch        <br>def on_key_press2():<br>    amis = [ <br>        &quot;ami-0c38b9e37c107d921&quot; , &quot;ami-0f8e81a3da6e2510a&quot; ,<br>        &quot;ami-0dc8c969d30e42996&quot;    <br>    ]<br>    ami = &quot;&quot;<br>    <br>    def on_ec2_click(choice):<br>        if choice == &quot;ubuntu&quot;:<br>            ami = amis[0]<br>        elif choice == &quot;amazonlinux&quot;:<br>            ami = amis[1]<br>        elif choice == &quot;rhel&quot;:<br>            ami = amis[2]<br>            <br>        ec2_client = boto3.client(&quot;ec2&quot;) <br>        ec2 = ec2_client.run_instances(<br>            ImageId=ami,<br>            InstanceType=&#39;t2.micro&#39;,<br>            MaxCount=1,<br>            MinCount=1<br>         )<br>        <br>    def submit():<br>        choice = USER_INP<br>        main_choice = choice.lower()<br>        on_ec2_click(main_choice)<br>        <br>    <br>    USER_INP = simpledialog.askstring(title=&quot;EC2&quot;,<br>                                  prompt=&quot;Enter Name of AMI..&quot;)<br>     <br>    print(USER_INP)<br>    submit()<br>      <br>#Function for CGI-WEB LInuX<br>def on_key_press3():<br>    webbrowser.open_new_tab(&quot;http://204.236.128.235/fr.html&quot;)<br><br>    <br><br>def on_key_press4(email_id):<br>    pyk.send_mail(&quot;rajdattkokate3099@gmail.com&quot;, &quot;hwdd gxzz fscl yhli&quot;, &quot;GUI Based Mail&quot;, &quot;HIII EVERYONE GOOD MORNING&quot;, email_id)<br>    print(&quot;Email sent to:&quot;, email_id)<br>    <br>    <br>def submit2():<br>    USER_INP = simpledialog.askstring(title=&quot;MAIL&quot;, prompt=&quot;Enter Email Id:&quot;)<br>    <br>    if USER_INP:<br>        on_key_press4(USER_INP)<br>    else:<br>        print(&quot;Email Id not provided.&quot;)<br><br>#Fubction for live video <br><br>    <br><br># Create the main Tkinter window<br>root = tk.Tk()<br>root.title(&quot;Creative Voice Recognition System&quot;)<br><br># Background color and window size<br>root.configure(bg=&quot;black&quot;)<br>root.geometry(&quot;4000x2500&quot;)<br><br># Button-1 with gradient color to trigger voice recognition<br>button = tk.Button(root, text=&quot;Listen And Recognize&quot;, font=(&quot;Arial&quot;, 20), command=on_key_press1,<br>                   fg=&quot;white&quot;, bg=&quot;#008080&quot;, activebackground=&quot;#00a3a3&quot;, relief=&quot;raised&quot;)<br>button.grid(row=2, column=18, columnspan=1, pady=10)<br>#button-2<br>button = tk.Button(root, text=&quot;Launch Ec2 Instance&quot;, font=(&quot;Arial&quot;, 20), command=on_key_press2,<br>                   fg=&quot;white&quot;, bg=&quot;#008080&quot;, activebackground=&quot;#00a3a3&quot;, relief=&quot;raised&quot;)<br>button.grid(row=2, column=22, columnspan=1, pady=10)<br>#button-3<br>button = tk.Button(root, text=&quot;Open WebServer&quot;, font=(&quot;Arial&quot;, 20), command=on_key_press3,<br>                   fg=&quot;white&quot;, bg=&quot;#008080&quot;, activebackground=&quot;#00a3a3&quot;, relief=&quot;raised&quot;)<br>button.grid(row=3, column=18, columnspan=1, pady=5)<br>#button-4<br>button = tk.Button(root, text=&quot;Send Mail&quot;, font=(&quot;Arial&quot;, 20), command=submit2,<br>                   fg=&quot;white&quot;, bg=&quot;#008080&quot;, activebackground=&quot;#00a3a3&quot;, relief=&quot;raised&quot;)<br>button.grid(row=3, column=22, columnspan=1, pady=5)<br>#button-5<br>button = tk.Button(root, text=&quot;Live Swap&quot;, font=(&quot;Arial&quot;, 20), command=on_key_press4,<br>                   fg=&quot;white&quot;, bg=&quot;#008080&quot;, activebackground=&quot;#00a3a3&quot;, relief=&quot;raised&quot;)<br>button.grid(row=3, column=22, columnspan=1, pady=5)<br><br><br><br># Label to display messages with a colorful background<br>label = tk.Label(root, text=&quot;Hey Good Morning TEAM LAKSHYA!&quot;, font=(&quot;Arial&quot;, 16, &quot;bold&quot;), fg=&quot;white&quot;, bg=&quot;purple&quot;)<br>label.grid(row=0, column=20, columnspan=2, pady=5)<br><br>emoji_img = tk.PhotoImage(file=&quot;pngegg.png&quot;)  # Replace with the path to your emoji image<br>subsample_factor = 6  # Adjust this value to control the size of the image (higher value for smaller size)<br>small_image = emoji_img.subsample(subsample_factor, subsample_factor)<br>emoji_label = tk.Label(root, image=small_image, bg=&quot;black&quot;)<br>emoji_label.grid(row=2, column=5, columnspan=1, pady=5)<br><br><br><br># Run the main loop<br>root.mainloop()</pre><p>Above code will be run in two part so terminal will not be crashed your code should br run very smoothly.</p><h3>Conclusion</h3><p>In this blog, we’ve explored how to create a versatile Python GUI using Tkinter. The GUI includes features like voice recognition, launching EC2 instances, sending emails, and more, all in one interface. This project showcases the power of Python in creating interactive applications.</p><p>Feel free to customize and expand upon this GUI to suit your needs. The possibilities are endless when it comes to Python and GUI development!</p><p>#Python #Tkinter #GUI #VoiceRecognition #EC2 #Boto3 #Email #Programming</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27ab18ca4278" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Parallelism in Python: Running Functions Simultaneously with Threads]]></title>
            <link>https://medium.com/@rajdattkokate/exploring-parallelism-in-python-running-functions-simultaneously-with-threads-5a1b023ae09f?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a1b023ae09f</guid>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[parallel-computing]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 21:51:40 GMT</pubDate>
            <atom:updated>2023-09-08T21:51:40.851Z</atom:updated>
            <content:encoded><![CDATA[<p>🚀 Python is not just a programming language; it’s a powerhouse of libraries and functionalities. In this blog, we’ll dive into the world of parallelism and learn how to execute multiple functions concurrently using threads. We’ll also explore a practical example of running two functions in parallel and uncover the magic of Python’s threading module.</p><h3>The Power of Parallelism</h3><p>In many real-world scenarios, tasks can be executed concurrently to save time and enhance efficiency. Python provides a robust threading module that allows you to create and manage threads, making it possible to run functions simultaneously.</p><h3>Setting Up the Environment</h3><p>Before we jump into the code, let’s ensure you have Python installed on your system. Additionally, we’ll be using the ‘time’ and ‘threading’ libraries, which are included in Python’s standard library, so no need for additional installations.</p><h3>Writing the Python Script</h3><p>Let’s create a Python script that demonstrates parallel execution using threads:</p><pre>import threading as th<br>import time<br><br># Define function lw1<br>def a1():<br>    while True:<br>        print(&quot;a&quot;)<br>        time.sleep(1)<br><br># Define function lw2<br>def b2():<br>    while True:<br>        print(&quot;b&quot;)<br>        time.sleep(1)<br><br># Create threads for lw1 and lw2<br>thread1 = th.Thread(target=a1)<br>thread2 = th.Thread(target=b2)<br><br># Start both threads<br>thread1.start()<br>thread2.start()<br><br># Wait for both threads to finish<br>thread1.join()<br>thread2.join()</pre><h3>Understanding the Script</h3><ul><li>We import the ‘threading’ library as ‘th’ to access thread-related functions.</li><li>We define two functions, ‘lw1’ and ‘lw2,’ each of which runs an infinite loop printing ‘a’ and ‘b,’ respectively, with a 1-second delay between each print.</li><li>We create two threads, ‘thread1’ and ‘thread2,’ and assign the ‘lw1’ and ‘lw2’ functions to them, respectively.</li><li>We start both threads concurrently using the ‘start()’ method.</li><li>Finally, we use the ‘join()’ method to wait for both threads to finish their execution.</li></ul><h3>Running the Script</h3><p>Save the script to a ‘.py’ file and run it. You’ll witness ‘a’ and ‘b’ being printed simultaneously, thanks to Python’s threading capabilities.</p><h3>Exploring Further</h3><p>This example is just the beginning of what you can achieve with Python’s threading module. You can create more complex multithreading scenarios, share data between threads, and even work with locks to ensure thread safety in your applications.</p><p>🚀 With Python’s threading, you have the power to unlock parallelism and improve the performance of your programs.</p><h3>Conclusion</h3><p>Python’s threading module empowers you to harness the potential of parallelism, running multiple functions concurrently and optimizing the execution of your code. It’s a valuable tool for building efficient and responsive applications, making Python even more versatile for a wide range of tasks.</p><p>So, go ahead, experiment with threading, and explore the world of parallel programming with Python!</p><p>#Python #Threading #Parallelism #Multithreading #Programming #CodeSnippet</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a1b023ae09f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Augmenting Your Live Video Stream: How to Capture and Display Faces with Python]]></title>
            <link>https://medium.com/@rajdattkokate/augmenting-your-live-video-stream-how-to-capture-and-display-faces-with-python-47f1e09df75e?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/47f1e09df75e</guid>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[face-swap]]></category>
            <category><![CDATA[livestream]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 18:27:42 GMT</pubDate>
            <atom:updated>2023-09-08T18:27:42.977Z</atom:updated>
            <content:encoded><![CDATA[<p>🎥👀 Are you intrigued by the idea of enhancing your live video stream by capturing faces and displaying them on the screen? In this blog, we’ll explore the world of computer vision and show you how to use Python to capture faces from a live video stream and display them in real-time on the top corner of the screen. By the end, you’ll have an exciting project to experiment with!</p><h3>The Power of Python in Computer Vision</h3><p>Python is a versatile programming language, and it shines in various domains, including computer vision. With libraries like OpenCV, you can perform advanced image and video processing tasks, making it an excellent choice for this project.</p><h3>Setting Up the Environment</h3><p>Before we start, make sure you have OpenCV installed. You can install it using pip:</p><pre>pip install opencv-python</pre><h3>The Python Script</h3><p>Let’s create a Python script that captures faces from your webcam’s live video stream and displays them on the screen’s top corner. To make it more interactive, we’ll also allow users to input their desired image for overlay.</p><pre>import cv2<br><br># Open the webcam<br>cam = cv2.VideoCapture(0)<br><br># Load the user&#39;s image for overlay<br>user_image = cv2.imread(&quot;user_image.png&quot;)<br><br>while True:<br>    status, frame = cam.read()<br><br>    # Extract the dimensions of the user&#39;s image<br>    height, width, _ = user_image.shape<br><br>    # Replace the top corner of the frame with the user&#39;s image<br>    frame[0:height, 0:width] = user_image<br><br>    # Display the augmented video<br>    cv2.imshow(&quot;Live Video with Overlay&quot;, frame)<br><br>    # Press &#39;Enter&#39; to exit<br>    if cv2.waitKey(10) == 13:<br>        break<br><br># Release the webcam and close all windows<br>cam.release()<br>cv2.destroyAllWindows()</pre><pre>cam.release()</pre><h3>Understanding the Script</h3><ul><li>We import the ‘cv2’ module for computer vision.</li><li>The script captures video from your webcam (index 0).</li><li>It loads the user’s image (named “user_image.png”) for overlay.</li><li>The live video frames are augmented by replacing the top corner with the user’s image.</li><li>The video is displayed in real-time with the overlay.</li><li>Pressing ‘Enter’ closes the video stream.</li></ul><h3>Running the Script</h3><p>Make sure you have a suitable image named “user_image.png” in the same directory as your script. Save the script to a ‘.py’ file and run it. You’ll see your live video stream with your chosen image overlaying the top corner.</p><h3>Exploring Further</h3><p>This project is a fantastic starting point for exploring computer vision with Python. You can extend it by experimenting with different images, adding face detection, or exploring other OpenCV functionalities.</p><p>🚀 With Python, the possibilities for enhancing live video streams are endless, and you can create exciting, interactive projects.</p><h3>Conclusion</h3><p>By using Python and OpenCV, you can augment live video streams with captivating overlays. Whether it’s for entertainment or practical applications, this project is a great introduction to the world of computer vision.</p><p>So go ahead, give it a try, and see your live video streams come to life with personalized overlays!</p><p>#Python #ComputerVision #OpenCV #LiveVideo #ImageOverlay #Programming #CodeSnippet</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47f1e09df75e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Voice-Powered Commands: Using Python to Control Your Computer]]></title>
            <link>https://medium.com/@rajdattkokate/voice-powered-commands-using-python-to-control-your-computer-d2c3a8dd8a28?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2c3a8dd8a28</guid>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 16:21:41 GMT</pubDate>
            <atom:updated>2023-09-08T16:21:41.448Z</atom:updated>
            <content:encoded><![CDATA[<p>🎤 Imagine being able to command your computer with just your voice! In this blog, we’ll explore how Python can turn your microphone into a powerful tool for executing text or running commands. We’ll introduce you to the SpeechRecognition library and guide you through a simple yet impressive Python script.</p><h3>The Power of Voice Recognition in Python</h3><p>Python is known for its versatility, and it’s no surprise that it excels in the field of voice recognition. Thanks to libraries like SpeechRecognition, you can seamlessly integrate voice commands into your Python projects. This opens up a world of possibilities, from building voice-activated virtual assistants to automating tasks with voice inputs.</p><h3>Setting Up the Environment</h3><p>Before we begin, you’ll need to install the ‘SpeechRecognition’ library. You can do this using pip:</p><pre>pip install SpeechRecognition</pre><h3>The Python Script</h3><p>Let’s dive into the Python code that connects to your microphone, captures your voice input, and processes it:</p><pre>import speech_recognition as sr<br><br>recognizer = sr.Recognizer()<br><br>with sr.Microphone() as source:<br>    print(&quot;Say something...&quot;)<br>    audio = recognizer.listen(source)<br><br>    try:<br>        text = recognizer.recognize_google(audio)<br>        print(&quot;You said: &quot;, text)<br><br>        # Here, you can add logic to perform actions based on &#39;text&#39;<br>        # For example, you can run commands or trigger specific functions.<br><br>    except sr.UnknownValueError:<br>        print(&quot;Sorry, I couldn&#39;t understand your audio.&quot;)<br>    except sr.RequestError as e:<br>        print(f&quot;Could not request results; {e}&quot;)</pre><h3>Understanding the Script</h3><ul><li>We import the ‘speech_recognition’ library as ‘sr’.</li><li>The ‘recognizer’ object is created to handle audio recognition.</li><li>We use a ‘with’ block to open the microphone.</li><li>The script captures audio and uses Google’s speech recognition to convert it into text.</li><li>You can add logic to perform actions based on the recognized text.</li></ul><h3>Running the Script</h3><p>Once the script is saved in a ‘.py’ file, execute it. You’ll see the prompt, “Say something…”. Speak into your microphone, and the script will print what you said.</p><h3>Expanding the Possibilities</h3><p>With this basic setup, you can go further. Depending on the recognized text, you can run specific commands or trigger functions, making your computer respond to your voice commands.</p><h3>Conclusion</h3><p>Python, coupled with the SpeechRecognition library, empowers you to create voice-controlled applications and automate tasks with ease. The ability to connect to your microphone and process voice input opens up exciting possibilities for hands-free computer interaction.</p><p>So, why not give it a try? Speak your commands, and let Python do the rest!</p><p>#Python #VoiceRecognition #Automation #SpeechRecognition #Programming #VirtualAssistant</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2c3a8dd8a28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate Instagram Posts with Python: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@rajdattkokate/automate-instagram-posts-with-python-a-step-by-step-guide-4b055f356b31?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b055f356b31</guid>
            <category><![CDATA[post]]></category>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 14:42:23 GMT</pubDate>
            <atom:updated>2023-09-08T14:42:23.443Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*D1xqaTGAjK4rJW1PvOlZTQ.png" /></figure><p>📸 Do you want to streamline your Instagram posting process using Python? In this blog, we’ll walk you through the process of automating Instagram posts with a Python script. By the end of this tutorial, you’ll be able to upload images with captions to Instagram effortlessly.</p><h3>Why Automate Instagram Posts?</h3><p>Instagram is a powerful platform for sharing visual content, but manually posting images and captions can be time-consuming, especially if you’re managing multiple accounts. Automation can help you schedule posts in advance and maintain a consistent online presence.</p><h3>Setting Up the Environment</h3><p>To get started, you’ll need to install the ‘instabot’ library, which simplifies interactions with the Instagram API. You can install it using pip:</p><pre>pip install instabot</pre><h3>The Python Script</h3><p>Below is a Python script that allows you to upload an image with a caption to your Instagram account. The script uses the ‘instabot’ library and the Python Imaging Library (PIL) to handle image resizing.</p><pre>import os<br>from PIL import Image<br>from instabot import Bot<br><br>def upload_image(username, password, image_path, caption):<br>    bot = Bot()<br>    bot.login(username=username, password=password)<br><br>    # Load and resize the image<br>    img = Image.open(image_path)<br>    img = img.resize((1080, 1080))<br>    temp_image_path = &quot;temp_image.jpg&quot;<br>    img.save(temp_image_path)<br><br>    # Upload the image with the specified caption<br>    bot.upload_photo(temp_image_path, caption=caption)<br><br>    # Clean up temporary files<br>    os.remove(temp_image_path)<br><br>    bot.logout()<br><br># Input your Instagram credentials<br>username = input(&quot;Enter your Instagram username: &quot;)<br>password = input(&quot;Enter your Instagram password: &quot;)<br><br># Input the path to the image you want to upload<br>image_path = input(&quot;Enter the path to your image file: &quot;)<br><br># Input the caption for your post<br>caption = input(&quot;Enter your caption: &quot;)<br><br>upload_image(username, password, image_path, caption)</pre><h3>Understanding the Script</h3><ul><li>The script imports necessary modules, including ‘instabot’ for Instagram interactions and ‘PIL’ for image manipulation.</li><li>It defines a function, ‘upload_image,’ that logs into your Instagram account, resizes the image, uploads it with the specified caption, and logs out.</li><li>Users are prompted to enter their Instagram credentials, the image path, and the caption.</li></ul><h3>Running the Script</h3><ol><li>Save the script to a ‘.py’ file.</li><li>Run the script, and you’ll be prompted to enter your Instagram credentials, the path to your image file, and the caption for your post.</li></ol><h3>Conclusion</h3><p>With this Python script, you can simplify your Instagram posting process. Whether you’re a social media manager or simply looking to streamline your personal Instagram posts, automation can save you time and effort.</p><p>🚀 So why wait? Give it a try and start automating your Instagram posts with Python today!</p><p>#Python #InstagramAutomation #SocialMedia #Automation #Programming #ImageUpload</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b055f356b31" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Voice-Controlled Python Menu for Automated Tasks]]></title>
            <link>https://medium.com/@rajdattkokate/building-a-voice-controlled-python-menu-for-automated-tasks-52994f1c8b48?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/52994f1c8b48</guid>
            <category><![CDATA[ai-voice-assistant]]></category>
            <category><![CDATA[speech-recognition]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 12:58:27 GMT</pubDate>
            <atom:updated>2023-09-08T12:58:27.699Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*TyA76L2tKhf0X_QvfmQW2g.jpeg" /></figure><p>🗣️ Imagine a world where you can control your computer with just your voice. In this blog, we’re going to explore how to create a Python menu that allows you to execute various commands using voice commands. With a few lines of code, you’ll be able to open applications, perform tasks, and even bid your computer goodbye — all with the power of your voice.</p><h3>Setting the Stage</h3><p>To get started, you’ll need to install the speech_recognition library:</p><pre>pip install SpeechRecognition</pre><h3>Writing the Python Script</h3><p>Here’s a Python script that listens for your voice commands and responds accordingly:</p><pre>import speech_recognition as sr<br>import os<br><br>def process_voice_command():<br>    recognizer = sr.Recognizer()<br>    with sr.Microphone() as source:<br>        print(&quot;Listening...&quot;)<br>        recognizer.adjust_for_ambient_noise(source)  # Adjust for background noise<br>        audio = recognizer.listen(source)<br><br>    try:<br>        # Recognize the audio and convert it to text<br>        command = recognizer.recognize_google(audio).lower()<br>        print(&quot;You said:&quot;, command)<br>        return command<br>    except sr.UnknownValueError:<br>        print(&quot;Sorry, I didn&#39;t understand that.&quot;)<br>        return &quot;&quot;<br>    except sr.RequestError:<br>        print(&quot;Sorry, there was an issue connecting to the service.&quot;)<br>        return &quot;&quot;<br><br>def on_key_press1():<br>    command = process_voice_command()<br><br>    if &quot;run&quot; in command or &quot;execute&quot; in command or &quot;open&quot; in command or &quot;start&quot; in command:<br>        if &quot;explorer&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;explorer&quot;)<br>        elif &quot;notepad&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;notepad&quot;)<br>        elif &quot;chrome&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;chrome&quot;)<br>        elif &quot;microsoft&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;start microsoft-edge:&quot;)<br>        elif &quot;calculator&quot; in command and (&quot;don&#39;t&quot; or &quot;not&quot;) not in command:<br>            os.system(&quot;calc&quot;)    <br>        else:<br>            print(&quot;Command not supported.&quot;)<br><br>    elif &quot;goodbye&quot; in command:<br>        print(&quot;Goodbye! Have a great day!&quot;)<br>        quit()  # Exit the program<br><br>    elif &quot;stop&quot; in command:<br>        print(&quot;Stopping the voice recognition system.&quot;)<br>        quit()  # Exit the program<br><br>    else:<br>        print(&quot;Command not supported.&quot;)<br><br>on_key_press1()</pre><h3>How It Works</h3><ul><li>The script uses the speech_recognition library to listen for your voice.</li><li>It processes your voice command and converts it to text using Google’s speech recognition service.</li><li>Depending on your command, it can open applications like File Explorer, Notepad, Chrome, Microsoft Edge, or the Calculator.</li><li>You can also say “goodbye” to exit the program gracefully.</li></ul><h3>Enhancements and Possibilities</h3><p>This is just the beginning of what you can achieve with voice-controlled Python. You can extend this script to include more commands, control IoT devices, or automate complex tasks. The possibilities are limited only by your imagination.</p><p>🎙️ With voice-controlled Python, you’re not just talking to your computer; you’re empowering it to respond to your every command.</p><p>#Python #VoiceControl #Automation #SpeechRecognition #Programming #CodeSnippet #TechAutomation</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52994f1c8b48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Image Manipulation in Python: Face Swapping Made Easy]]></title>
            <link>https://medium.com/@rajdattkokate/mastering-image-manipulation-in-python-face-swapping-made-easy-24f41a887aa5?source=rss-25e35f64f08------2</link>
            <guid isPermaLink="false">https://medium.com/p/24f41a887aa5</guid>
            <category><![CDATA[cv2]]></category>
            <category><![CDATA[faceswapping-images]]></category>
            <category><![CDATA[using-python]]></category>
            <dc:creator><![CDATA[Rajdatt kokate]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 12:32:22 GMT</pubDate>
            <atom:updated>2023-09-08T12:32:22.207Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*10EsOypl5JDlmt-sq4uySA.jpeg" /></figure><p>📸 Have you ever wondered how to take two photographs, crop a face from one, and seamlessly paste it onto another? In this blog, we’ll explore the fascinating world of image manipulation using Python. We’ll learn how to use OpenCV, a powerful computer vision library, to perform this fun and creative task.</p><h3>The Magic of Image Manipulation</h3><p>Image manipulation is not only a popular pastime but also an essential skill in various fields, from graphic design to computer vision. Python, with its versatile libraries, makes image editing accessible to everyone.</p><h3>Setting Up the Environment</h3><p>Before we dive into the code, make sure you have OpenCV installed. You can install it using pip:</p><pre>pip install opencv-python</pre><h3>Writing the Python Script</h3><p>Let’s create a Python script that allows users to select two images, crop a face from one image, and paste it onto the other. We’ll use the ‘cv2’ library for this purpose.</p><pre>import cv2<br><br># Load the images<br>pic1 = cv2.imread(&quot;input_image_1.jpg&quot;)<br>pic2 = cv2.imread(&quot;input_image_2.jpg&quot;)<br><br># Display the loaded images<br>cv2.imshow(&quot;Image 1&quot;, pic1)<br>cv2.imshow(&quot;Image 2&quot;, pic2)<br>cv2.waitKey(0)<br>cv2.destroyAllWindows()<br><br># Select a region of interest (ROI) from pic1 (the face) chnage according to your images<br>face_roi = pic1[85:175, 60:300]<br><br># Overlay the ROI (face) onto pic2 at a specific location chnage according to your images<br>pic2[85:175, 60:300] = face_roi<br><br># Display the result<br>cv2.imshow(&quot;Image with Swapped Face&quot;, pic2)<br>cv2.waitKey(0)<br>cv2.destroyAllWindows()<br><br># Save the output image<br>cv2.imwrite(&quot;output_image.jpg&quot;, pic2)</pre><h3>Understanding the Script</h3><ul><li>We load two images, ‘input_image_1.jpg’ and ‘input_image_2.jpg’.</li><li>The script displays both loaded images to the user.</li><li>We select a region of interest (ROI) from the first image, which contains the face we want to swap.</li><li>The script then overlays this ROI (the face) onto the second image at a specific location.</li><li>The final result is displayed to the user and saved as ‘output_image.jpg’.</li></ul><h3>Running the Script</h3><p>Save the script to a ‘.py’ file and place your two input images (‘input_image_1.jpg’ and ‘input_image_2.jpg’) in the same directory. Run the script, and it will guide you through the process of selecting and swapping faces.</p><h3>Conclusion</h3><p>With Python and OpenCV, image manipulation becomes an exciting and creative endeavor. You can explore more advanced techniques, such as image blending and advanced face recognition, to take your image editing skills to the next level.</p><p>So go ahead, unleash your creativity, and start experimenting with image manipulation in Python!</p><p>#Python #ImageManipulation #OpenCV #FaceSwapping #ComputerVision #Programming #CodeSnippet</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24f41a887aa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>