Within my previous employers, I was getting those payslips protected with a password. One day I thought what is going to happen if I would forget or lose the password! That's why I decided to write a small script in Python which might automate removing password from your payslip (or any other file).
# Requirements: # pip install PyPDF2 import os from PyPDF2 import PdfFileReader, PdfFileWriter password = 'password' directory = '/path/where/pdfs/are/stored' def decrypt_pdf(input_path, output_path, password): with open(input_path, 'rb') as input_file, \ open(output_path, 'wb') as output_file: reader = PdfFileReader(input_file) reader.decrypt(password) writer = PdfFileWriter() for i in range(reader.getNumPages()): writer.addPage(reader.getPage(i)) writer.write(output_file) if __name__ == '__main__': newDirectory = directory + "/Decoded" if not os.path.exists(newDirectory): os.makedirs(newDirectory) for filename in os.listdir(directory): if filename.endswith(".pdf"): fullFileName = os.path.join(directory, filename) decrypt_pdf(fullFileName, newDirectory + "/" + filename, password)
Reference :
[1] Pastebin
If you would like to load JSON and present it as a table, it's quite easy if you have an Excel 2016 [1]. It's more complicated, once you have a lower version.
First of all, try to install an additional plugin called Power Query [2].
In the Power Query ribbon tab, click From Other Sources > Blank Query, then go to Advanced Editor and input below query string. Do not forget to change the path to your JSON.
Click -> Close & Load let Source = Json.Document(File.Contents("Z:\Directory\input.json")), AsTable = Table.FromRecords(Source) in AsTable
Click on 'Close & Load'
Reference :
[1] Microsoft Support - Connect to a JSON file
[2] Power Query for Excel
If your JIRA does not support generating release notes because of for instance you do not fulfil Version field like in my case, there is a way to generate it based on git commit history.
First of all, you need to install a package called git-release-notes [2] via npm. It will allow you to generate release note page from git commit history using the following command :
git-release-notes 2.2.2..HEAD markdown.ejs > changelog.md
Of course, 2.2.2 is a git tag.
You might also use mentioned above template called markdown.ejs which has been written in EJS [3]. In my opinion, this template gives more control in terms how release notes will look like at the end. Of course, you might also depend on built-in template into git-release-notes module.
<% commits.forEach(function (commit) { %> <% if(!commit.title.startsWith('[maven-release-plugin]')) { %> <%= 'http://jira.com/browse/' + commit.title -%> <% } %> <% }) %>
References :
[1] Confluence.atlassian.com - Creating release notes
[2] NPM - git-release-notes
[3] Ejs.co
How to remove duplicates in Java 8 using field or property ? We might use reduce!
List<MyClass> distinctByField = myList.stream().reduce(new ArrayList<>(), (List<MyClass> accumulator, MyClass myClass) -> { if (accumulator.stream().noneMatch(item -> item.getField().equals(myClass.getField()))) { accumulator.add(MyClass); } return accumulator; }, (acc1, acc2) -> { acc1.addAll(acc2); return acc1; });