Bulk Shorten URLs with your Bitly API (v4) and Google App Script using google sheets (working in 2022)

This is a working code for Bitly using v4 API to shorten a long URL. You can also create a copy of this sheet and bulk create bitly links using the function bitlyShortenUrl in the 3rd column- https://docs.google.com/spreadsheets/d/1TS-aQcDu3rRv-LexEoIqDiX0ydv69ijkXQP-nuQdBz4/edit#gid=0

function bitlyShortenUrl(longLink, accessToken) {
  var form = { 
    "domain": "bit.ly",
    "long_url": longLink
  };
  var url = "https://api-ssl.bitly.com/v4/shorten";

  var options = {
      "headers": { Authorization: `Bearer ${accessToken}` },
      "method": "POST",
      "contentType" : "application/json",
      "payload": JSON.stringify(form)
  };
  var response = UrlFetchApp.fetch(url, options);
  var responseParsed = JSON.parse(response.getContentText());
  return(responseParsed["link"]);
}

PS: Bitly access token details given here https://support.bitly.com/hc/en-us/articles/230647907-How-do-I-generate-an-OAuth-access-token-for-the-Bitly-API-

Wireless File transfer from Oneplus to Mac

On your OnePlus phone:

  1. Enable hotspot on you android phone.
  2. Download and Install CX File Explorer from https://play.google.com/store/apps/details?id=com.cxinventor.file.explorer
  3. Click on “NETWORK” tab and then “Access from network”
  4. Click “Start Service”

On your Macbook:

  1. Connect Mac to your Phone’s hotspot.
Goto Finder. Click “Go” > “Connect to Server”
  • Now enter the username as “pc” and the password as shown in your phone.
  • Now your Mac should get connected to android. You should be able to enjoy file transfer wirelessly on your oneplus using hotspot connection. From your android phone to Mac or vice versa.

MAC OS – Digitally sign pdf e-mudhra | epass 2003 auto

On your Mac


  • Unzip, open and install “ePass2003-India-20210303.pkg”. You will have to allow this program in System Preferences > Security & Privacy
  • Now open “EnterSafeUserMgr” via applications. You should see Token is inserted and ready to use.
  • Now “Export” the “.cer” file to a location on your mac.
  • Download “Adobe Acrobat Reader DC” for mac (not Pro DC).
  • Open the pdf file to be digitally signed in Acrobat Reader and click on the placeholder for the digital signature.
Click on “Use a Signature Creation Device”
Click on Manage Digital ID
In PKCS#11 Modules and Tokens, click on Attach Module and choose library path as “/usr/local/lib/libcastle_v2.1.0.0.dylib”. The value may be different for you, please check. This library got installed when you installed the emudhra software.
Click on refresh a few times, if it asks for “login”, enter the password for your DSC device. Thereafter, you should see your attachable signature. In my case the signature has expired, which I will be renewing.

New found interest – Graffiti

This Sunday morning, I was feeling a little wobbly. I easily get bored when I run out of fun activities. So today, I literally had whole day to myself without any concrete plans. I wondered how to make it exciting. Just then, a random idea stuck. Lets try doing some graffiti!

My handwriting sucks. I have literally zero drawing and painting skills. The last encounter that I remember with any sort of artsy drawing was in standard 5th, where I scored a respectable 6/10 for drawing a Mango tree, next to a flowing river. I colored the river purple. Yeah I was a rebel since beginning 😀

Back to present. I live in a rented apartment, so naturally I did not have the liberty to go all guns and smudge the interior walls with spray paints. However, what I could do was to use my makeshift whiteboard, which I otherwise use to write code and brainstorm, as a graffiti wall.

Now all that was left was to find an appropriate piece of art that is witty, uplifting and easy for a first timer. I found an interesting sketch of three kids with cute looks, ruffled hair and some mischief brewing in their mind. Just apt!

I used a blue marker to get started. It was a bit difficult in the beginning. I had to edit and erase the initial few curves. But soon I got the hang of it. I stated enjoying it! In less than ten mins I was done sketching the three kids. Here it is below [the left side].

Be Yourself Graffiti

 

Since I completed the graffiti fairly quickly, I felt a little undeserving. To compensate for it, I found another interesting image from Calvin and Hobbes, where Calvin is having a gala time listening to his boom box. I inserted it into my debutant graffiti art as well.

