<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ashish Mishra</title>
    <description>The latest articles on Forem by Ashish Mishra (@blank_slate).</description>
    <link>https://forem.com/blank_slate</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F616590%2F2312c729-85f2-4c01-8735-2238e90320e0.jpeg</url>
      <title>Forem: Ashish Mishra</title>
      <link>https://forem.com/blank_slate</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/blank_slate"/>
    <language>en</language>
    <item>
      <title>AEM + Jenkins Integration</title>
      <dc:creator>Ashish Mishra</dc:creator>
      <pubDate>Wed, 27 Aug 2025 10:30:26 +0000</pubDate>
      <link>https://forem.com/blank_slate/aem-jenkins-integration-2ibf</link>
      <guid>https://forem.com/blank_slate/aem-jenkins-integration-2ibf</guid>
      <description>&lt;p&gt;🚀 Just published a guide on integrating Jenkins with AEM for automated deployments.&lt;br&gt;
 Cut manual steps, secure credentials, and streamline CI/CD.&lt;br&gt;
 👉 Read here: &lt;a href="https://lnkd.in/dEK3pCZq" rel="noopener noreferrer"&gt;https://lnkd.in/dEK3pCZq&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aem</category>
      <category>jenkins</category>
      <category>devops</category>
    </item>
    <item>
      <title>Unlimited Free Email Address using Cloudflare and your Free Custom Domain</title>
      <dc:creator>Ashish Mishra</dc:creator>
      <pubDate>Sun, 08 May 2022 07:39:34 +0000</pubDate>
      <link>https://forem.com/blank_slate/unlimited-free-email-address-using-cloudflare-and-your-free-custom-domain-235h</link>
      <guid>https://forem.com/blank_slate/unlimited-free-email-address-using-cloudflare-and-your-free-custom-domain-235h</guid>
      <description>&lt;p&gt;We all have faced this issue where we need to provide our email id for registration purposes on different websites. Sometimes we think we can avoid giving our personal or business email addresses as this can result in spam emails.&lt;/p&gt;

&lt;p&gt;Now, on the internet, we know there are many websites that provide free temporary email addresses. No doubt those email addresses will do your job, but there are some disadvantages to them, such as they are temporary addresses so cant be used for the long term, second you need to create those addresses beforehand to fill in the website. Now, as this trick is very well known, many sites block addresses from these websites' domain names.&lt;/p&gt;

&lt;p&gt;There is another way to generate an unlimited Gmail email address by adding a (+) plus sign. for example - &lt;strong&gt;&lt;a href="mailto:abc+xyz@gmail.com"&gt;abc+xyz@gmail.com&lt;/a&gt;&lt;/strong&gt; or &lt;strong&gt;&lt;a href="mailto:abc+123@gmail.com"&gt;abc+123@gmail.com&lt;/a&gt;&lt;/strong&gt; , these all will go to &lt;strong&gt;&lt;a href="mailto:abc@gmail.com"&gt;abc@gmail.com&lt;/a&gt;&lt;/strong&gt;. This method will work on most sites if they don't have a check on plus sign with gmail.com addresses.&lt;/p&gt;

