Skip to content

Instantly share code, notes, and snippets.

View lossurdo's full-sized avatar

Rafael Lossurdo lossurdo

View GitHub Profile
@lossurdo
lossurdo / merge_pdf_files.py
Created February 6, 2024 16:39
This Python script merges multiple PDF files into a single PDF file
"""
This script merges multiple PDF files into a single PDF file.
The script takes a folder path as input, which should contain the PDF files to be merged.
It uses the PyPDF2 library to perform the merging operation.
The algorithm works as follows:
1. Import the necessary modules: os for file operations and PdfMerger from PyPDF2 for merging PDFs.
2. Specify the folder path containing the PDF files.
3. Create a PdfMerger object.
@lossurdo
lossurdo / convert-utc-timezone.py
Last active February 20, 2020 18:53
Convert UTC to your time zone
#!/usr/bin/python3
# coding: utf-8
from datetime import datetime
# pip3 install pytz
import pytz
def convert(posix_timestamp, your_timezone='America/Sao_Paulo'):
utc_dt = datetime.utcfromtimestamp(posix_timestamp).replace(tzinfo=pytz.utc)
tz = pytz.timezone(your_timezone)
@lossurdo
lossurdo / dict.sh
Created January 22, 2020 14:15
Online dictionary shell script
#!/bin/sh
# Documentation:
# https://tools.ietf.org/html/rfc2229
if [ -z "$1" ]
then
echo "No word supplied! \nCommand: 'dict.sh <word>' eg. 'dict.sh linux'"
exit 1
fi