After finishing, I admired it for a few minutes and indulged myself into some unabashed self appraisal 😀 . I throughly enjoyed the whole experience of trying out a new skill. I promised myself to try a new graffiti every week.

“Skill#28 – A veteran Graffiti artist” soon-to-inserted-in-my-resume.

Calvin and Hobbes best brainy quips

Calvin is a sweet little smartass. He hasn’t aged in decades and neither did his wisdom. His simple conversations with his pet tiger appear cute and simple. Yet, profound at the same time which makes this cartoon strip timeless. Here I have collected and posted some of the best quips taken from Calvin’s innocent mind:

Hobbes: Do you have an idea for your project yet?
Calvin:  No I’m waiting for inspiration. You can’t just turn on creativity like a faucet. You have to be in right mood.
Hobbes: What mood is that?
Calvin:  Last minute Panic.


Calvin:  Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that no-one of it has tried to contact us.


Calvin:  Reality continues to ruin my life. [Throw up his hands in the air, dejected ;)]


[Calvin walking on Snow, with contemplative expressions]
Calvin:  The problem with future is that it keeps turning into present.


Calvin:  Life’s disappointments are harder to take when you dont know any swear words.


Calvin: It’s hard to be religious when certain people are never
incinerated by bolts of lightning.


Calvin: In my opinion, we don’t devote nearly enough scientific research to finding a cure for jerks. [:D]


Calvin: (During a test.) As you can see, I have memorized this utterly useless piece of information long enough to pass a test question. I now intend to forget it forever. You’ve taught me nothing except how to cynically manipulate the system. Congratulations.


Calvin (writing, after being asked to explain Newton’s First Law of Motion “in his own words”): Yakka foob mog. Grug pubbawup zink wattoom gazork. Chumble spuzz. (speaking) I love loopholes.


Calvin’s dad: Being a parent is wanting to hug and strangle your kid at the same time.


Calvin: If people sat outside and looked at stars each night, I’ll bet they’d live a lot differently.


Calvin: Do you know where babies come from?
Hobbes: Nope
Calvin: Well, I wonder how one finds out!
Hobbes: Here, let me see the back of your shirt.
[untucks Calvin’s shirt]
Hobbes: You came from Taiwan.

Badass shayari

 

 

मौला ने लिखकर मेरे मुक्कदर में गरीबी

फ़रमाया

मिज़ाज़ इसका अमीरना बना दो

 

English Translation:

Lord, after sealing my destiny in poverty,

mused,

let his attitude be rich.

poetry

Getting driving licence in Bangalore Without broker