&lt;p&gt;Cloudflare Trick: We will use the free domain from the freedom website for this tutorial, if you already have a domain name registered with Cloudflare, then go to step 3.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Get Free Domain Name:&lt;/strong&gt; Go to &lt;a href="https://www.freenom.com/"&gt;freenom. com&lt;/a&gt;, and register for an account. Once login to the website, search for a domain name that is available, then select the &lt;strong&gt;.tk&lt;/strong&gt; option and checkout. This domain is free of cost and valid for 1 year. On the checkout page, you can change the duration from 3 months to 12 months and then proceed for checkout. You will get your free domain name now. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2e4TAXfq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651989311235/X7AnSVa7t.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2e4TAXfq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651989311235/X7AnSVa7t.gif" alt="freenom.gif" width="880" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Login or create a &lt;a href="https://dash.cloudflare.com/login"&gt;Cloudflare&lt;/a&gt; account. Add your domain name to the Cloudflare dashboard. Now, Cloudflare will search for the existing domain name record for this domain and then ask you to modify it to point to Cloudflare name servers. Copy the name servers from Cloudflare, and go to freedom, domain management and replace the name servers. You need to wait for a few minutes till Cloudflare picks the new changes.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2mxTYcL_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651991340568/gHSypxLDL.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2mxTYcL_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651991340568/gHSypxLDL.gif" alt="cloudflare-nameservers-change.gif" width="879" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Now, go to the email section of Cloudflare, it will show some records are missing, you can click on a skip for now. Click on the Route tab and then click on Enable Email Routing. Cloudflare will show some options you just need to accept those recommendations and apply. Finally, it will give you an "Email Routing is enabled and routing emails." message. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLjQIEJc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651992112199/_0ULGkFs0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZLjQIEJc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651992112199/_0ULGkFs0.gif" alt="enable-email-record.gif" width="880" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;All set to create email addresses. Go to the Routes tab and scroll to the destination email address section, add your email address where you want to receive all emails for this domain. Once you verify the destination email address &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SyXE_rFP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651995048178/VwUtoDH5u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SyXE_rFP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651995048178/VwUtoDH5u.png" alt="image.png" width="880" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to the "Catch-all address" section and enable it, click on edit and select send to option and from the next drop down select your email address which you have verified. Click Save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bbEuhcHI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651995180255/9Ud85Evvq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bbEuhcHI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1651995180255/9Ud85Evvq.png" alt="image.png" width="880" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, you are set to use any email address from this domain. Like if you receive an email on &lt;a href="mailto:hashnode@domainname.tk"&gt;hashnode@domainname.tk&lt;/a&gt;, &lt;a href="mailto:devto@domainname.tk"&gt;devto@domainname.tk&lt;/a&gt;, or &lt;a href="mailto:medium@domainname.tk"&gt;medium@domainname.tk&lt;/a&gt;. These all will land in your primary email address which you verified in cloudflare.&lt;/p&gt;

&lt;p&gt;Now, while signing up on any website, you can add any email address on that website and the email will land on your webmail.&lt;/p&gt;

&lt;p&gt;That's a wrap. Let me know your feedback on this. Please follow for more such tricks and tutorials.&lt;/p&gt;

</description>
      <category>gmail</category>
      <category>free</category>
      <category>email</category>
      <category>cloudflare</category>
    </item>
    <item>
      <title>Fetch Unread Emails to Slack using Slash Commands Bot</title>
      <dc:creator>Ashish Mishra</dc:creator>
      <pubDate>Sun, 17 Apr 2022 13:29:18 +0000</pubDate>
      <link>https://forem.com/blank_slate/fetch-unread-emails-to-slack-using-slash-commands-bot-491g</link>
      <guid>https://forem.com/blank_slate/fetch-unread-emails-to-slack-using-slash-commands-bot-491g</guid>
      <description>&lt;p&gt;Slack is one of the most popular messaging tools. In this article, we will connect our free slack account with Gmail using Slash commands and Google Scripts to pull our unread emails. Many times we face situations where Gmail is blocked because of security in some workplaces and machines. Using this we will be able to view our emails directly in Slack.&lt;/p&gt;

&lt;h2&gt;
  
  
  Slack Account
&lt;/h2&gt;

&lt;p&gt;You need to have a slack account to follow this tutorial, you can create a free account from here &lt;a href="http://slack.com/intl/en-in/"&gt;Join Slack&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once we create or log in to the slack workspace, we need to get an email address where we can forward the unread emails from Gmail.&lt;/p&gt;

&lt;p&gt;Follow the steps from this &lt;a href="https://slack.com/intl/en-in/help/articles/206819278-Send-emails-to-Slack#h_01F4WE06MBF06BBHQNZ1G0H2K5"&gt;slack article&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---gQVSg8Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650198597684/dOIA6ehgU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---gQVSg8Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650198597684/dOIA6ehgU.png" alt="image.png" width="880" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Google Script Account
&lt;/h2&gt;

&lt;p&gt;As we are going to use google script API to pull emails, please log into your google account and then go to &lt;a href="https://script.google.com/home/start"&gt;Google Script&lt;/a&gt;. Click on &lt;strong&gt;New Project&lt;/strong&gt; on the top left screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7wRXR2pI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650197124960/i9xDA2ahC.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7wRXR2pI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650197124960/i9xDA2ahC.png" alt="image.png" width="880" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A new script editing window will open, remove the dummy code and paste the below code. Save the script, and provide a name to the project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function fetchUnreadGmailAndSendToSlack() {
  var threads = GmailApp.search('is:unread');
    for (var i = 0; i &amp;lt; threads.length; i++) {
        console.log("found message with subject :: "+threads[i].getMessages()[0].getSubject());
        threads[i].getMessages()[0].forward('email-id-from-slack@team-name.slack.com');
        threads[i].getMessages()[0].markRead();
        console.log("Mail forwareded to slack.");
    }
   console.log("finished.");
}

