Activating Google Chrome’s Password Import Export Feature

by Nishant Arora on 8/08/2016

There are numerous threads you can find all over the internet telling you how to migrate passwords from Google Chrome browser to firefox or simply exporting them to CSV and reusing them elsewhere. For me I recently switched my Google Accounts and it has been nothing but painful to move the cloud synced settings in chrome.

Fortunately I found this snippet which helped me create a CSV out of the currently stored passwords. But what if there existed a simpler option. Follow these simple steps to activate this inbuilt password import/export feature on chrome. (Disclaimer, the feature is in Beta stages and might make you loose all your passwords. Take necessary precautions)

  1. Open a new tab and type/paste in address bar: chrome://flags/#password-import-export
  2. Change the option to “enabled” from “default”.chrome-password-import-export
  3. Relaunch the browser as needed.
  4. Go to chrome://settings/passwords
  5. Export the current list, to download the current passwords, and keep this in safe place.
  6. To add more passwords just create a new CSV with same format (i.e “Name”, “URL”, “Username”, “Password”) just import.

It can take a while for the imported passwords to show up (CSV parsing for some reason takes time) Once that is done the passwords will show up.

As the time of writing, I am on Chrome Version 52.0.2743.116 (64-bit). This feature is slow, and in beta. Do not blame me if you lose your passwords. Save the current password list at all costs.

Pro Tip: keep the chrome running for a couple of hours, and will sync this with the cloud and these passwords will then be available everywhere. Restart to see if your account lost sync. Restart and re-login if needed. It took me a couple of tries to get this right.

Cheers!

Happy Hacking

No Comments

Adding Front-End To Your Raspberry Pi Server

by Nishant Arora on 24/04/2016

I know I was suppose to tell you guys how to install scanner support to your raspberry pi print server. But before that we would like to add a front-end. Simple monitoring of the status, nothing fancy.

A quick search revealed that some users have written a script: https://gist.github.com/jvhaarst/4388108/ I installed it and was setup in a couple of minutes. But you know what, this looks so 90s. :-/ I hate the design. It sucks!

So I ended up writing my own front-end for the server. Check out the screenshots:

 

 

Isn’t it cool? checkout how this looked before:

Looked shit IMHO. So what I added:

  • Completely rewritten with performance in mind.
  • Less processing on server side (we’re running this on Pi) more processing to the user.
  • Complete Material Design Compliance.
  • Google Charts *_*
  • No dependency.
  • Responsive Design

Download and Install instructions: https://github.com/whizzzkid/RPi-System-Info-Script

Cheers!

Happy Hacking :)

No Comments

Minimal Raspberry Pi Google Cloud Print Server

by Nishant Arora on 16/04/2016

OMG, it’s been a year since I posted my last post. TBH, I have had a couple of drafts in 2015, but did not get time to complete anyone of them to be published.

So I was cleaning up my electronic junk, and believe me I order a lot of stuff online and then lose track of it. Back in 2014 I ordered a Raspberry Pi, model B and it just came out of a box lying under some other boxes. It’s a wasted Rs. 2400.IMG_20160416_202912

I had initially planned it to be my media server, but then I bought a chromecast and DLNA compatible NAS server. So this was pretty much out of the equation. Moreover RPi are slow for File/Media servers. So let’s leave that for the solutions already available. I have an old deskjet 1050 AIO printer which is almost breathing it’s last breath. It’s really broken, with the outer body cracked and the I/O tray missing, but the thing still prints. So, if I were to buy a new printer then buying a Google Cloud Enabled printer would be a no brainer. But, it struck me, can I make this box online without much effort?
IMG_20160416_203033

