Jekyll2020-08-20T19:46:33+05:30https://rahulja.in/feed.xmlRahul JainThis is the personal blog and profile of Rahul Jain, a full-stack engineer and web enthusiast living in Singapore.Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutPrice comparison between remittance methods from Singapore to India - 20202020-02-15T00:00:00+05:302020-02-16T08:39:24+05:30https://rahulja.in/posts/comparison-remittance-prices-singapore-to-india<p>As you start earning in Singapore, you’ll have to start looking into different methods of sending money from Singapore to India, be it for personal expenses, loans, family etc. To make the choice easier, here’s what I’ve found between different remittance methods. The methods I am reviewing here are <a href="https://www.dbs.com.sg/personal/default.page">DBS Bank Overseas Money Transfer</a>, <a href="https://transferwise.com/invite/u/rahulj248">Transferwise</a> and <a href="https://www.instarem.com/invite/cj5NBN">InstaReM</a>.</p>
<h2 id="dbs-bank-overseas-money-transfer"><a href="https://www.dbs.com.sg/personal/onboarding.page">DBS Bank Overseas Money Transfer</a></h2>
<p>This is the easiest method to send money that I’ve found. You need to get a DBS account for this, and then you can use the default overseas transfer option given by them. You can find the options as below:</p>
<table class="auto-margin">
<tr>
<td>
<a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_overseas_internet_banking@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_overseas_internet_banking.png" alt="DBS Internet Banking Overseas Money Transfer" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_overseas_internet_banking@2x.png" data-zooming-width="600" data-zooming-height="631" />
</a>
</td>
<td>
<a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_overseas_mobile_app@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_overseas_mobile_app.png" alt="DBS Mobile App Overseas Money Transfer" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_overseas_mobile_app@2x.png" data-zooming-width="600" data-zooming-height="611" />
</a>
</td>
</tr>
</table>
<p><strong>Pros</strong>:</p>
<ol>
<li>Ease of use as you’re remitting directly from the bank account.</li>
<li>Highly trusted bank in Singapore.</li>
<li>Provides direct bank to bank transfer with no middle man.</li>
<li>No transfer fees</li>
<li>Creating an account with DBS sometimes has ongoing offers that can give you some cash benefit.</li>
</ol>
<p><strong>Cons</strong>:</p>
<ol>
<li>Lowest conversion price offered among all 3</li>
<li>Transfer takes time (Next Day Transfer)</li>
</ol>
<p><a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_price@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_price.png" alt="DBS Converted Price" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/dbs_price@2x.png" data-zooming-width="600" data-zooming-height="502" />
</a></p>
<h6 id="apply-now-dbs---online-applications-and-services">Apply Now: <strong><a href="https://www.dbs.com.sg/personal/onboarding.page">DBS - Online Applications and Services</a></strong></h6>
<p><br />
<br /></p>
<h2 id="transferwise"><a href="https://transferwise.com/invite/u/rahulj248">Transferwise</a></h2>
<blockquote>
<p>A cheaper, faster way to send money abroad.</p>
</blockquote>
<p>They are pretty famous for borderless account services(30+ countries) with multi-currency card(40+ currencies) that can send as well as receive money in different currencies. To transfer money overseas, find the options below:</p>
<table class="auto-margin">
<tr>
<td>
<a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_desktop@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_desktop.png" alt="Transferwise Internet Banking Overseas Money Transfer" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_desktop@2x.png" data-zooming-width="600" data-zooming-height="217" />
</a>
</td>
<td>
<a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_mobile@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_mobile.png" alt="Transferwise Mobile App Overseas Money Transfer" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_mobile@2x.png" data-zooming-width="600" data-zooming-height="154" />
</a>
</td>
</tr>
</table>
<p>Pros:</p>
<ol>
<li>Very famous for overseas money transfer, so can be trusted more than random remittance methods.</li>
<li>Best conversion rates provided.</li>
<li>Transfer in an hour</li>
</ol>
<p>Cons:</p>
<ol>
<li>No direct bank to bank transfer. Money goes to Transferwise and comes from their bank accounts. So need to keep additional receipts for proof.</li>
<li>Transfer fees are highest among all 3 (0.59%)</li>
</ol>
<p><a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_price@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_price.png" alt="Transferwise Converted Price" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/transferwise_price@2x.png" data-zooming-width="600" data-zooming-height="649" />
</a></p>
<h6 id="apply-now-and-get-free-first-transfer-of-up-to-s500-transferwise---signup">Apply Now and get free first transfer of up to S$500: <strong><a href="https://transferwise.com/invite/u/rahulj248">Transferwise - Signup</a></strong></h6>
<p><br />
<br /></p>
<h2 id="instarem"><a href="https://www.instarem.com/invite/cj5NBN">InstaReM</a></h2>
<blockquote>
<p>Overseas Money Transfers with Zero FX<super>*</super></p>
</blockquote>
<p>This is a Singapore-headquartered offering digital cross-border money transfers. While it has operations in multiple countries, it is not as famous as Transferwise. Give it a go as it currently provides the best overseas money transfer conversion amount. To transfer money overseas, find the options below:</p>
<table class="auto-margin">
<tr>
<td>
<a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_desktop@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_desktop.png" alt="InstaReM Internet Banking Overseas Money Transfer" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_desktop@2x.png" data-zooming-width="600" data-zooming-height="329" />
</a>
</td>
<td>
<a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_mobile@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_mobile.png" alt="InstaReM Mobile App Overseas Money Transfer" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_mobile@2x.png" data-zooming-width="600" data-zooming-height="429" />
</a>
</td>
</tr>
</table>
<p>Pros:</p>
<ol>
<li>Singapore headquartered company topping the lists for a while in overseas money transfer</li>
<li>Lowest fees among all 3</li>
<li>Highest total converted amount in all 3</li>
</ol>
<p>Cons:</p>
<ol>
<li>No direct bank to bank transfer. Money goes to InstaReM and comes from their bank accounts. So need to keep additional receipts for proof.</li>
<li>Least Known company among all 3</li>
<li>A bit higher conversion rate than transferwise</li>
<li>Takes time to transfer the money</li>
</ol>
<p><a class="" href="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_price@2x.png">
<img src="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_price.png" alt="InstaReM Converted Price" data-action="zoom" data-rjs="/assets/posts/comparison-remittance-prices-singapore-to-india/instarem_price@2x.png" data-zooming-width="600" data-zooming-height="669" />
</a></p>
<h6 id="apply-now-and-get-475-points-worth-more-than-s5-instarem---signup">Apply Now and get 475 points worth more than S$5: <strong><a href="https://www.instarem.com/invite/cj5NBN">InstaReM - Signup</a></strong></h6>
<p><br />
<br /></p>
<h2 id="conclusion">Conclusion</h2>
<p>All 3 mentioned above are viable options, but for me, I’ve found InstaReM to give a little more than the rest. Transferwise might be good if you’re in a hurry as the difference is not that much, but DBS gives around 1% lower converted currency than the rest, at least when I checked the prices here.</p>
<p>I would recommend getting an account with <a href="https://www.dbs.com.sg/personal/default.page">DBS Bank</a>, <a href="https://transferwise.com/invite/u/rahulj248">Transferwise</a> and <a href="https://www.instarem.com/invite/cj5NBN">InstaReM</a>, and then compare and transfer based on your preference and real-time comparison. All 3 methods offer additional benefits and features that will be useful in your long stay in Singapore!</p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutAs you start earning in Singapore, you’ll have to start looking into different methods of sending money from Singapore to India, be it for personal expenses, loans, family etc. To make the choice easier, here’s what I’ve found between different remittance methods. The methods I am reviewing here are DBS Bank Overseas Money Transfer, Transferwise and InstaReM.Why Google Stadia amazes me2019-11-24T00:00:00+05:302019-11-24T23:08:43+05:30https://rahulja.in/posts/why-google-stadia-amazes-me<p><a class="" href="/assets/posts/why-google-stadia-amazes-me/stadia-logo.png">
<img src="/assets/posts/why-google-stadia-amazes-me/stadia-logo.png" alt="Stadia Logo" data-action="zoom" data-rjs="/assets/posts/why-google-stadia-amazes-me/stadia-logo.png" data-zooming-width="800" data-zooming-height="533" />
</a></p>
<h3 id="objective">Objective</h3>
<p>Since before the launch of Google stadia on November 19th, I’ve started seeing articles and videos on why Google stadia is going to fail, how the game collection is really bad, how they are using wires right now instead of going completely wireless, and I’m getting tired of everyone shutting stadia down without giving it a chance.</p>
<p>A few people have even compared it to the other services that are going to launch like Microsoft’s xCloud and said how those were going to be better as they know the space.</p>
<p>I’m just going to write about what got me excited about Stadia when it was launched, and why I still am as excited about the service as I was when they announced it.</p>
<h3 id="background">Background</h3>
<p>To start with, I’m going to give a background. I am not a gamer. It’s not because I don’t like games. I do. I used to play a lot of games back in school when I had a computer. Back then, games like Midtown Madness didn’t ask you for overclocked octa cores or having teraflops of graphics just to enjoy some downtime. I could enjoy almost any famous game without having to ask my parents to spend an arm and a leg on a system.</p>
<blockquote>
<p>Games didn’t use to ask for octa cores and teraflops of graphics</p>
</blockquote>
<p>After school, it got real. When you’re working on a limited budget and trying to get into Computer Science, your system becomes something more than a downtime. You have to decide on what to buy based on research, use case and something that will help and be there for the long haul.</p>
<p>And research I did. After months, I concluded that Macbook Pro would be a good investment (in 2011) when all my friends were buying Windows laptops with loudspeakers and amazing graphics. I still remember the conversation I had with my cousin. He said- If you’re sure about it, know that you’ll never be able to play games like you used to. The model I opted for had no graphics card, and with 4GB RAM, around 300MBs of Integrated graphics, how can you even argue that. And I know it was a good decision because I’m typing this article on that same laptop 9 years later, now upgraded to 16gigs and SSD, running better than the day I purchased it.</p>
<blockquote>
<p>If you’re sure about buying a macbook, know that you’ll never be able to play games like you used to.</p>
</blockquote>
<p>I have thought about getting a new laptop or a console for gaming so many times since, but it just never made sense to spend money frivolously when I knew there’s no future for that device after a couple of years. Shifting every few of years doesn’t work with lugging a console and a TV around. Getting a bulky laptop for everyday use when I knew I’m only going to play games rarely never made sense. And games are becoming crazily graphics intensive that the systems now start with a couple of thousand dollars with decent graphics. When the lowest recommendation is 4 gigs of VRAM with a 7th Gen i5, you know where we are heading.</p>
<blockquote>
<p>When you’re on the move every few years, you can’t really get into consoles or bulky systems.</p>
</blockquote>
<p>I remember being excited when I got a good enough smartphone that maybe I can finally game, but, well, have you seen what mobile versions of games are like? Civilisation, Age of Empires… They are so bad that I feel for the franchise after playing them.</p>
<blockquote>
<p>Gaming on mobile is just…</p>
</blockquote>
<h6 id="then-google-announces-stadia">Then google announces Stadia.</h6>
<p><br /></p>
<h3 id="overview">Overview</h3>
<p>We have been moving away from CDs and DVDs for so long now. Netflix, Amazon Prime, Disney+ etc would never have thrived if we had kept saying how buffering is bad, the collection limited and kept buying CDs for the movies instead of shifting to streaming services. Was your internet that good when Netflix came that you instantly switched over? Has it always been cheap and buffering free browsing YouTube? Not for me at least. I remember pausing the youtube video every time I open it and allow it to buffer enough so that I can watch it uninterrupted. How many of you still prefer buying CD players? Or have CD players in their systems?</p>
<blockquote>
<p>Moving from CDs to streaming was also shaky at the beginning</p>
</blockquote>
<p>I think just like back then, the industry is afraid of what Google can do with streaming games. All the Xboxes and PlayStations have to start working on cloud offerings now or become as obsolete as the CD players now are. And with how many data centres Google has and the low latencies and streaming experience it has, I can say they did an amazing job with Stadia.</p>
<p>117ms is what I saw in one of the youtube reviews. 117ms of latency for a game running thousands of miles away on servers. The path being instructions going from your stadia controller to the servers through all the internet congestion, through the OSI layers or however they are sending the signals, their servers processing it all in real-time and sending back 4K video, again, all of this in under 117 ms. That just blows my mind. PUBG on my mobile has that kind of latency and that’s actually running on my system.</p>
<blockquote>
<p>Having just 117 latency for 4k heavy duty games at launch is simply amazing</p>
</blockquote>
<p>I get that all those FPS games will suffer in these latencies. Or games like DOTA will due to them requiring really fast response rates to be competitive. But I think Stadia at launch is not really for those types of games. I can see games like Planet Zoo, Civilisation 6, Cities Skyline etc thriving on Stadia right from the get-go. The only obstacle I can see to that is the Vulkan which I think will catch on really fast.</p>
<p><strong>FREE 1080P gaming</strong>. How are you not get excited over that? Just pay for the game and you can play it for free forever or as long as google keeps it free. How can you not be excited over that? It just boggles my mind when people are not shouting how good these offerings are.</p>
<blockquote>
<p>Free 1080p gaming at 60fps is a really good offering for those without a gaming device</p>
</blockquote>
<p>A new game is out but the system you bought doesn’t really support even the lowest settings anymore? Yeah, time to spend thousands of dollars to play that game now. How does that even make sense to anyone? Oh, you like Pokemon? Time to buy Nintendo Switch, even though the only games you might play on that are Pokemon and Zelda. New spiderman game is out, but you have to get Playstation to play that, or Xbox for the Halo fans. You might be made out of money, but I sure am not.</p>
<blockquote>
<p>Market is too scattered in franchises and devices to always keep wanting more.</p>
</blockquote>
<p>This is no different than shifting from CD players to streaming services, from owning expensive servers to data centres and renting the servers from them. You think it’s easy to even get 117ms latency? It is so bad for others that Cloudflare’s premium 1.1.1.1 Wrap+ is a service that helps you avoid internet congestion to get better latency and speeds. While the world has shifted to streaming everything, the Internet is the one to suffer the most.</p>
<blockquote>
<p>The tech behind Stadia is a complex problem that Google has amazingly tried to solve</p>
</blockquote>
<p>Now it might sound like I’m a google’s fanboy here or just too blinded to the flaws of Stadia, but believe me, I’m not. I’ve always been more data-driven in how I spend my money. I need to be able to justify myself that the money I’m spending was a well thought out decision with pros and cons balanced. A service promising free 1080p 60fps gaming on any platform with reasonably low latencies backed with 10.7 teraflops of graphics only asking to purchase the games? I’m in. This is just like renting out the data centres to play games which seems amazing to me. I can’t even begin to comprehend the complexities behind a project like this. But I can appreciate the effort made by the stadia team here and hope that they launch in Singapore soon (I know you have a data centre in Singapore google. In a city with dedicated data centre for lowest latencies.. Why have you not launched here?!)</p>
<blockquote>
<p>Just launch in Singapore, will you?</p>
</blockquote>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="https://en.wikipedia.org/wiki/Google_Stadia" target="_blank" rel="noopener noreferrer">Wikipedia - Google Stadia</a>
<br />
<a href="https://stadia.dev/" target="_blank" rel="noopener noreferrer">Developer - Stadia</a>
<br />
<a href="https://www.google.com/search?hl=en&q=google%20stadia" target="_blank" rel="noopener noreferrer">Google Stadia - Search</a></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutUsing nmap (Network Mapper) for debugging SSL security2019-05-29T00:00:00+05:302019-05-29T02:11:09+05:30https://rahulja.in/posts/using-nmap-for-debugging-ssl-security<p><strong>nmap</strong> <em>is a free, open-source utility for network exploration and security auditing.</em> This utility has a great many features like determining the hosts on the network, services offered by them, their OS, firewalls, and dozens of other characteristics. You can find details in the references I’m providing below.</p>
<p>This is a utility I’ve used recently and would like to give it a shoutout while explaining how it helped me. The task was to upgrade a web server from using TLSv1.0 to TLSv1.2 SSL encryption. If you’re unaware, older versions of TLS and SSL have <em>unfixable threats</em> that can be utilized by hackers to gain access to your valuable data. It is also a matter of compliance now for systems that require high-security standards.</p>
<p>So, I have <a href="https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html">added TLSv1.2 support in my Tomcat server</a>, setup mutual auth with an older client and was in the middle of testing the upgrade, when the client received <strong>SSL Handshake error</strong>. Now, this error can occur due to any number of reasons, and unlike curl output that gives very detailed information on SSL Handshake as you can see below, The application just returned a very unhelpful stacktrace with the message: SSL Handshake error</p>
<h6 id="curl">Curl</h6>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>○ → curl -v https://rahulja.in
* Rebuilt URL to: https://rahulja.in/
* Trying 104.27.142.136...
* TCP_NODELAY set
* Connected to rahulja.in (104.27.142.136) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305
* ALPN, server accepted to use h2
* Server certificate:
* subject: OU=Domain Control Validated; OU=PositiveSSL Multi-Domain; CN=sni145373.cloudflaressl.com
* start date: May 22 00:00:00 2019 GMT
* expire date: Nov 28 23:59:59 2019 GMT
* subjectAltName: host "rahulja.in" matched cert's "rahulja.in"
* issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO ECC Domain Validation Secure Server CA 2
* SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fbeb4000400)
> GET / HTTP/2
</code></pre></div></div>
<p>In the above curl output, you can see that the SSL Handshake succeeded with <code class="language-plaintext highlighter-rouge">TLSv1.2 (IN), TLS handshake, Finished (20):</code>, you can see the cipher used for SSL <code class="language-plaintext highlighter-rouge">TLSv1.2 / ECDHE-ECDSA-CHACHA20-POLY1305</code> and even that HTTP2 is being used.</p>
<p>So, I needed a way to get some of the above details using some other method. This is when I stumbled upon nmap. The result I received was precisely what I wanted:</p>
<h6 id="command">Command</h6>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>○ → nmap --script ssl-enum-ciphers -p 443 rahulja.in
</code></pre></div></div>
<h6 id="result">Result</h6>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Starting Nmap 7.70 ( https://nmap.org ) at 2019-05-29 01:56 IST
Nmap scan report for rahulja.in (104.27.143.136)
Host is up (0.13s latency).
Other addresses for rahulja.in (not scanned): 104.27.142.136
PORT STATE SERVICE
443/tcp open https
| ssl-enum-ciphers:
| TLSv1.0:
| ciphers:
| TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (ecdh_x25519) - A
| compressors:
| NULL
| cipher preference: server
| TLSv1.1:
| ciphers:
| TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (ecdh_x25519) - A
| compressors:
| NULL
| cipher preference: server
| TLSv1.2:
| ciphers:
| TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (ecdh_x25519) - A
| TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256-draft (ecdh_x25519) - A
| compressors:
| NULL
| cipher preference: client
|_ least strength: A
Nmap done: 1 IP address (1 host up) scanned in 6.21 seconds
</code></pre></div></div>
<p>Above there, you can easily see that with a simple command, you can see all the supported TLS versions and ciphers they support. After this information, it is just a matter of checking whether your client can use the ciphers supported by the server and you’re good to go. Check out the references for more details.</p>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="https://www.securitymetrics.com/blog/ssl-tls-v12-tips-migration" target="_blank" rel="noopener noreferrer">SSL To TLS V1.2: Tips For Migration</a>
<br />
<a href="https://nmap.org/book/intro.html" target="_blank" rel="noopener noreferrer">Getting Started with Nmap</a>
<br />
<a href="https://www.admin-enclave.com/en/articles/windows/167-use-nmap-to-check-used-ssl-tls-protocol-and-ciphers.html" target="_blank" rel="noopener noreferrer">Use nMap to check used SSL/TLS protocol and ciphers</a>
<br />
<a href="https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html" target="_blank" rel="noopener noreferrer">SSL/TLS Configuration HOW-TO - Tomcat</a>
<br />
<a href="https://hackertarget.com/nmap-tutorial/" target="_blank" rel="noopener noreferrer">Nmap Tutorial: from the Basics to Advanced Tips</a>
<br />
<a href="https://blogs.oracle.com/java-platform-group/diagnosing-tls,-ssl,-and-https" target="_blank" rel="noopener noreferrer">Java: Diagnosing TLS, SSL, and HTTPS</a></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutnmap is a free, open-source utility for network exploration and security auditing. This utility has a great many features like determining the hosts on the network, services offered by them, their OS, firewalls, and dozens of other characteristics. You can find details in the references I’m providing below.Getting Started with Gradle using Java Application2018-05-19T00:00:00+05:302019-11-24T23:27:24+05:30https://rahulja.in/posts/getting-started-with-gradle-using-java-application<p><a class="" href="/assets/posts/getting-started-with-gradle-using-java-application/gradle-logo.jpg">
<img src="/assets/posts/getting-started-with-gradle-using-java-application/gradle-logo.jpg" alt="Gradle" data-action="zoom" data-rjs="/assets/posts/getting-started-with-gradle-using-java-application/gradle-logo.jpg" data-zooming-width="680" data-zooming-height="146" />
</a></p>
<p>If you’ve worked in Java, you probably have encountered Gradle by now, be it in an Android or a Spring Application. Whether you have used Gradle or not, It’s good to know one of the leading build tools in the market.</p>
<blockquote>
<p><a href="https://gradle.org/" target="_blank" rel="noopener noreferrer">Gradle</a> is the next evolutionary step in <a href="https://en.wikipedia.org/wiki/Java_virtual_machine" target="_blank" rel="noopener noreferrer">JVM</a>-based build tools. It draws on lessons learned from established tools such as <a href="https://ant.apache.org/" target="_blank" rel="noopener noreferrer">Ant</a> and <a href="https://maven.apache.org/" target="_blank" rel="noopener noreferrer">Maven</a> and takes their best ideas to the next level. Following a build-by-convention approach, Gradle allows for declaratively modelling your problem domain using a powerful and expressive domain-specific language (DSL) implemented in <a href="http://groovy-lang.org/" target="_blank" rel="noopener noreferrer">Groovy</a> instead of XML. Because Gradle is a JVM native, it allows you to write custom logic in the language you’re most comfortable with, be it Java or Groovy.<sup><a href="http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608" target="_blank" rel="noopener noreferrer">[1]</a></sup></p>
</blockquote>
<ul>
<li>Gradle builds are not just for Java applications. You can leverage Gradle to help you build applications in Java, C++, Python or your language of choice.</li>
<li>You can find <a href="https://docs.gradle.org/current/userguide/userguide.html" target="_blank" rel="noopener noreferrer">official tutorials</a> for Android, C++, Groovy, Java, JavaScript, Kotlin and Scala under Project Tutorials.</li>
</ul>
<h3 id="install">Install</h3>
<p>To install Gradle, please follow the <a href="https://gradle.org/install/" target="_blank" rel="noopener noreferrer">official docs</a> to get up to date installation instructions. Installation using package manager is recommended.</p>
<h3 id="basic-concepts">Basic concepts</h3>
<ul>
<li>A Gradle <strong>Build</strong> can have multiple <strong>Projects</strong> which in turn can have multiple <strong>Tasks</strong></li>
<li>A <code class="language-plaintext highlighter-rouge">gradle.properties</code> file is required to configure the build and <code class="language-plaintext highlighter-rouge">settings.gradle</code> file is required for multi-project builds to tell Gradle which projects to build.</li>
<li>Gradle supports <strong>Plugins</strong>, which contains dependencies, tasks and configurations(like source location) that can be applied to our build and make Gradle easy to use.</li>
</ul>
<h3 id="features">Features</h3>
<p>Check out the categorized <a href="https://gradle.org/features/" target="_blank" rel="noopener noreferrer">list of features</a> provided by Gradle.</p>
<ul>
<li><a href="https://blog.gradle.org/introducing-incremental-build-support" target="_blank" rel="noopener noreferrer">Incremental Builds</a></li>
<li><a href="https://docs.gradle.org/current/userguide/custom_tasks.html#worker_api" target="_blank" rel="noopener noreferrer">Parallel Execution</a></li>
<li><a href="https://docs.gradle.org/current/userguide/tutorial_gradle_command_line.html#sec:continue_build_on_failure" target="_blank" rel="noopener noreferrer">Continuous Execution even After Failures</a></li>
<li><a href="https://docs.gradle.org/current/userguide/dependency_management.html#sub:exclude_transitive_dependencies" target="_blank" rel="noopener noreferrer">Transitive Dependencies</a></li>
<li><a href="https://docs.gradle.org/current/userguide/dependency_management.html#sec:dependency_resolution" target="_blank" rel="noopener noreferrer">Version Conflict Resolution</a></li>
<li><a href="https://gradle.org/features/" target="_blank" rel="noopener noreferrer">Gradle Features</a></li>
<li><a href="https://docs.gradle.org/current/userguide/logging.html#sec:changing_what_gradle_logs" target="_blank" rel="noopener noreferrer">Customizable Logging</a></li>
</ul>
<h3 id="building-a-java-application-using-gradle">Building a Java Application using Gradle</h3>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">mkdir </span>java-demo <span class="o">&&</span> <span class="nb">cd </span>java-demo
gradle init <span class="nt">--type</span> java-application</code></pre></figure>
<ul>
<li>Gradle comes with a built-in plugin called the <a href="https://docs.gradle.org/current/userguide/build_init_plugin.html" target="_blank" rel="noopener noreferrer"><strong>Build Init Plugin</strong></a>. You can see the details of building a Java application in the <a href="https://guides.gradle.org/building-java-applications/" target="_blank" rel="noopener noreferrer">official docs</a>.</li>
<li>It generates the default <code class="language-plaintext highlighter-rouge">main</code> and <code class="language-plaintext highlighter-rouge">test</code> folders for the source code along with other configurational files.</li>
<li>The <code class="language-plaintext highlighter-rouge">build.gradle</code> file contains <em>java</em> and <em>application</em> plugins, a class name for the entry point of <strong>jar</strong>, the public Bintray Artifactory repository and some dependencies to help with the development and testing of the application.</li>
<li>Because the Gradle build used the Application plugin, you can use the <code class="language-plaintext highlighter-rouge">./gradlew run</code> command to Build, Test and Execute the project.</li>
</ul>
<h3 id="important-components-of-gradle">Important components of Gradle</h3>
<h4 id="gradle-wrapper">Gradle Wrapper</h4>
<p>This is the recommended way to build a Gradle project. When you initialize a Gradle project, the <a href="https://docs.gradle.org/current/userguide/gradle_wrapper.html" target="_blank" rel="noopener noreferrer">gradle wrapper</a> is set up automatically which can be executed just like Gradle as:</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">./gradlew <task></code></pre></figure>
<p>Gradle changes a lot with its upgrades and the old <code class="language-plaintext highlighter-rouge">gradle.build</code> files might not work for the newer versions. Gradle Wrapper automatically downloads and uses the recommended version of Gradle to execute your tasks.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">gradle wrapper</code></pre></figure>
<p>You have to push the Gradle wrapper files to <strong>Version control</strong> like git, including <strong>jars</strong>, so everyone can use the same wrapper to build your projects
You can <strong>upgrade</strong> the Gradle wrapper via it’s CLI to make sure any other optimizations present in the build are also applied.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">./gradlew wrapper <span class="nt">--gradle-version</span> 4.2.1</code></pre></figure>
<h4 id="gradle-daemon">Gradle Daemon</h4>
<ul>
<li>This daemon runs in the background on your system and helps builds run faster by avoiding the expensive bootstrapping process as well as leveraging caching, by keeping data about your project in memory.</li>
<li>Gradle Daemon is enabled by default starting with Gradle 3.0, so it requires no setup.</li>
<li>In between builds, it waits idly for the next build. This has the obvious benefit of only requiring Gradle to be loaded into memory once for multiple builds, as opposed to once for each build.</li>
<li>The Daemon can also leverage caching and can progressively become more optimal with each rebuild to decrease the build times.</li>
</ul>
<p>Go through the <a href="https://docs.gradle.org/current/userguide/command_line_interface.html" target="_blank" rel="noopener noreferrer">Gradle CLI Docs</a> to see what else you can do;</p>
<h3 id="dependency-management-with-gradle">Dependency management with Gradle</h3>
<p>This is one of the major feature provided by a build system. Dependency management is a technique for declaring, resolving and using dependencies required by the project in an automated fashion.</p>
<p>There are some widely used public <a href="https://docs.gradle.org/current/userguide/declaring_repositories.html" target="_blank" rel="noopener noreferrer">repositories</a> of Gradle like <code class="language-plaintext highlighter-rouge">mavenCentral()</code>, <code class="language-plaintext highlighter-rouge">jcenter()</code> and <code class="language-plaintext highlighter-rouge">google()</code>. But you can also define other repositories by url, even the ones secure access via credentials.</p>
<p>There are different <a href="https://docs.gradle.org/current/userguide/declaring_dependencies.html" target="_blank" rel="noopener noreferrer"><strong>types of dependencies</strong></a>:</p>
<figure class="highlight"><pre><code class="language-gradle" data-lang="gradle"><span class="k">dependencies</span> <span class="o">{</span>
<span class="c1">// Module dependencies</span>
<span class="n">runtime</span> <span class="nl">group:</span> <span class="s1">'org.springframework'</span><span class="o">,</span> <span class="nl">name:</span> <span class="s1">'spring-core'</span><span class="o">,</span> <span class="nl">version:</span> <span class="s1">'2.5'</span>
<span class="c1">// File Dependencies</span>
<span class="n">runtime</span> <span class="nf">files</span><span class="o">(</span><span class="s1">'libs/a.jar'</span><span class="o">,</span> <span class="s1">'libs/b.jar'</span><span class="o">)</span>
<span class="n">compile</span> <span class="nf">files</span><span class="o">(</span><span class="s2">"$buildDir/classes"</span><span class="o">)</span> <span class="o">{</span>
<span class="n">builtBy</span> <span class="s1">'compile'</span>
<span class="o">}</span>
<span class="c1">// Project dependencies</span>
<span class="n">compile</span> <span class="nf">project</span><span class="o">(</span><span class="s1">':shared'</span><span class="o">)</span></code></pre></figure>
<p>As Gradle is widely used in Java and Android projects, you can check these links to get a detailed overview. They will give you an idea on how to use compile, runtime or test dependencies among other things:</p>
<ul>
<li><a href="https://docs.gradle.org/current/userguide/java_plugin.html" target="_blank" rel="noopener noreferrer">Java configuration via Java plugin</a></li>
<li><a href="https://developer.android.com/studio/build/" target="_blank" rel="noopener noreferrer">Android configuration via Android plugin</a></li>
</ul>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="https://en.wikipedia.org/wiki/Gradle" target="_blank" rel="noopener noreferrer">Gradle - Wikipedia</a>
<br />
<a href="https://docs.gradle.org/" target="_blank" rel="noopener noreferrer">Gradle - Official Docs</a>
<br />
<a href="https://gradle.org/guides/" target="_blank" rel="noopener noreferrer">Gradle Tutorials and Guides</a>
<br />
<a href="https://guides.gradle.org/building-java-applications/" target="_blank" rel="noopener noreferrer">Gradle Guides - Building Java Applications</a>
<br />
<a href="http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608" target="_blank" rel="noopener noreferrer">Why Build Your Java Projects with Gradle Rather than Ant or Maven?</a></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutObject-Oriented Vanilla Javascript - Part 12017-12-24T00:00:00+05:302018-05-19T11:04:23+05:30https://rahulja.in/posts/object-oriented-vanilla-javascript-part-1<p><a class="" href="/assets/posts/object-oriented-vanilla-javascript/og-image@2x.png">
<img src="/assets/posts/object-oriented-vanilla-javascript/og-image.png" alt="Object Oriented Javascript" data-action="zoom" data-rjs="/assets/posts/object-oriented-vanilla-javascript/og-image@2x.png" data-zooming-width="800" data-zooming-height="440" />
</a></p>
<p>As web developers, we use Javascript in our daily life but rarely do we take out the time and learn intricacies of the language. We accept many things at face value as they do not impact the work we need to do and make assumptions about other things that are mostly correct.</p>
<p>But once you know you will be working on something for a long time, it’s time to put the foot down and start learn things properly to qualify from development to engineering.</p>
<p>Below are some topics that will help you get an overview of the Whats and the Hows:</p>
<ul>
<li>
<h3 id="scopes">Scopes</h3>
<ul>
<li>Scope determines the visibility of variables, functions, and objects in some particular part of your code during runtime.</li>
<li>Also called <em>Execution Context</em> (Not to be confused with <em>Context</em> below)</li>
<li>Types of Scopes:
<ul>
<li><em>Local</em> - Variables defined inside a function are not available outside that function</li>
<li><em>Global</em> - Variables defined outside any scope and can be accessed anywhere in the code</li>
<li><em>Lexical</em> - Variables from parent scope are available inside the nested scopes.
<ul>
<li>Scope Chain: When accessing a variable, JS will start searching from the current scope, and keep jumping up in nested scopes to find it.</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<figure class="highlight"><pre><code class="language-js" data-lang="js"><span class="kd">var</span> <span class="nx">bike</span> <span class="o">=</span> <span class="p">{</span><span class="na">wheels</span><span class="p">:</span> <span class="mi">2</span><span class="p">};</span> <span class="c1">// bike variable is in global scope</span>
<span class="kd">var</span> <span class="nx">ride</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">speed</span> <span class="o">=</span> <span class="mi">32</span><span class="p">;</span> <span class="c1">// speed variable is in local scope of ride function</span>
<span class="p">};</span></code></pre></figure>
<ul>
<li>
<h3 id="context--this-keyword">Context & <code class="language-plaintext highlighter-rouge">this</code> keyword</h3>
<ul>
<li>Developers generally get confused between scope and context. Context is used to refer to the value of <code class="language-plaintext highlighter-rouge">this</code> variable in some place in the code.</li>
<li>Generally, <code class="language-plaintext highlighter-rouge">this</code> keyword in a context refers to the object it was called against, i.e. the variable left of the dot in a function call.</li>
</ul>
</li>
</ul>
<figure class="highlight"><pre><code class="language-js" data-lang="js"><span class="kd">var</span> <span class="nx">fn_ride</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
<span class="p">}</span>
<span class="kd">var</span> <span class="nx">bike</span> <span class="o">=</span> <span class="p">{</span><span class="na">wheels</span><span class="p">:</span> <span class="mi">2</span><span class="p">};</span> <span class="c1">// bike variable is in global scope</span>
<span class="nx">bike</span><span class="p">.</span><span class="nx">ride</span> <span class="o">=</span> <span class="nx">fn_ride</span><span class="p">;</span>
<span class="nx">bike</span><span class="p">.</span><span class="nx">ride</span><span class="p">();</span> <span class="c1">// `ride()` points to `fn_ride()` in which `bike` will be logged</span>
<span class="c1">// `ride()` function was called in context of `bike`.</span>
<span class="c1">// So, `this` will point to `bike` inside fn_ride function</span>
<span class="c1">// during the `bike.ride()` call.</span>
<span class="nx">bike</span><span class="p">.</span><span class="nx">ride</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="nx">car</span><span class="p">);</span> <span class="c1">// here you're changing the context from `bike` to `car`</span></code></pre></figure>
<ul>
<li>
<h3 id="closures">Closures</h3>
<ul>
<li>It is created when an inner function tries to access the variables defined in and arguments passed into the outer function.</li>
<li>Even when the inner function is called outside the outer function, those variables will be available to the closure.</li>
</ul>
</li>
</ul>
<figure class="highlight"><pre><code class="language-js" data-lang="js"><span class="kd">var</span> <span class="nx">CarOf</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">driver</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">driver</span> <span class="o">+</span> <span class="dl">"</span><span class="s2"> is driving</span><span class="dl">"</span><span class="p">);</span>
<span class="p">};</span>
<span class="p">}</span>
<span class="kd">var</span> <span class="nx">drivingMyCar</span> <span class="o">=</span> <span class="nx">CarOf</span><span class="p">(</span><span class="dl">"</span><span class="s2">Mike</span><span class="dl">"</span><span class="p">);</span>
<span class="nx">drivingMyCar</span><span class="p">();</span> <span class="c1">// This will log "Mike is driving"</span>
<span class="c1">// Here the value of driver argument is preserved.</span></code></pre></figure>
<ul>
<li>
<h3 id="constructors">Constructors</h3>
<ul>
<li>These are the functions to the right of class definition.</li>
<li>The constructor function is nothing more than a normal function.</li>
</ul>
</li>
</ul>
<figure class="highlight"><pre><code class="language-js" data-lang="js"><span class="kd">var</span> <span class="nx">Car</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">driver</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// Constructor function</span>
<span class="kd">var</span> <span class="nx">wheels</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">driverName</span> <span class="o">=</span> <span class="nx">driver</span><span class="p">;</span>
<span class="p">};</span>
<span class="kd">var</span> <span class="nx">myCar</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Car</span><span class="p">(</span><span class="dl">"</span><span class="s2">Rahul</span><span class="dl">"</span><span class="p">);</span></code></pre></figure>
<ul>
<li>
<h3 id="prototype">Prototype</h3>
<ul>
<li>This is a default attribute in every javascript function.</li>
<li>It points to an object in which properties and functions of a class can be assigned that should be usable by every object of that class(object of the constructor function).</li>
<li>Every object has a prototype that can be modified through the constructor’s prototype.</li>
<li>If the current scope doesn’t have the accessed attribute, the prototype of that function is checked before going to outer nesting.</li>
<li>Every prototype has a <code class="language-plaintext highlighter-rouge">constructor</code> property that points to the class(Constructor function) of that prototype.</li>
</ul>
</li>
</ul>
<figure class="highlight"><pre><code class="language-js" data-lang="js"><span class="kd">var</span> <span class="nx">Car</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">driver</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// new anonymous function created with every new object of Car class</span>
<span class="kd">var</span> <span class="nx">driving</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">driver</span> <span class="o">+</span> <span class="dl">"</span><span class="s2"> is driving</span><span class="dl">"</span><span class="p">);</span>
<span class="p">};</span>
<span class="p">};</span>
<span class="c1">// Only one anonymous function created for every object of Car class</span>
<span class="nx">Car</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">driving</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(){</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">driver</span> <span class="o">+</span> <span class="dl">"</span><span class="s2"> is driving</span><span class="dl">"</span><span class="p">);</span>
<span class="p">}</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">Car</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="kd">constructor</span><span class="p">);</span> <span class="c1">// logs `Car`</span></code></pre></figure>
<ul>
<li>
<h3 id="prototype-chain">Prototype Chain</h3>
<ul>
<li>Every object has a prototype which has been chained all the way upto <code class="language-plaintext highlighter-rouge">Object</code> variable.</li>
</ul>
</li>
</ul>
<figure class="highlight"><pre><code class="language-js" data-lang="js"><span class="kd">var</span> <span class="nx">Vehicle</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="c1">// ...</span>
<span class="p">}</span>
<span class="kd">var</span> <span class="nx">Car</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="c1">// ...</span>
<span class="p">}</span>
<span class="nx">Car</span><span class="p">.</span><span class="nx">prototype</span> <span class="o">=</span> <span class="nb">Object</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="nx">Vehicle</span><span class="p">.</span><span class="nx">prototype</span><span class="p">);</span>
<span class="c1">// Here, we are creating link between Car's prototype and Vehicle's prototype.</span>
<span class="c1">// Any method not found in `Car.prototype` will be searched in `Vehicle.prototype`</span></code></pre></figure>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="https://www.udacity.com/course/object-oriented-javascript--ud015" target="_blank" rel="noopener noreferrer">Object-Oriented JavaScript - Udacity</a>
<br />
<a href="https://scotch.io/tutorials/understanding-scope-in-javascript" target="_blank" rel="noopener noreferrer">Understanding Scope in JavaScript - Scotch.io</a>
<br />
<a href="https://community.risingstack.com/javascript-prototype-chain-inheritance/" target="_blank" rel="noopener noreferrer">Understanding the JavaScript Prototype Chain & Inheritance - RisingStack</a></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutGet a notification when RAM is using compressions or swaps on MacOSX2017-03-17T00:00:00+05:302018-05-19T11:04:23+05:30https://rahulja.in/posts/get-a-notification-when-ram-is-using-compressions-or-swaps-on-macosx<p>When you have not shut down your mac for a long time and are using a lot of different stuff like having multiple tabs opened in the browser, your RAM tends to get filled.</p>
<p>After some time, it’ll start to use <code class="language-plaintext highlighter-rouge">compressions</code> to store old data in RAM to make way for fresh data. And after that, it’ll start to use <code class="language-plaintext highlighter-rouge">swaps</code> on your hard disk.</p>
<p>This usage of swap results in a lot of <code class="language-plaintext highlighter-rouge">reads/writes</code> in the hard disk, which can result in less responsive mac in case of HDD and shortening of life in SSDs.</p>
<p>This is a script you can schedule to run however and whenever you want using <code class="language-plaintext highlighter-rouge">crontab</code> and <code class="language-plaintext highlighter-rouge">applescript</code>. It checks various RAM stats like compressions and swap usage and notifies when they are being used.</p>
<p>Currently, it’s scheduled to <strong><em>run every hour</em></strong> and to check these RAM parameters-</p>
<ul>
<li>Compressions</li>
<li>Decompressions</li>
<li>Swapins</li>
<li>Swapouts</li>
</ul>
<p>Here is the <a href="https://gist.github.com/xRahul/a787f0c4eebfadf7af5beafdb99f9fe7" target="_blank" rel="noopener noreferrer"><strong>gist</strong></a> with the code. Just download the <code class="language-plaintext highlighter-rouge">applescript</code> file, and set it up using <code class="language-plaintext highlighter-rouge">crontab</code></p>
<noscript><pre>400: Invalid request</pre></noscript>
<script src="https://gist.github.com/a787f0c4eebfadf7af5beafdb99f9fe7.js"> </script>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="https://crontab.guru/" target="_blank" rel="noopener noreferrer">Crontab.guru</a>
<br />
<a href="https://en.wikibooks.org/wiki/AppleScript_Programming" target="_blank" rel="noopener noreferrer">AppleScript Programming - Wikibooks</a>
<br />
<a href="https://gist.github.com/xRahul/a787f0c4eebfadf7af5beafdb99f9fe7" target="_blank" rel="noopener noreferrer">xRahul/RAM_Overuse_Notification.applescript - Github Gist</a>
<br />
<a href="https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptX/AppleScriptX.html" target="_blank" rel="noopener noreferrer">Introduction to AppleScript - Apple Developer Documentation</a>
<br />
<a href="https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptX/AppleScriptX.html" target="_blank" rel="noopener noreferrer">Introduction to AppleScript Overview - Apple Developer Documentation</a>
<br />
<a href="https://developer.apple.com/library/content/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html" target="_blank" rel="noopener noreferrer">Introduction to AppleScript Language Guide - Apple Developer Documentation</a>
<br />
<a href="http://apple.stackexchange.com/questions/24862/how-can-i-configure-my-computer-to-run-an-applescript-at-a-specific-time-caveat" target="_blank" rel="noopener noreferrer">How can I configure my computer to run an AppleScript at a specific time? - Stackexchange</a>
<br /></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutWhen you have not shut down your mac for a long time and are using a lot of different stuff like having multiple tabs opened in the browser, your RAM tends to get filled.Setting up sublime-phpcs for PHP development in Sublime Text2017-03-14T00:00:00+05:302018-05-19T11:04:23+05:30https://rahulja.in/posts/setting-up-sublime-phpcs-for-php-development-in-sublime-text<h4 id="this-is-a-plugin-for-sublime-text-which-provides-checkstyle-reports-using-the-following-tools-all-optional">This is a plugin for Sublime Text which provides checkstyle reports using the following tools (all optional):</h4>
<ul>
<li>Linter (<code class="language-plaintext highlighter-rouge">php -l</code>). This provides a convenient way to perform only a syntax check on the given PHP code.</li>
<li><a href="https://github.com/squizlabs/PHP_CodeSniffer" target="_blank" rel="noopener noreferrer">PHP CodeSniffer</a> 1.3+ (<code class="language-plaintext highlighter-rouge">phpcs</code>). It tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard.</li>
<li><a href="https://phpmd.org/" target="_blank" rel="noopener noreferrer">PHP Mess Detector</a> 1.4+ (<code class="language-plaintext highlighter-rouge">phpmd</code>). It detects and reports various potential problems with the code like possible bugs, suboptimal code, overcomplicated expressions and unused parameters, methods, properties.</li>
<li><a href="https://github.com/facebook/pfff/wiki/Scheck" target="_blank" rel="noopener noreferrer">Scheck</a> 0.23+ (<code class="language-plaintext highlighter-rouge">scheck</code>, part of Facebook’s pfff toolchain). This will help you find stupid mistakes like a typo in your code.</li>
</ul>
<h4 id="you-can-also-configure-the-plugin-to-fix-the-issues-using-either">You can also configure the plugin to fix the issues using either</h4>
<ul>
<li><a href="https://github.com/FriendsOfPHP/PHP-CS-Fixer" target="_blank" rel="noopener noreferrer">PHP Coding Standards Fixer</a> 0.2+ (<code class="language-plaintext highlighter-rouge">php-cs-fixer</code>). It can fix most issues in your code when you want to follow the PHP coding standards as defined in the PSR-1 and PSR-2 documents and many more.</li>
<li>or <a href="https://github.com/squizlabs/PHP_CodeSniffer" target="_blank" rel="noopener noreferrer">PHP Code Beautifier</a> 2.2.0+ (<code class="language-plaintext highlighter-rouge">phpcbf</code>). It can automatically correct coding standard violations.</li>
</ul>
<p>This plugin has been tested on:</p>
<ul>
<li>Mac OS X 10.8.2</li>
<li>Ubuntu 11.10</li>
<li>Windows 7</li>
<li>Sublime Text 2</li>
<li>Sublime Text 3</li>
</ul>
<h2 id="install-sublime-phpcs">Install sublime-phpcs</h2>
<ul>
<li>
<p>Using Sublime Text’s Package Control <em>(recommended)</em></p>
<p><code class="language-plaintext highlighter-rouge">Preferences</code> -> <code class="language-plaintext highlighter-rouge">Package Control</code> -> <code class="language-plaintext highlighter-rouge">Install Package</code> -> <code class="language-plaintext highlighter-rouge">Phpcs</code></p>
</li>
<li>
<p>Or via git checkout in Sublime Text packages</p>
<p>Simply checkout the git repo into <code class="language-plaintext highlighter-rouge">~/Library/Application Support/Sublime Text [VERSION NUMBER]/Packages/</code> for MacOSX or the equivalent folder on Windows or Linux.</p>
</li>
</ul>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">cd</span> ~/Library/Application<span class="se">\ </span>Support/Sublime<span class="se">\ </span>Text<span class="se">\ </span>2/Packages/
git clone git://github.com/benmatselby/sublime-phpcs.git Phpcs</code></pre></figure>
<h2 id="install-dependencies">Install dependencies</h2>
<ul>
<li>Make sure you have <a href="http://php.net/manual/en/install.php" target="_blank" rel="noopener noreferrer"><code class="language-plaintext highlighter-rouge">php</code></a> installed on your system and check that you can use it directly-</li>
</ul>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">php <span class="nt">-v</span>
PHP 5.6.28 <span class="o">(</span>cli<span class="o">)</span> <span class="o">(</span>built: Dec 6 2016 12:38:54<span class="o">)</span>
Copyright <span class="o">(</span>c<span class="o">)</span> 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright <span class="o">(</span>c<span class="o">)</span> 1998-2016 Zend Technologies</code></pre></figure>
<ul>
<li>Now you need to have the latest <a href="https://getcomposer.org/doc/00-intro.md" target="_blank" rel="noopener noreferrer"><code class="language-plaintext highlighter-rouge">composer</code></a> installed. Use the provided link to move it globally.</li>
<li>Now install the <a href="https://github.com/squizlabs/PHP_CodeSniffer" target="_blank" rel="noopener noreferrer">PHP CodeSniffer</a>, <a href="https://phpmd.org/" target="_blank" rel="noopener noreferrer">PHP Mess Detector</a>, <a href="https://github.com/FriendsOfPHP/PHP-CS-Fixer" target="_blank" rel="noopener noreferrer">PHP CS Fixer</a> and <a href="https://github.com/squizlabs/PHP_CodeSniffer" target="_blank" rel="noopener noreferrer">PHP Code Beautifier</a> globally. You can also follow the links to see the install instructions for each.</li>
</ul>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">composer global require squizlabs/php_codesniffer
composer global require phpmd/phpmd
composer global require friendsofphp/php-cs-fixer</code></pre></figure>
<ul>
<li>Please note the absolute path of all the installed packages (On a Mac/Linux based environment), you can use:</li>
</ul>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">which phpcs
which phpmd
which php-cs-fixer
which phpcbf</code></pre></figure>
<ul>
<li>Now install Scheck dependencies.
<ul>
<li>Make sure you have <a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" target="_blank" rel="noopener noreferrer">git</a> installed.</li>
<li>Follow the instructions here for generic, macosx and linux to install only these two packages- <code class="language-plaintext highlighter-rouge">Ocaml</code> and <code class="language-plaintext highlighter-rouge">camlp4</code>. You do not need the other packages like GTK, Cairo, SWI-prolog or Java for scheck.
For macosx, use <a href="/posts/using-homebrew-on-macosx" target="_blank" rel="noopener noreferrer">homebrew</a></li>
</ul>
</li>
</ul>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># for macosx using homebrew</span>
brew <span class="nb">install </span>objective-caml camlp4
<span class="c"># for fedora, you may need to install these too</span>
yum <span class="nb">install </span>ocaml-camlp4 ocaml-camlp4-devel perl-pod-usage</code></pre></figure>
<ul>
<li>
<p>Now install <a href="https://github.com/facebook/pfff/wiki/Main#install" target="_blank" rel="noopener noreferrer">Scheck</a>. If you follow the instructions mentioned in their project, you can download and setup the entire <code class="language-plaintext highlighter-rouge">pfff</code> set of tools. But for our case, we just need the <code class="language-plaintext highlighter-rouge">scheck</code> part. So, follow these instructions to get just that.</p>
<p>After following the steps, you’ll find a file called <code class="language-plaintext highlighter-rouge">scheck</code> in your cloned repo. Please note the absolute path of that as you’ll need it later.</p>
</li>
</ul>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># clone their github repository somewhere</span>
git clone https://github.com/facebook/pfff.git <span class="nt">--depth</span><span class="o">=</span>1
<span class="c"># build pfff tools</span>
<span class="nb">cd</span> <path_to_cloned_github_repository>
./configure <span class="nt">-novisual</span>
make depend
make</code></pre></figure>
<ul>
<li>Now you just need to setup the configuration for <code class="language-plaintext highlighter-rouge">sublime-phpcs</code> package in sublime text.
<ul>
<li><code class="language-plaintext highlighter-rouge">Preferences</code> -> <code class="language-plaintext highlighter-rouge">Package Settings</code> -> <code class="language-plaintext highlighter-rouge">PHP Code Sniffer</code> -> <code class="language-plaintext highlighter-rouge">Settings - User</code></li>
<li>Add the following json configuration-</li>
</ul>
</li>
</ul>
<figure class="highlight"><pre><code class="language-json" data-lang="json"><span class="p">{</span><span class="w">
</span><span class="nl">"phpcs_php_path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/usr/bin/php"</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpcs_executable_path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/Users/<username>/.composer/vendor/bin/phpcs"</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpmd_executable_path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/Users/<username>/.composer/vendor/bin/phpmd"</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpcbf_executable_path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/Users/<username>/.composer/vendor/bin/phpcbf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"scheck_executable_path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/Users/<username>/Documents/GitHub/pfff/scheck"</span><span class="p">,</span><span class="w">
</span><span class="nl">"php_cs_fixer_executable_path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/Users/<username>/.composer/vendor/bin/php-cs-fixer"</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpmd_run"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nl">"scheck_run"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpcs_linter_run"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpcs_sniffer_run"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w">
</span><span class="nl">"extensions_to_blacklist"</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span><span class="w">
</span><span class="nl">"phpcs_execute_on_save"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpcs_show_errors_on_save"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpcs_command_on_save"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"php_cs_fixer_on_save"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpcbf_on_save"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpcs_linter_command_on_save"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"phpmd_command_on_save"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w">
</span><span class="nl">"scheck_command_on_save"</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="w">
</span><span class="p">}</span></code></pre></figure>
<p>In the above configuration, replace the paths with your install paths.</p>
<p>Also use either <code class="language-plaintext highlighter-rouge">php_cs_fixer</code> or <code class="language-plaintext highlighter-rouge">phpcbf</code> for fixing the errors. I’d recommend using <code class="language-plaintext highlighter-rouge">phpcbf</code> as that is already isntalled with <code class="language-plaintext highlighter-rouge">phpcs</code> and thus you won’t have to install <code class="language-plaintext highlighter-rouge">php_cs_fixer</code> at all.</p>
<p>I am disabling anything happening on save, but you can change the configuration any way you want. Find the defaults here-</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">Preferences</code> -> <code class="language-plaintext highlighter-rouge">Package Settings</code> -> <code class="language-plaintext highlighter-rouge">PHP Code Sniffer</code> -> <code class="language-plaintext highlighter-rouge">Settings - Default</code></li>
</ul>
<p>Now you just need to do <code class="language-plaintext highlighter-rouge">Cmd</code> + <code class="language-plaintext highlighter-rouge">Shift</code> + <code class="language-plaintext highlighter-rouge">P</code> and look for <code class="language-plaintext highlighter-rouge">sniff</code> options.</p>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="http://benmatselby.github.io/sublime-phpcs/" target="_blank" rel="noopener noreferrer">sublime-phpcs - Github Pages</a>
<br />
<a href="http://php.net/manual/en/features.commandline.options.php" target="_blank" rel="noopener noreferrer">PHP Command Line Options - php.net</a>
<br />
<a href="https://github.com/squizlabs/PHP_CodeSniffer" target="_blank" rel="noopener noreferrer">PHP CodeSniffer - Github</a>
<br />
<a href="https://phpmd.org/" target="_blank" rel="noopener noreferrer">PHP Mess Detector - phpmd</a>
<br />
<a href="https://github.com/FriendsOfPHP/PHP-CS-Fixer" target="_blank" rel="noopener noreferrer">PHP Coding Standards Fixer - Github</a>
<br />
<a href="https://github.com/squizlabs/PHP_CodeSniffer" target="_blank" rel="noopener noreferrer">PHP Code Beautifier - Github</a>
<br />
<a href="http://php.net/manual/en/install.php" target="_blank" rel="noopener noreferrer">PHP installation - php.net</a>
<br />
<a href="https://getcomposer.org/doc/00-intro.md" target="_blank" rel="noopener noreferrer">Introduction - Composer</a>
<br />
<a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git" target="_blank" rel="noopener noreferrer">Installing Git - git-scm</a>
<br />
<a href="https://github.com/facebook/pfff/wiki/Scheck" target="_blank" rel="noopener noreferrer">Scheck Wiki - Github</a>
<br />
<a href="https://github.com/facebook/pfff/wiki/Main" target="_blank" rel="noopener noreferrer">pfff Wiki - Github</a>
<br />
<a href="https://github.com/facebook/pfff/blob/master/install.txt" target="_blank" rel="noopener noreferrer">pfff General Install Instructions - Github</a>
<br />
<a href="https://github.com/facebook/pfff/blob/master/install_linux.txt" target="_blank" rel="noopener noreferrer">pfff Linux Install Instructions - Github</a>
<br />
<a href="https://github.com/facebook/pfff/blob/master/install_macos.txt" target="_blank" rel="noopener noreferrer">pfff MacOSX Install Instructions - Github</a>
<br />
<a href="https://github.com/benmatselby/sublime-phpcs/tree/master/example-settings" target="_blank" rel="noopener noreferrer">sublime-phpcs example configurations - Github</a></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutThis is a plugin for Sublime Text which provides checkstyle reports using the following tools (all optional):Using Homebrew on MacOSX2017-03-11T00:00:00+05:302018-05-19T11:04:23+05:30https://rahulja.in/posts/using-homebrew-on-macosx<p><a class="" href="/assets/posts/using-homebrew-on-macosx/homebrew.jpg">
<img src="/assets/posts/using-homebrew-on-macosx/homebrew.jpg" alt="Homebrew" data-action="zoom" data-rjs="/assets/posts/using-homebrew-on-macosx/homebrew.jpg" data-zooming-width="687" data-zooming-height="346" />
</a></p>
<p>If you have a mac, you need to have <a href="http://brew.sh/" target="_blank" rel="noopener noreferrer">homebrew</a> installed on it. It is the best package manager for mac, and in their own words-</p>
<blockquote>
<p>Homebrew installs <a href="https://github.com/Homebrew/homebrew-core/tree/master/Formula" target="_blank" rel="noopener noreferrer">the stuff you need</a> that Apple didn’t.</p>
</blockquote>
<p>Homebrew installs packages to their own directory and then symlinks their files into <code class="language-plaintext highlighter-rouge">/usr/local</code>. To <em>install homebrew</em>, check out simple instructions provided on their <a href="http://brew.sh/" target="_blank" rel="noopener noreferrer">homepage</a>. Homebrew deals with formulas, which are basically package definitions written in Ruby.</p>
<h3 id="below-is-a-cheatsheet-of-basic-brew-commands">Below is a cheatsheet of basic brew commands</h3>
<p><em>With <code class="language-plaintext highlighter-rouge">--verbose</code> or <code class="language-plaintext highlighter-rouge">-v</code>, many commands print extra debugging information. Note that these flags should only appear after a command.</em></p>
<table>
<tbody>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew --version</code></td>
<td>Shows current version (<em>1.1.9 at the time of this post</em>)</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew install</code></td>
<td>Install formula</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew uninstall</code></td>
<td>Uninstall formula</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew update</code></td>
<td>Fetch the newest version of Homebrew from <strong>GitHub</strong> using <code class="language-plaintext highlighter-rouge">git</code></td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew list</code></td>
<td>List all installed formulae</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew search text|/text/</code></td>
<td>Perform a substring search of formula names as string or regex</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew analytics (on|off)</code></td>
<td>Turn on/off Homebrew’s analytics</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew deps (formulae)</code></td>
<td>Show dependencies for formulae</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew desc (formula)</code></td>
<td>Display formula’s name and one-line description</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew doctor</code></td>
<td>Check your system for potential problems with brew installations</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew info (formula)</code></td>
<td>Display information about formula</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew leaves</code></td>
<td>Show installed formulae that are not dependencies of another installed formula</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew outdated</code></td>
<td>Show formulae that have an updated version available</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew prune</code></td>
<td>Remove dead symlinks from the Homebrew prefix</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew reinstall (formula)</code></td>
<td>Uninstall and then install formula</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew tap</code></td>
<td>List all installed taps (<em>A tap is a repository of formulae</em>)</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew untap (tap)</code></td>
<td>Remove a tapped repository</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew --cellar</code></td>
<td>Display the location where formula would be installed</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew cleanup (formula)</code></td>
<td>For specific formulae, remove any older versions from the cellar.</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew cleanup -n</code></td>
<td>It shows what would be removed, but does not actually remove anything</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew cask cleanup</code></td>
<td>cleanup in any installed casks</td>
</tr>
<tr>
<td><code class="language-plaintext highlighter-rouge">brew cask list</code></td>
<td>list all installed casks</td>
</tr>
</tbody>
</table>
<p><br />
<br /></p>
<p>Once you have installed homebrew and started using it, maintenance is required regularly to keep the packages up to date, clearing out the old and checking if everything installed is working correctly. Use this command to do all that at once-</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">brew update <span class="o">&&</span> brew upgrade <span class="o">&&</span> brew cleanup <span class="o">&&</span> brew cask cleanup<span class="p">;</span> brew doctor</code></pre></figure>
<p>or better yet, create an <code class="language-plaintext highlighter-rouge">alias</code> of this run that with single word command <code class="language-plaintext highlighter-rouge">brewski</code>-</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">echo</span> <span class="s2">"alias brewski='brew update && brew upgrade && brew cleanup && brew cask cleanup; brew doctor'"</span> <span class="o">>></span> ~/.bash_profile
<span class="nb">.</span> ~/.bash_profile
brewski</code></pre></figure>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="http://brew.sh/" target="_blank" rel="noopener noreferrer">Homebrew</a>
<br />
<a href="https://github.com/Homebrew/brew" target="_blank" rel="noopener noreferrer">Homebrew - GitHub</a>
<br />
<a href="https://www.safaribooksonline.com/blog/2014/03/03/homebrew/" target="_blank" rel="noopener noreferrer">Getting Started with Homebrew - Safari Books</a></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutDecrypt and extract your whatsapp database2017-02-11T00:00:00+05:302019-05-29T02:24:13+05:30https://rahulja.in/posts/decrypt-and-extract-your-whatsapp-database<p><a class="" href="/assets/posts/decrypt-and-extract-your-whatsapp-database/whatsapp-promo@2x.jpg">
<img src="/assets/posts/decrypt-and-extract-your-whatsapp-database/whatsapp-promo.jpg" alt="Whatsapp" data-action="zoom" data-rjs="/assets/posts/decrypt-and-extract-your-whatsapp-database/whatsapp-promo@2x.jpg" data-zooming-width="948" data-zooming-height="498" />
</a></p>
<p>Steps to get your whatsapp data in decrypted form-
<br /></p>
<ol>
<li>Download the <em>Crypt Key Extractor</em> from <a href="http://whatcrypt.com/" target="_blank" rel="noopener noreferrer">WhatCrypt</a> homepage or you can download it from their <a href="https://github.com/EliteAndroidApps/WhatsApp-Key-DB-Extractor/archive/master.zip" target="_blank" rel="noopener noreferrer">github repository</a> directly.
<br />
Prerequisites-
<ol>
<li>O/S: Windows Vista, Windows 7, Windows 8, Windows 10, Mac OS X or Linux</li>
<li>Java - If not installed: <a href="https://www.java.com/en/download/" target="_blank" rel="noopener noreferrer">https://www.java.com/en/download/</a></li>
<li>ADB (Android Debug Bridge) Drivers: <a href="/posts/install-adb-drivers-on-your-system" target="_blank"><em>Check out my post</em></a></li>
<li>Android device with Android 4.0 or higher.</li>
<li>USB Debugging must be enabled on the target device.
<br />
<code class="language-plaintext highlighter-rouge">Settings</code> -> <code class="language-plaintext highlighter-rouge">Developer Options</code> -> (Debugging) <code class="language-plaintext highlighter-rouge">USB debugging</code>
<br />
If you cannot find <code class="language-plaintext highlighter-rouge">Developer Options</code> then please go to:
<br />
<code class="language-plaintext highlighter-rouge">Settings</code> -> <code class="language-plaintext highlighter-rouge">About phone/device</code> and tap the Build number multiple times until you’re finally declared a developer.</li>
</ol>
</li>
<li>Extract <code class="language-plaintext highlighter-rouge">WhatsApp-Key-DB-Extractor-master.zip</code> maintaining the directory structure.</li>
<li>Click on <code class="language-plaintext highlighter-rouge">WhatsAppKeyDBExtract.bat</code> (Windows) or <code class="language-plaintext highlighter-rouge">WhatsAppKeyDBExtract.sh</code> (Mac OS X / Linux).
<br />Or go to the extracted folder via terminal and run the file as
<br />
<code class="language-plaintext highlighter-rouge">sh WhatsAppKeyDBExtract.sh</code>
<br />
Some things to keep in mind for this step-
<ul>
<li>This step uses the internet to download a legacy version of WhatsApp (2.11) to install on your phone. So make sure your PC is connected to the internet before running it.</li>
<li>Make sure there is no overlay active on your phone like <code class="language-plaintext highlighter-rouge">Twilight</code> or <code class="language-plaintext highlighter-rouge">Blue Light Filter</code>, as these will not allow you to click on <code class="language-plaintext highlighter-rouge">Back up my data</code>.</li>
</ul>
</li>
<li>Connect your device via USB, change the mode from <code class="language-plaintext highlighter-rouge">charging</code> to <code class="language-plaintext highlighter-rouge">media</code>, unlock your screen and wait for <code class="language-plaintext highlighter-rouge">Full backup</code> to appear.</li>
<li>Enter your backup password or leave blank (if none set) and tap on <code class="language-plaintext highlighter-rouge">Back up my data</code>. This step takes some time depending on the size of your data. So be patient.</li>
<li>Confirm backup password in your command console and then check your <code class="language-plaintext highlighter-rouge">extracted</code> folder. You will find many files there- <code class="language-plaintext highlighter-rouge">axolotl.db</code>, <code class="language-plaintext highlighter-rouge">chatsettings.db</code>, <code class="language-plaintext highlighter-rouge">msgstore.db</code>, <code class="language-plaintext highlighter-rouge">wa.db</code>, <code class="language-plaintext highlighter-rouge">whatsapp.cryptkey</code>.</li>
<li>All these <code class="language-plaintext highlighter-rouge">.db</code> files are <a href="https://www.sqlite.org" target="_blank" rel="noopener noreferrer"><strong>Sqlite</strong></a> databases in unencrypted form. Use a database viewer like <a href="http://sqlitebrowser.org/" target="_blank" rel="noopener noreferrer">DB Browser for SQLite</a> to see the data.</li>
</ol>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="http://whatcrypt.com/" target="_blank" rel="noopener noreferrer">WhatCrypt</a>
<br />
<a href="https://github.com/EliteAndroidApps/WhatsApp-Key-DB-Extractor" target="_blank" rel="noopener noreferrer">EliteAndroidApps/WhatsApp-Key-DB-Extractor - Github</a>
<br />
<a href="http://sqlitebrowser.org/" target="_blank" rel="noopener noreferrer">DB Browser for SQLite</a></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutInstall ADB drivers on your system2017-02-08T00:00:00+05:302018-05-19T11:04:23+05:30https://rahulja.in/posts/install-adb-drivers-on-your-system<p>You don’t need to install the entire android development environment to get the adb now. Google collectively refers to ADB, fastboot, and a few other utilities as the Platform Tools package and has provided them separately now. This post is assuming you don’t have android sdk or android studio installed.</p>
<h3 id="install-adb-on-macosx-using-homebrew">Install adb on MacOSX using <a href="http://brew.sh/" target="_blank" rel="noopener noreferrer">Homebrew</a></h3>
<p>This is the easiest way and will provide automatic updates.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="c"># Install homebrew</span>
ruby <span class="nt">-e</span> <span class="s2">"</span><span class="si">$(</span>curl <span class="nt">-fsSL</span> https://raw.githubusercontent.com/Homebrew/install/master/install<span class="si">)</span><span class="s2">"</span>
<span class="c"># Install adb</span>
brew <span class="nb">install </span>android-platform-tools
<span class="c"># run</span>
adb devices</code></pre></figure>
<p><br /></p>
<h3 id="install-adb-manually">Install adb manually</h3>
<ol>
<li>Download your OS-specific zip of platform tools from <a href="https://developer.android.com/studio/releases/platform-tools.html#download" target="_blank" rel="noopener noreferrer">here</a>.</li>
<li>Extract the contents of the .zip file to a folder you can find later.</li>
<li>Navigate to the extracted folder using your terminal, and there you will find the adb command.</li>
<li>Run the command normally once you’re into the extracted folder- <code class="language-plaintext highlighter-rouge">adb devices</code></li>
</ol>
<hr />
<p><br /></p>
<h5 id="references">References</h5>
<p><a href="http://stackoverflow.com/a/32314718" target="_blank" rel="noopener noreferrer">Installing ADB on MAC OS X - StackOverflow</a>
<br />
<a href="https://developer.android.com/studio/releases/platform-tools.html" target="_blank" rel="noopener noreferrer">SDK Platform Tools Download - Android Studio</a>
<br />
<a href="http://lifehacker.com/the-easiest-way-to-install-androids-adb-and-fastboot-to-1586992378" target="_blank" rel="noopener noreferrer">Install Android’s ADB and Fastboot Tools on Any OS - Lifehacker</a></p>Rahul Jainrahul_jain@live.inhttps://rahulja.in/aboutYou don’t need to install the entire android development environment to get the adb now. Google collectively refers to ADB, fastboot, and a few other utilities as the Platform Tools package and has provided them separately now. This post is assuming you don’t have android sdk or android studio installed.