<?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>DEV Community: Mert Yazıcıoğlu</title>
    <description>The latest articles on DEV Community by Mert Yazıcıoğlu (@mert).</description>
    <link>https://dev.to/mert</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%2F29485%2F348ed68c-f5ac-456e-a8a6-fb6902a5a1fe.jpg</url>
      <title>DEV Community: Mert Yazıcıoğlu</title>
      <link>https://dev.to/mert</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mert"/>
    <language>en</language>
    <item>
      <title>Filtering Googlebot IPs from a list of IP addresses</title>
      <dc:creator>Mert Yazıcıoğlu</dc:creator>
      <pubDate>Mon, 25 Jun 2018 15:05:10 +0000</pubDate>
      <link>https://dev.to/mert/filtering-googlebot-ips-from-a-list-of-ip-addresses-249</link>
      <guid>https://dev.to/mert/filtering-googlebot-ips-from-a-list-of-ip-addresses-249</guid>
      <description>&lt;p&gt;Hey there dev.to community!&lt;/p&gt;

&lt;p&gt;I recently needed a simple script to filter Googlebot IPs from a list of IP addresses to be able to extract actual Googlebot visits from an access log.&lt;/p&gt;

&lt;p&gt;Thankfully, Google provides &lt;a href="https://support.google.com/webmasters/answer/80553?hl=en"&gt;a method to make sure a visitor is actually Googlebot&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you have a similar need, there you go:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# Performs reverse and forward DNS lookups to list Googlebot's IPs, given a list&lt;/span&gt;
&lt;span class="c"&gt;# of IP addresses as a file. Useful for filtering access logs to find out actual&lt;/span&gt;
&lt;span class="c"&gt;# Googlebot visits.&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;
&lt;span class="c"&gt;# An implementation of https://support.google.com/webmasters/answer/80553?hl=en&lt;/span&gt;

&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nv"&gt;IFS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; IP_ADDRESS &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$IP_ADDRESS&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;do
    &lt;/span&gt;&lt;span class="nv"&gt;IS_GOOGLEBOT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
    &lt;span class="nv"&gt;REVERSE_LOOKUP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;host &lt;span class="nv"&gt;$IP_ADDRESS&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$REVERSE_LOOKUP&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s2"&gt;"google.com.&lt;/span&gt;&lt;span class="nv"&gt;$|&lt;/span&gt;&lt;span class="s2"&gt;googlebot.com.$"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;IS_GOOGLEBOT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; IS_GOOGLEBOT &lt;span class="nt"&gt;-eq&lt;/span&gt; 1 &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nv"&gt;FORWARD_LOOKUP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;host &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$REVERSE_LOOKUP&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 5&lt;span class="si"&gt;)&lt;/span&gt; | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 4&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$FORWARD_LOOKUP&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$IP_ADDRESS&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;then
            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$IP_ADDRESS&lt;/span&gt;
        &lt;span class="k"&gt;fi
    fi
done&lt;/span&gt; &amp;lt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You may save it as something like &lt;code&gt;filter-googlebot-ips.sh&lt;/code&gt; and provide a file with a list of IP addresses to filter (each on a single line), as an argument. Like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;./filter-googlebot-ips.sh access-log-ips.txt &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; googlebot-ips.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will perform reverse and forward DNS lookups for each of the IP addresses and print out the verified Googlebot IPs to &lt;code&gt;STDOUT&lt;/code&gt;, which you can write to a file like in the example above.&lt;/p&gt;

&lt;p&gt;Hope it helps someone out there! 🙌&lt;/p&gt;

&lt;p&gt;&lt;em&gt;PS: &lt;a href="https://gist.github.com/merty/57a4c272afbc38a0a79128f718a80f62"&gt;Here is a GitHub Gist&lt;/a&gt; if you prefer that.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>bash</category>
      <category>googlebot</category>
      <category>script</category>
    </item>
    <item>
      <title>JavaScript Linting Tools</title>
      <dc:creator>Mert Yazıcıoğlu</dc:creator>
      <pubDate>Fri, 25 Aug 2017 14:23:09 +0000</pubDate>
      <link>https://dev.to/mert/javascript-lintingtools</link>
      <guid>https://dev.to/mert/javascript-lintingtools</guid>
      <description>&lt;p&gt;Linting is statically checking the source code of a program to find code that does not adhere to a certain code style and discover problematic patters in the code. As a dynamic and loosely-typed language, JavaScript benefits greatly from a linting tool.&lt;/p&gt;

&lt;p&gt;Below are the most popular linting tools for JavaScript, listed and briefly explained, in the order they are released.&lt;/p&gt;