The following setup took me less than an hour to complete and everything seems to be up and running smooth.

  1. Download Distro: I lost track of the RPi world long ago, a quick search revealed that a distribution called minibian is available and the developer is quite active with this. Please consider donating him. Head over here to download the latest image. At the time of writing it is March 12th update.
  2. Writing Image: Just unzip the tar-gunzip package to get to the .img file and follow this guide here. Use this guide In case you’re running linux, use this guide.
  3. SSH: My windows laptop ran out of battery so I continued the setup from here on my chromebook. I plugged the sdcard into the RPi, hooked it to a LAN cable from my wifi router, powered it on using a 5v 2amp charger. I had no idea about the lan address so a quick check into my wifi router’s DHCP tables revealed that 192.168.0.51 had been assigned to my RPi, so a simple ssh into ‘[email protected]’ with password ‘raspberry’ landed me the terminal with su access.
  4. Resizing the SD Card and setting up locales. Since, this is a minimal install, there is no GUI to do this, you might find steps to do this from terminal, but here is the easier way:
  5. Configure RPi: run raspi-config  and you get the RPi GUI for expanding the SD card and setting internationalization options. Do that and reboot.
  6. Installing Nano: you can install an editor for quick editing files over ssh, nano works nice. apt-get install nano
  7. Cups Web Printing: Cups stands for common unix printing system. This should support all printers from all manufacturers. Check with your manufacturer if the provide linux drivers, like HP does in a package called hplip. Follow this excellant guide. You can leave the scanner part for now, just follow all steps under the heading ‘Printing’.
  8. GCP Cups Connector: The folks at Google Cloud Print team has this great step by step guide to set the cups connector up and running in no time, however the code has bugs and it won’t run directly. I filed this as an issue with the team.
  9. Creating a Google Group: head over to Google Groups to create a new group with your famil/friends with whom you would like to share the printer with, once done, get the groups email id. That would look something like [email protected]
  10. Correcting the GCP config: while running the init script, you can respond with any gmail id. When all the steps are complete, before moving this to /etc/gcp_cups_connector  dir. run: nano ~/gcp-cups-connector.config.json  change scope to the google group email id and continue with the guide from step 8.
  11. Setting up the service to start at boot: This guide has 3 methods to do this, we need the first one. Since you are already logged in as ‘root’, you do not need to use sudo, you can run them without sudo. Also ideally the command systemctl enable gcp  should make this start every time the system starts, but this won’t work as the network would be down at the start. So we need to make it retry till it finds the network. You can do nano /etc/systemd/system/gcp.service  and make the file look like following (notice the restart and restart sec statements):
  12. Reboot and wait: since you’re logged in as root, type reboot  on the terminal and wait. Ideally, the printer would be listed here https://www.google.com/cloudprint/#printers now you can enjoy printing from your chromebook, phone or any machine connected to the internet.

Hope it was smooth, took me less than 45 mins to get this up and running. Finally this shows up:

YDUtzO43y86

Messy Setup:

IMG_20160416_203008

And on phone:

Screenshot_20160416-205331Next up, I found a resistive touch screen for arduino in my stack, can I use this with raspberry pi to show the printer status on the screen?

Happy Hacking :)

Cheeers.

No Comments

PrestaShop: Enable Cloudflare Flexible SSL

by Nishant Arora on 23/12/2014

I guess everyone knows about the Cloudflare’s flexible SSL, which is free and can be enabled for all sites served using CF’s CDN network. Like this blog itself is being served over the CF network and has the Flexible SSL enabled. However just enabling the SSL/page rule thingy will not solve all your problems. Like my blog which uses wordpress didn’t work properly in the first go. I had to redo some portions of the theme (mostly regex edits) to support the new secure urls. Currently it uses a tweaked mod_rewrite + page rules to force SSL everywhere.

WordPress was easy, but currently I am working with PrestaShop for someone and enabling flexible SSL seems painful. I could maybe workout a patch and ask the team if they feel like pulling it to their core repository. I am not sure if this can be done using a prestashop module. However, I can give you a quick fix for the problem.

The problem is, PrestaShop’s design, it doesn’t supports flexible/shared/server SSL certificates by default. It wants your system to have a dedicated SSL installed. Here is the problematic class: https://github.com/PrestaShop/PrestaShop/blob/1.6/classes/Tools.php#L269

To solve this:

STEP 1: Complete the cloudflare setup for you prestashop website.

STEP 2: Enable cloudflare Flexible SSL as mentioned here https://support.cloudflare.com/hc/en-us/articles/200170416-What-do-the-SSL-options-Off-Flexible-SSL-Full-SSL-Full-SSL-Strict-mean-