I will summarise the entire process of getting a driving licence in Bangalore. Without Broker / agent or any driving school. Before starting, here is the checklist:

  1. No matter wherever you are in Bangalore, choose KR Puram RTO (https://goo.gl/maps/fKCEV) for getting your driving licence. Personnel there are a thousand times more civilised and honest than others. I visited Koramangala RTO first, which is ruined by agents and corrupt officials.
  2. You’ll first need to apply for learning driving licence. After one month, you can apply for permanent driving licence.
  3. You would need an age proof and address proof, along with corresponding originals documents.
  4. Common age proofs– 10th class marksheet or PAN card.
  5. Address Proof is complicated. If you are an outsider, staying in a rented apartment, then you would compulsorily need 2 address proofs, both for your local address as well as your permanent address.
  6. Local address proof– A rental agreement carrying your name as “tenant” and your landlord’s name as “owner”, along with electricity bill in your owner’s name will suffice. Visit Kormangala’s BDA complex (https://goo.gl/maps/aeunM) to get your rental agreement for about Rs 170/-
  7. Permanent Address proof– Your Voter card or Passport mentioning your permanent address would suffice. If you are a localite, i.e, your permanent address is same as local address, then only permanent address alone will suffice. Check this page for comprehensive list on address and age proofs – https://sarathi.nic.in:8443/nrportal/sarathi/redirect.jsp?id=howtoll
  8. You would need a few passport sized photographs.

Preparations (Location- Your home)

  1. You’ll first need to fill an online form for licence. It’s a PDF form, that generates an application number. It only works in Windows with IE and Adobe reader. Mac wont work, Ubuntu wont work, http://browserstack.com wont work. I used a VM created in Parallels (on Mac) to create the following cheapest possible environment (in terms of memory and labour required) that works –
  2. 1) Windows XP service Pack 3,
  3. 2) Internet Explorer 7.0.5730.13
  4. 3) Adobe Reader 9.4.0 (Old Version of Adobe Reader 9.4.0 Download – OldApps.com – 26.35 Mbs).
  5. Open IE and visit http://www.rto.kar.nic.in . Click on “License e-Services”. Hopefully you’ll be taken to https://sarathi.nic.in:8443/nrportal/sarathi/HomePage.jsp (if they don’t change the port number, etc). Accept any security confirmation if prompted.
  6. Click on “Issue of a Learning Licence to me” which should take to https://sarathi.nic.in:8443/UF/pdfforms/NewLicence.pdf . Enable Adobe’s browser plugin to render this PDF on IE. You should get a form like:
  7. If you have to apply for both 2 wheeler and Car, check (2) “MOTOR CYCLE WITH GEAR (NON TRANSPORT)-(MCWG )” and (4) “LMV-NT-CAR-(LMV   )”
  8. After filling the complete form, click on “Submit”. You should see this message:
  9. Note down the application number. Now go back to homepage and click “Print Application Form” https://sarathi.nic.in:8443/nrportal/sarathi/form2.jsp. Fill details, save and print the form. Stick your photo.
  10. Buy a brown paper folder with ribbon (compulsory). Collate the application form as printed in step 9, Age Proof, Permanent address proof and Local address proof (if applicable). Tie all papers with the ribbon, and write your name, application number and date of birth on top of the folder.
  11. Exam preparations. You’ll be asked 5-10 random questions on traffic signs (maybe oral or written). Prepare these 3 sections:
  12. Mandatory Signs – http://www.rto.kar.nic.in/signs/MANDATORY/mandatory.html
  13. Cautionary Signs – http://www.rto.kar.nic.in/signs/CAUTIONARY/cautionary.html
  14. Informatory Signs – http://www.rto.kar.nic.in/signs/INFORMATORY/informatory.html
  15. Do prepare them well. You will be rejected if you dont pass the oral exam. (I was rejected, then I had to re-appear the next day.)
  16. We are now set to visit KR Puram RTO.

In-Person Visit (Location- KR Puram RTO, Time 9:30am)

  1. Try to visit RTO before 10am. You’ll finish the entire procedure in less than 20 mins.
  2. Visit the Challan counter (counter “3”, if they didn’t change it), submit your brown folder, with application number. You need to pay Rs 30 for each vehicle type. For Car + Bike pay only 60/- (Carry change. They refused to accept my 100 rupee note.) Tie the challan on top of other pages.
  3. Visit 1st floor. The signing officer will tally your originals with Xeroxes and approve the documents if found in order.
  4. Visit room number 2, for the Oral/written exam. The RTO inspector will ask you to explain 5-10 random signs. If you pass the exam, he’ll approve your file and keep it with himself. You then need to visit after 3 business days and collect your licence.
  5. If you fail the exam, dont panic. Your folder will be returned back to you and you’ll need to re-appear for exam, the very next day. Before appearing for exam, you’ll need to re-visit the signing officer (step 3). He’ll stamp your file with new date. Then you can proceed for your exam.

 

  • Total cost- Rs 60/-
  • Total RTO Visits required- 2
  • Time Invested- 4-5 hours (including form filling and visits)

I have not completed 1 month yet, so haven’t appeared for Permanent licence. Will update the answer once I do so.

Bring Backgroud processes to foreground in terminal

If you are using Terminal and have sent some processes to background using Control+Z, use the following commands to bring them back to foreground.

Type ps -a to view all background processes with pid. Or type only jobs, to view them in order.

Type fg to bring the last process back to foreground.

If you have more than one process running in the background, do this:

$ jobs
[1] Stopped python
[2]- Stopped python
[3]+ Stopped python

Type fg %3 to send the python process back to foreground.

To suspend the process running in the background, use:

kill -19 %job_id.
the -19 signal is SIGSTOP (the signal sent by Control - Z) .

example: kill -19 %3.

To kill a python process either type exit() in python shell, or type Control+D