&lt;p&gt;For more information, please visit projects’ own websites.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a href="http://www.jslint.com/"&gt;JSLint&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;JSLint is a tool created by Douglas Crockford that aims to ensure high quality JavaScript code by checking the code against the rules defined by Douglas Crockford who detailed them in his book, JavaScript: The Good Parts.&lt;/p&gt;

&lt;p&gt;Although JSLint has a few options to “tolerate certain things, it is not a configurable linting tool. The reason why is explained as follows at jslint.com:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;JSLint was designed to reject code that some would consider to be perfectly fine. The reason for this is that JSLint’s purpose is to help produce programs that are free of error. That is difficult in any language and is especially hard in JavaScript. JSLint attempts to help you increase the visual distance between correct programs and incorrect programs, making the remaining errors more obvious. JSLint will give warnings about things that are not necessarily wrong in the current situation, but which have been observed to mask or obscure errors. Avoid those things when there are better options available.&lt;/p&gt;

&lt;p&gt;It is dangerous out there. JSLint is here to help.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can either use it online following the link above or integrate it to your development and/or deployment workflow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command-Line Tool:&lt;/strong&gt; &lt;a href="https://github.com/reid/node-jslint"&gt;https://github.com/reid/node-jslint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grunt Plugin:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/grunt-jslint"&gt;https://www.npmjs.com/package/grunt-jslint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gulp Plugin:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/gulp-jslint"&gt;https://www.npmjs.com/package/gulp-jslint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The source code is also available on GitHub:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/douglascrockford/JSLint"&gt;https://github.com/douglascrockford/JSLint&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you wish more control over the linting criteria, check out JSHint, which is explained right below.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="http://jshint.com"&gt;JSHint&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;JSHint is a community-driven, flexible, open source linting tool that does not try to enforce certain coding preferences and allows developers to configure it according to their coding conventions. JSHint simply does its job by checking the code against the given style and detects errors and potential problems in the code.&lt;/p&gt;

&lt;p&gt;You can either use it online following the link above or integrate it to your development and/or deployment workflow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Command-Line Tool:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/jshint"&gt;https://www.npmjs.com/package/jshint&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grunt Plugin:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/grunt-contrib-jshint"&gt;https://www.npmjs.com/package/grunt-contrib-jshint&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gulp Plugin:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/gulp-jshint"&gt;https://www.npmjs.com/package/gulp-jshint&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More Information:&lt;/strong&gt; &lt;a href="http://jshint.com/install/"&gt;http://jshint.com/install/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://eslint.org/"&gt;ESLint&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;ESLint is the next-generation linter that is highly configurable to the point that it allows custom parsers and plugins to extend its linting process. The customizability of ESLint should not overwhelm you, you can still simply use it the way you use JSHint.&lt;/p&gt;

&lt;p&gt;To fully grasp what ESLint is and what it isn’t, here is the philosophy behind ESLint, from its About page:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Everything is pluggable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rule API is used both by bundled and custom rules&lt;/li&gt;
&lt;li&gt;Formatter API is used both by bundled and custom formatters&lt;/li&gt;
&lt;li&gt;Additional rules and formatters can be specified at runtime&lt;/li&gt;
&lt;li&gt;Rules and formatters don’t have to be bundled to be used&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is standalone&lt;/li&gt;
&lt;li&gt;Can be able to be turned off or on (nothing can be deemed “too important to turn off”)&lt;/li&gt;
&lt;li&gt;Can be set to be a warning or error individually&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additionally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rules are “agenda free”
– ESLint does not promote any particular coding style&lt;/li&gt;
&lt;li&gt;Any bundled rules are generalizable&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;For more information, please follow the instructions on &lt;a href="https://eslint.org/docs/user-guide/getting-started"&gt;Getting Started with ESLint&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;If you are looking for more advanced features mentioned above, please follow the detailed instructions on &lt;a href="https://eslint.org/docs/user-guide/configuring"&gt;Configuring ESLint&lt;/a&gt;:&lt;/p&gt;




&lt;h2&gt;
  
  
  But, which one to choose?
&lt;/h2&gt;

&lt;p&gt;At this day and age, ESLint is hands down the best choice with its extensibility and out-of-the-box support for many of your modern day needs.&lt;/p&gt;

&lt;p&gt;Get started with ESLint following the basic instructions linked above and dive deeper into its capabilities as your needs arise.&lt;/p&gt;




&lt;p&gt;Are you using a linting tool? Share your experience in the comments!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>eslint</category>
      <category>jslint</category>
      <category>jshint</category>
    </item>
  </channel>
</rss>