STEP 3: Do not indulge in CloudFlare page rules, it’s good to go. Add a pagerule for your website, something like “*.yourwebsite.com/*” with https always enabled, It will help!

STEP 4: Login to phpMyAdmin for your server. Locate table ‘ps_configuration’, find rows with names “PS_SSL_ENABLED” and “PS_SSL_ENABLED_EVERYWHERE” edit their values to be 1, earlier it was 0.

STEP 5: Use your favourite FTP client to get to your site root, and use your favourite editor to edit the following files.

Edit: public_html/config/settings.inc.php and edit the following line towards the end:

Edit: public_html/classes/Tools.php and change the following function:

That should be it, your site should be fully functioning with free SSL enabled, thanks to cloudflare!

Cheers!

No Comments

Flipkart Affiliate Override Commissions – Easiest Way To Make Money Using Flipkart’s Affiliate Program

by Nishant Arora on 3/11/2014

Hi

I do not know, how many of you use Flipkart’s Affiliate account to earn commissions on the purchases done by your friends and family. But I am a avid user and ask all my friends and family to make purchases using my affiliate link. This entitles me for a commission on every purchase they make. However, recently it has been a lot of pain to share my affiliate link with everyone on my network.

To make the job easier for everyone. I wrote a chrome extension that automatically tracks purchases by my fnf so that I can earn commission on every purchase. I finally decided it can be used by everyone. So here it goes

Step 1: Create a flipkart affiliate account at http://www.flipkart.com/affiliate

Step 2: Get your affiliate id, Usually referred to as “affid”, e.g.: ‘dost123’

Step 3: Ask your friends to install the extension from https://chrome.google.com/webstore/detail/edbeaajlfjdmepmcbjplfdedoegbkkbj

Step 4: Let them configure your affiliate id (i.e. ‘dost123’) in their control panel.

Step 5: Enjoy!…. Now all purchases made by them on flipkart will entitle you for a commission on them.

Cheers!

Happy Hacking!

No Comments

Blocking MTNL’s annoying ad popups the smart way

by Nishant Arora on 6/10/2014

Believe me MTNL is a great ISP. If you know where to ring the bell if something goes wrong, it’s great. But 2014 onwards they added a great new feature in sync with adphonso. Adphonse is a media company and helps online companies with their online advertising technology. MTNL and adphonso teamed up and started injecting popup ads directly to the page a user requests.

These ads are not popups exactly. They are kinda modal boxes which are injected into the html response generated by the server. This is quite creepy have a look:

 Well, the problem is still greater than this, they have a bad code which is being injected. Bad code seems to break the entire javascript on page. Which means if this ad is loaded when I am browsing facebook, nothing would work because the injected script broke facebook’s javascript. The only solution is to refresh the page whenever this ad is encountered.

Trying to block this idiotic attempt by MTNL I browsed through a couple of ways, some of them being “modifying the host files”, “setting up the url block feature” in the router, creating registry keys (I use linux, so no registry keys of course). But this does not seem to resolve the issue when I carry my laptop to my friends place who also uses MTNL. I need a one click solution to end this.

Solution: I wrote a chrome extension to block the ad servers for me. Feel free to install the extension for yourselves https://chrome.google.com/webstore/detail/peiimmbcekpjhahehicdkomjnclgfgkg and as always feel free to fork my code http://code.nishantarora.in/mtnl-block-popups

Cheers!
Happy Hacking

No Comments

Python Golfing: HackerEarth Edition

by Nishant Arora on 19/07/2014

I was going through my hackerearth profile and in the recomended problem section I came accross this problem named Minimal Combinatorial. The problem in itself is very simple, you just need to calculate nCr (BTW, nCr = n!/(r!*(n-r)!), combinatorics 101), but the catch is, you need to write a code (in your favourite language, of course!) which takes the minimum number of characters. The score of a code is calculated as:

score = (1000 – characters) * 10

Simply put, the source code with character count == 0, has score 100, which is impossible. The highest score I could locate was 92.6 (Ruby), which means the entire code was written in 74 characters (pretty impressive I say). But I do not speak ruby, let’s try with Python.

Initial Code (Just for understanding)[216 chars]:

Initial Iteration (original submission)[152 chars]:

Just using the standard libraries instead of custom function and getting rid of long names and spaces.

2nd Iteration [152 chars]:

No character improvements, but using lambda function

3rd Iteration [150 chars]:

re-writing the 1st iteration

4th Iteration [148 chars]:

tweaking the for loop

5th Iteration [138 chars]:

getting rid of empty lines for good.

6th Iteration [113 chars]:

merging the function in the loop.

7th Iteration [109 chars]:

the raw_input for i is not actually needed, just input() can be used, as there would be just one integer to be read.

8th Iteration [107 chars]:

the math module was just too messy. Using lambda function instead. however, it won’t deal when number=0. But we do not need that anyways.

9th Iteration [106 chars]:

minor iterations with the writing style, (check the ‘or’), still the for loop takes a lot of space. :(

10th Iteration [101 chars]:

I can of course assign raw_input to a variable and use it instead. Also, the entire statement can be put inside the exec() and multiplied by the cases, a neat implementation of for loop.

 

So, Finally, my score: 89.90

The best I could achieve is 101 characters with python. But the other guy has it 74 characters in ruby. Maybe ruby is more concise, but this is the most Pythonic solution I could achieve. Please drop in your comments and help me make it even more concise. (If Possible.. :P)

 

Cheers!

Happy Hacking

No Comments