Monthly Archives: August 2017
Bulk renaming PDFs to their Title names from PDF Metadata
Posted by Sayak Sarkar
Recently, i realized that I have amassed a huge number of e-books over the years and have ended up dumping them within an e-books directory on my laptop. The problem that I now faced was identifying one book from the other because a lot of them had random filenames based upon where I had downloaded them from.
So I now had a couple of requirements:
- An automated way of renaming all of these e-books to their actual titles.
- Removing all duplicate files.
After a little bit of looking around and experimenting around I finally got a Python based solution by Joseph Monaco to my problem. I then forked the orginal repo and added a couple of scripts to it to do my bidding. Now all that I need to do to auto organize all my e-books was this:-
- git clone https://github.com/sayak-sarkar/pdf-title-rename
- export PYTHONPATH=${PYTHONPATH}:$(pwd)/xmp.py
- python pdf-title-rename/pdf-title-rename.py <PATH to my ebooks directory>/*
- ./remove_duplicate.sh
And voila, all of my e-books were now auto renamed to their titles! đ
Come to think about it, I can work on repository a bit more to turn it into a full blown package, but then again, I’m feeling a bit lazy now that my goal’s served! Feel free to send me a Pull Request on GitHub if any of you want to automate it further! đ
Share this:
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to email a link to a friend (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to print (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Pinterest (Opens in new window)
Posted in Fedora, How-to Guides, Python, Technology, Uncategorized, Vim
Tags: auto, auto oganize pdf files, bash, coding, e-books, ebooks, fedora, fedora 18, Fedora 19, Fedora 20, git, github, hacks, Linux, metadata, open source, Operating system, organize, organize ebooks, pdf, pdf metadata, pdf-title-rename, programming, Python, read pdf metadata, remove duplicate pdfs, rename, rename pdf automatically, script, scripting, technology, tips and tricks, title, xmp
Working around untrusted certificate errors in Express JS
Posted by Sayak Sarkar
A few very common fatal errors thrown by the request module for express while trying to access data from self-signed web servers are Error: DEPTH_ZERO_SELF_SIGNED_CERT and UNABLE_TO_VERIFY_LEAF_SIGNATURE
This is because of https://github.com/nodejs/node-v0.x-archive/pull/4023 which mandates NodeJS to validate a server’s certificate by default, which needless to say is how things should be in a production environment.
However, more often than none we tend to use self-signed SSL certificates in our development environments or even within internal networks.
Thankfully for such brain-wracking moments, two particular flags come to our rescue. Enter strictSSL and rejectUnauthorized. The way I personally like to use these flags, is to set defaults within my development environments as follows to bypass SSL validation hence, saving the day! đ
var request = require('request').defaults({ Â Â strictSSL: false, Â Â rejectUnauthorized: false });
Please do note, that I do not recommend that you ever try this on your production systems without understanding the true implications of what disabling strictSSL and rejectUnauthorized means for you node server. By disabling these, you are essentially telling your server to skip validation of the requested server’s identity, which leaves your application in quite a vulnerable position.
Share this:
- Click to share on Facebook (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to email a link to a friend (Opens in new window)
- Click to share on LinkedIn (Opens in new window)
- Click to print (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Click to share on Pinterest (Opens in new window)
Posted in How-to Guides, JavaScript, Technology, Web Development
Tags: coding, dept zero self signed cert, express, expressjs, hacks, https, internet, JavaScript, node, nodejs, programming, rejectUnauthorized, request, request defaults, requestjs, script, scripting, security, skip cert validation, ssl, strictSSL, technology, tips and tricks, tls, unable to verify leaf signature, web, Web application, workaround