function doPost(request){
  fetchUnreadGmailAndSendToSlack();
  console.log(request);
  var responseContent = '{"text": "Message Received, Bots are Working On ! "}';
  var response = ContentService.createTextOutput(responseContent);
  response.setMimeType(ContentService.MimeType.JSON);
  return response;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On line number 5, please change the email id to your slack email id received from the above step.&lt;/p&gt;

&lt;p&gt;In this code there are two methods, as Slack makes a POST request, we have created one doPost() which will receive the request and call the fetchUnreadGmailAndSendToSlack() method. It will also reply back in the slack chat with a success message, which will indicate the request is processed successfully. fetchUnreadGmailAndSendToSlack this method will search for the unread emails using Gmail APP API. Once it finds the list, it will iterate through those emails and forward them to provided slack mail-id and then mark them as read.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uv7YfMiG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650198896777/xUQrM-2xw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uv7YfMiG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650198896777/xUQrM-2xw.png" alt="image.png" width="880" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, that we are done with coding, we need to deploy this script and get the URL using which we can execute it. Click on the Deploy button on the top right, then select New deployment. Here as it's our first deployment, we need to tell google which kind of script is this, so select the type as Web app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pO6J64ES--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650199251199/w2-A2NY_y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pO6J64ES--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650199251199/w2-A2NY_y.png" alt="image.png" width="880" height="695"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then write some description, select your email id in the Execute as an option, this will make sure, whenever this script is run it will use your access, and in the last drop-down select anyone under "Who has access". Click Deploy, and then authorize. It will ask you to then select your google account, a warning will pop up, click on advanced, and then click on your project name.&lt;/p&gt;

&lt;p&gt;A similar screen should come up, copy the Web app URL. Anyone with this endpoint can trigger your script.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j6pCOJiF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650199653033/OVpSD1S8Q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j6pCOJiF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650199653033/OVpSD1S8Q.png" alt="image.png" width="880" height="695"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Head Back to Slack
&lt;/h2&gt;

&lt;p&gt;As we have our script which will pull the unread email, we need to create an app on Slack to access this script using our slash commands. Go to this &lt;a href="https://api.slack.com/apps?new_app=1"&gt;Slack APP URL&lt;/a&gt;, click on the &lt;strong&gt;Create New App&lt;/strong&gt; Button, select from scratch, enter details and click create.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--toNDMwxU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650199965775/yiWAE0em9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--toNDMwxU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650199965775/yiWAE0em9.png" alt="image.png" width="880" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we need to set slash commands, which will invoke our google script.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GSdA0Q4S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650201848845/GVP33awok.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GSdA0Q4S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650201848845/GVP33awok.png" alt="image.png" width="880" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on &lt;strong&gt;Create New Command&lt;/strong&gt; and fill details. Text which you enter in the command box will be used to invoke this app, whereas in the Request URL enter your Google Web app Deployment URL. Add short description and hit save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m1RmMwK---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650200078746/FBzIUlFw5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m1RmMwK---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650200078746/FBzIUlFw5.png" alt="image.png" width="880" height="903"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One Last Step is to install this app in your workspace. Under Settings, select Install App, authorize the app by selecting the workspace.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KCu--ue0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650200578753/vDq7gB1Cj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KCu--ue0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650200578753/vDq7gB1Cj.png" alt="image.png" width="880" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we are all set to pull our unread emails directly in slack. So, go to slack chat and invoke this app by typing / and then your command entered above in any chat window. In my case its &lt;strong&gt;/supermanfetchemails&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hPT9Y9JL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650200741022/2ZJZK-xV9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hPT9Y9JL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650200741022/2ZJZK-xV9.png" alt="image.png" width="880" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should see a message in the chat as &lt;strong&gt;Message Received, Bots are Working On!&lt;/strong&gt; and unread emails must have arrived from the slack bot chat.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yMfY1s-P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650201368978/cAJs1QoGU.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yMfY1s-P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1650201368978/cAJs1QoGU.png" alt="image.png" width="880" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now whenever you need to find your un-read emails from Gmail, you call your own superman bot. Further customization can be done in google script, as Gmail APP Api provides multiple functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's a wrap. Let me know your feedback on this.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>slack</category>
      <category>gmail</category>
      <category>bots</category>
      <category>script</category>
    </item>
    <item>
      <title>Elastic Search Cheatsheet</title>
      <dc:creator>Ashish Mishra</dc:creator>
      <pubDate>Sun, 02 Jan 2022 17:24:34 +0000</pubDate>
      <link>https://forem.com/blank_slate/elastic-search-cheatsheet-45jh</link>
      <guid>https://forem.com/blank_slate/elastic-search-cheatsheet-45jh</guid>
      <description>&lt;p&gt;Recently in my project, we started working on improving our Search Capability. We were using the couchbase full-text search and wanted to move to something more powerful and dynamic. After going through multiple suggestions, we decided to go ahead with Elastic Search. This post includes all the necessary APIs you would need to build a simple search on &lt;a href="https://www.elastic.co/elastic-stack/"&gt;Elastic&lt;/a&gt;, using &lt;a href="https://www.elastic.co/kibana/"&gt;Kibana&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In these all examples, we have considered our Index name as Cat.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To get all the Indexes in the Elastic, use this.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   GET /_cat/indices?h=index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now, to create an Index in Elastic, make a PUT request with the index name.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   PUT cat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To get the Index Mapping, use
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_mapping
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Delete Index- In case you want to remove an index altogether, just make a delete request in Kibana with the index name.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE cat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Reindexing-Sometimes you will face an issue, where you have to copy all the documents from one index to another. So, in that case, _reindex will come in the picture, just enter the source and destination index name, it will copy the documents. You can also add ingest pipeline option, in case you want all your documents to run through this pipeline before indexing, this is optional.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST _reindex
{
"source": {
"index": "cat"
},
"dest": {
"index": "cat_backup",
"pipeline": "some_ingest_pipeline"
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Delete one document- In case you want to delete a document from one of the indexes, just follow the below API syntax.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE cat/_doc/123456789
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, As you are up and running with the Elastic Index creation. Let's talk about a few requests with basic elastic search queries.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To delete documents matching specific conditions, use Delete By Query calls.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /cat/_delete_by_query
{
"query": {
"match_all": {}
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Get count of all Documents, in an index.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_count
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To search for documents with id.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_search
{
"query": {
 "match": {
   "_id": "97351395-2241-4287-953e-6987dbf93827"
 }
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The above query will return all the fields of the document, but in case you only need some specific fields. Use the query with _source key, which allows us to pass the fields which we need in the document.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_search
{
"_source": [
"title",
"description"
],
"query": {
"match": {
  "_id": "97351395-2241-4287-953e-6987dbf93827"
}
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If you are not aware of the field, where you will get the search term, and want to search all the fields for the search text, then use &lt;strong&gt;query_string&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_search
{
"query": {
    "query_string": {
       "query": "kiwi"
    }
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To search for the exact terms, use match_phrase.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_search
{
"query": {
"match_phrase": {
  "name": "deals of the day"
}
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To search for the parent document using child, try the below request.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_search
{
"query": {
 "parent_id": {
     "type": "child",
     "id": "00000001"
 }
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Using the below query, you can search for a document, where the colour field is either black or white, whereas the breed is Persian.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_search
{
"query": {
"bool": {
  "must": {
    "match": {
      "breed": "Persian"
    }
  },
  "should": [
    {
      "match": {
        "color": "black"
      }
    },
    {
      "match": {
        "color": "white"
      }
    }
  ],
  "minimum_should_match": 1
}
}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;In case you are using any &lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.16/analyzer.html"&gt;analyzer&lt;/a&gt; in the index, so to verify how search terms will behave use analyze requests. As result, you will get the tokens, on which the actual search will take place.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET cat/_analyze
{
"analyzer": "ascii-stop-analyzer",
"text": "açaí a la carte"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's a wrap, for now, Further, I will update this post with the component template, index template, Ingest Pipeline and Index Mapping.&lt;/p&gt;

&lt;p&gt;Please Ignore the spacing issue in query JSONs because of the markdown format.&lt;/p&gt;

&lt;p&gt;Important Links:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://www.elastic.co/guide/index.html"&gt;Elastic Documentation.&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started.html"&gt;Elastic Quick Start&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/swlh/parent-and-child-joins-with-elasticsearch-7-381f6cca73fe"&gt;Parent child relationship&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>elastic</category>
      <category>kibana</category>
      <category>search</category>
    </item>
    <item>
      <title>Twitter Bot which tweets Mars Photos</title>
      <dc:creator>Ashish Mishra</dc:creator>
      <pubDate>Sun, 03 Oct 2021 14:33:14 +0000</pubDate>
      <link>https://forem.com/blank_slate/twitter-bot-which-tweets-mars-photos-aak</link>
      <guid>https://forem.com/blank_slate/twitter-bot-which-tweets-mars-photos-aak</guid>
      <description>&lt;p&gt;Hi! In this article, we will build a simple Twitter bot with Python, which will use NASA Open source API to tweet Mars Image every 1 hour. I have built this Bot and hosted it on Heroku and it's online for the past few months. You can view it here &lt;a href="https://twitter.com/ImageMars" rel="noopener noreferrer"&gt;Mars Image Bot&lt;/a&gt;. So, follow along, as I detail below the entire process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Getting Credentials from NASA Open API&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As we are going to pull our Images from NASA Open source API, which in turn gets these Images from Mars Rover. So, let's first visit &lt;a href="https://api.nasa.gov/" rel="noopener noreferrer"&gt;https://api.nasa.gov/&lt;/a&gt;, Here we have to enter few details, and it will give us an API Key to access its APIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633268342669%2FT15bU5RoL.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633268342669%2FT15bU5RoL.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After entering all details, you should see the below screen, where API Key will be shown, please note this carefully, we will need it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633268600733%2FkMnKk5-5B.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633268600733%2FkMnKk5-5B.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, from the menu, select Browse APIs and enter Mars in the search box, you should see all mars related APIs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633268715422%2FRUXdBFtaq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633268715422%2FRUXdBFtaq.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we are going to use the below API, which sends us random Image Data every time we change the SOL number.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=12&amp;amp;api%5C_key=DEMO%5C_KEY" rel="noopener noreferrer"&gt;https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=12&amp;amp;api\_key=DEMO\_KEY&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Replace the DEMO_KEY with your API Key.&lt;/p&gt;

&lt;p&gt;This Endpoint returns a Photos Array, which contains all information. we will be traversing it and finding the Image Endpoint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633268891214%2FLWD78mWGA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633268891214%2FLWD78mWGA.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay, So we have all the info which we needed from NASA.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Code our Python Bot&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We will first get the Twitter API keys, for that go to this URL &lt;a href="https://developer.twitter.com/en/portal/dashboard" rel="noopener noreferrer"&gt;Developer Portal&lt;/a&gt; and follow the process, which is self-explanatory. In the end, you should have your Access Key and Consumer Key. (Do let me know in the comments if you face any issues.)&lt;/p&gt;

&lt;p&gt;Let's start coding. 😈&lt;/p&gt;

&lt;p&gt;First Lets import the &lt;strong&gt;tweepy&lt;/strong&gt; and other libraries, and set the Twitter keys in a variable. I have used config variables, as I am going to deploy it to a Server Later on, you can directly assign the values, for local development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633269617128%2F_LTNx7tKQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633269617128%2F_LTNx7tKQ.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, try to make a connection with Twitter, If all goes well you should see the "Connection Done!" message, in the terminal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633269088073%2FHhLW4UY__.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633269088073%2FHhLW4UY__.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, as we are connected to Twitter, let's try to pull the Image from NASA API, which we are going to use. First, we are getting the current date and time, and printing it out. Next, we are trying to fetch a random Integer, if you remember in NASA API, we need to pass a random SOL. So, we will add this number in the API Url, and make a get request. If the request code is 200, we will start reading the response, or else will print an error message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633270094814%2FLsSzSeA-h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633270094814%2FLsSzSeA-h.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As our Image URL is in the photos array, we will save this array in photos_array, and as you can see in the response, there are multiple images object in the array, so let's pick a random object from the array by again using the random library. Once we found the Image, pass the message and image to another function, from where we will actually update the Twitter status.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633270528687%2F-ScuqlJlN.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633270528687%2F-ScuqlJlN.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This function is very simple, it makes a web call to the Image URL and then pulls it. Further, it uses the below method of tweepy library to update Twitter status.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;api.update_with_media(filename, status=message)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, if you have followed all these steps and call the &lt;strong&gt;get_random_image_from_nasa&lt;/strong&gt; function, you should be able to tweet an image, but let's schedule it to run every one hour.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633270965994%2FulTzWYp89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1633270965994%2FulTzWYp89.png" alt="image.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, we are using, schedule library, to run the above function every hour.&lt;/p&gt;

&lt;p&gt;Congrats!, now your bot is working.&lt;/p&gt;

&lt;p&gt;Let me know if you want me to write about how to host this bot to Heroku and run free for life. 🐶&lt;/p&gt;

&lt;p&gt;Github Repo URL - &lt;a href="https://github.com/a-blank-slate/mars-image-tweeting-bot/blob/main/tweet.py" rel="noopener noreferrer"&gt;https://github.com/a-blank-slate/mars-image-tweeting-bot/blob/main/tweet.py&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks! for reading this.&lt;/p&gt;

</description>
      <category>github</category>
      <category>bot</category>
      <category>twitter</category>
      <category>python</category>
    </item>
    <item>
      <title>Handy Commands For Developers</title>
      <dc:creator>Ashish Mishra</dc:creator>
      <pubDate>Sun, 11 Jul 2021 18:54:48 +0000</pubDate>
      <link>https://forem.com/blank_slate/handy-commands-for-developers-2005</link>
      <guid>https://forem.com/blank_slate/handy-commands-for-developers-2005</guid>
      <description>&lt;h2&gt;
  
  
  Chrome
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Copy data to Clipboard
&lt;/h4&gt;

&lt;p&gt;If you want to copy an object or variable to the clipboard from the console, then use the below copy command. The below line will copy AABB text to the system clipboard.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    copy("AABB");

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Couchbase
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Scenario 1: Copy all documents from One Bucket to another
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    INSERT INTO \`bucket-name\` (KEY _k, VALUE _v) SELECT META().id _k, _v from \`bucket-name\` _v

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 2: Deleting everything from bucket
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    DELETE FROM \`bucket-name\`

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Git
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Scenario 1: Need to remove a Modified File from Git pull request
&lt;/h4&gt;

&lt;p&gt;Switch to the branch from which you created the pull request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; git checkout pull-request-branch

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Overwrite the modified file(s) with the file in another branch, let's consider it's &lt;strong&gt;master&lt;/strong&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout origin/master -- src/main/java/HelloWorld.java

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commit and push it to the remote:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "Removed a modified file from pull request"
git push origin pull-request-branch

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 2: Update the commit user name and email in the respective Git repo.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config user.name user-name
git config user.email username-git@gmail.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 3: Git updating the buffer size in Git repo, helps in case a large file is present in Git and you are trying to clone it in the local system.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global http.postBuffer 1048576000

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 4: Stop tracking changes to a file in Sourcetree.
&lt;/h4&gt;

&lt;p&gt;I guess This is the issue which troubled me most in git. Let's say, I have a file in my code base that I don't want to commit as this is specific to my local. But still, Sourcetree shows this file to me, every time I try to commit. This is really very annoying. to fix this run the below command in the repo folder and the Sourcetree will understand our feelings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git update-index --assume-unchanged file.filename

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For folder use this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git rm -r --cached path_to_your_folder/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get undo/show dir's/files that are set to assume-unchanged run this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git update-index --no-assume-unchanged file.filename

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get a list of dir's/files that are assume-unchanged run this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git ls-files -v|grep '^h'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To delete all local checked out branches&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch -D `git branch`

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Maven
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Scenario 1: Start the AEM in debug mode
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;java -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=127.0.0.1:8765 -XX:+HeapDumpOnOutOfMemoryError -XX:MaxPermSize=256M -Xmx1024m -Dorg.apache.sling.commons.log.level=INFO -jar cq-quickstart-6.5.0.jar

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 2: Build and deploy AEM
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn -PautoInstallPackage -Padobe-public clean install

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 3: Start the Spring boot application
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn clean spring-boot:run

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 4: Start Spring boot in specific mode
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn clean spring-boot:run -Dspring-boot.run.profiles=local

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 5: Skip J-Unit test
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-Dmaven.test.skip=true

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 6: Start Spring boot in debug mode and also run a specific profile and skip j unit test compilation
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mvn spring-boot:run -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" -Dspring-boot.run.profiles=local -Dmaven.test.skip=true

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Redis
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Scenario 1: Start Redis Server
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;redis-server

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Scenario 2: Clear redis cache
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;redis-cli flushall

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  To Be Continued....
&lt;/h4&gt;

</description>
      <category>maven</category>
      <category>git</category>
      <category>chrome</category>
      <category>redis</category>
    </item>
  </channel>
</rss>
