Posts

Showing posts with the label Tricks

Adding Months to Current Date? Use relativedelta()

Image
After minutes of surfing in the ocean of Stackoverflow, find this trick to add months to the current date (dealing with date is painful already in any language, at least to me personally). Use relativedelta() from dateutil library. and the result shows: Check out the date after adding two months. Voila! Just like that. Credit: https://stackoverflow.com/questions/4130922/how-to-increment-datetime-by-custom-months-in-python-without-using-library

How to Download a Read-only PDF shared on Google Drive

1. For Windows, click CTRL+SHIFT+J 2. Select Console and copy-paste the following code let jspdf = document.createElement( "script" );   jspdf.onload = function () {        let pdf = new jsPDF();      let elements = document.getElementsByTagName( "img" );      for ( let i in elements) {          let img = elements[i];          console.log( "add img " , img);          if (!/^blob:/.test(img.src)) {              console.log( "invalid src" );              continue ;          }          let can = document.createElement( 'canvas' );          let con = can.ge...