Monday, August 14, 2023

Mass Convert Tiff to PDF with Python

I needed to convert over 200K tiff files to pdf.  Hope this helps.


//Larry


Version with Comments

# Python3 program to bulk convert image file to pdf
# Mass convert tiff files to pdf
# Larry Billinghurst - 14 Aug 2023
# using img2pdf library

# Note: will overwrite target directory files

# importing necessary libraries
import img2pdf
from PIL import Image
import os
import datetime
import argparse
import time


# Set up the parser and add arguments
parser = argparse.ArgumentParser(description="Convert image files to PDF")
parser.add_argument("--source_dir", default="C:/support/exadocs",
                    help="Directory of the source images")
parser.add_argument("--output_dir", default="C:/support/exadocs-pdf",
                    help="Directory to save the converted PDFs")

# Parse the command line arguments
args = parser.parse_args()

# Start the timer
start_time = time.time()

# Initialize the file counter
file_counter = 0

# Use the arguments
source_dir = args.source_dir
output_dir = args.output_dir

print(f"Using source directory: {source_dir}")
print(f"Saving to output directory: {output_dir}")


# Create a timestamp
current_timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
# Path for the log file with timestamp
log_file_path = f"C:/support/exadocs-log_{current_timestamp}.txt"  

# File Extension to look for
file_extension_list = ('.tif','.jpeg')
# Get logfile ready to write if needed
def log_error(message):
    """Append error messages to a log file."""
    with open(log_file_path, 'a') as log_file:
        log_file.write(message + "\n")

# loop through all files in source directory
for target_file in os.listdir(source_dir):
    filename_full = os.path.basename(target_file)
    # Store the filename without extension using the [0]
    filename = os.path.splitext(filename_full)[0]
    # Build the pdf target filename with output directory
    pdf_target_file = output_dir + '/' + filename + '.pdf'
    # Set source filename with path
    source_file = source_dir + '/' + target_file
    print(source_file)
    print(pdf_target_file)
   
    # Check if we have a matching file extension
    if target_file.endswith(file_extension_list):
        try:
            # Open and verify the image
            with Image.open(source_file) as img:
                img.verify()

            file_counter += 1  # Increment the file counter
            # Convert the image to PDF
            # Open pdf target file as "wb" write binary
            with open(pdf_target_file,"wb") as out_file:
                out_file.write(img2pdf.convert(source_file))
        except Exception as e:
            print("Verification or conversion failed for "
                f"{source_file}. Error: {e}")

# Print the number of files processed
print(f"Number of files processed: {file_counter}")

# Calculate and print the elapsed time
end_time = time.time()
elapsed_time = end_time - start_time

hours, remainder = divmod(elapsed_time, 3600)
minutes, seconds = divmod(remainder, 60)

print(f"Script executed in: {int(hours)} hours, "
      f"{int(minutes)} minutes, {seconds:.2f} seconds")


# End of Code




Compact Version


# Python3 program to bulk convert image file to pdf
import argparse
import datetime
import os
import time

from PIL import Image
import img2pdf


def log_error(message):
    with open(log_file_path, 'a') as log_file:
        log_file.write(message + "\n")


parser = argparse.ArgumentParser(description="Convert image files to PDF")
parser.add_argument("--source_dir", default="C:/support/exadocs",
                    help="Directory of source images")
parser.add_argument("--output_dir", default="C:/support/exadocs-pdf",
                    help="Directory for PDFs")

args = parser.parse_args()

start_time = time.time()
file_counter = 0

log_file_path = f"C:/support/exadocs-log_{datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')}.txt"

for target_file in os.listdir(args.source_dir):
    if target_file.endswith(('.tif', '.jpeg')):
        source_file = os.path.join(args.source_dir, target_file)
        pdf_target_file = os.path.join(args.output_dir, os.path.splitext(target_file)[0] + '.pdf')
       
        try:
            with Image.open(source_file) as img:
                img.verify()
               
            with open(pdf_target_file, "wb") as out_file:
                out_file.write(img2pdf.convert(source_file))
               
            file_counter += 1
        except Exception as e:
            log_error(f"Failed for {source_file}. Error: {e}")

end_time = time.time()
hours, remainder = divmod(end_time - start_time, 3600)
minutes, seconds = divmod(remainder, 60)

print(f"Processed: {file_counter} files in {int(hours)}h {int(minutes)}m {seconds:.2f}s.")

Wednesday, June 14, 2023

Microsoft vs Google Business Email Matrix

Feature / Function Microsoft 365 Google Workspace
Plans & Pricing Microsoft 365 Business Basic – $5/user/month
Microsoft 365 Business Standard – $12.50/user/month
Microsoft 365 Business Premium – $20/user/month
Microsoft 365 Apps for Business – $8.25/user/month
Enterprise Plans
Microsoft 365 E3 – $32/user/month (annual commitment)
Microsoft 365 E5 – $57/user/month (annual commitment)
Microsoft 365 F3 – $8/user/month (annual commitment)
Business Starter – $6/user/month
Business Standard – $12/user/month
Business Plus – $18/user/month
Google Workspace Enterprise Plans – Custom pricing
Cloud Storage 1TB of OneDrive storage
50GB email storage
Business Starter – 30GB per user
Business Standard – 2TB per user
Business Plus – 5TB per user
Business Apps Word, Excel, PowerPoint, OneDrive, Teams, Outlook, Exchange, SharePoint Docs, Sheets, Slides, Keep, Sites, Google Drive, Calendar, Meet, Gmail, Chat
Collaboration & Communication Supports simultaneous multiuser editing
Supports online meetings and video calls for up to 300 people
Allows you to connect with your team from your desktop or on-the-go with Microsoft Teams
Allows you to access team chats, meetings, files and apps and collaborate from one place
Supports live multiuser editing
Google Meet supports up to 250 participants (depending on the plan) for video and voice conferencing
Advanced chat rooms, including threaded rooms and guest access
Security & Support Data encryption
Microsoft cloud security technology
Data loss prevention
Multi-factor authentication
Built-in spam, malware and unusual activity detection
99.9% financially backed uptime guarantee
Round-the-clock phone and online support
Data encryption
Google cloud security protection
Data loss prevention
Two-step verification
Built-in spam, phishing and unusual activity detection
99.9% application availability guarantee
Standard Support (paid upgrade to Enhanced Support)
Feature Microsoft 365 (Office 365) Google Workspace (G Suite)
Mailbox Size Limit Varies by subscription plan
(e.g., 50 GB, 100 GB, 2 TB)
Varies by subscription plan
(e.g., 30 GB, 2 TB)
Attachment Size Varies by subscription plan
(e.g., 25 MB, 150 MB)
Varies by subscription plan
(e.g., 25 MB, 100 MB)
Shared Mailboxes Supported, with customizable permissions and access controls Supported, with customizable permissions and access controls
Mailbox Delegation Supported, allowing users to delegate access to their mailbox Supported, allowing users to delegate access to their mailbox
Shared Contacts Supported, with shared contacts lists Supported, with shared contact groups
Distribution Lists Supported, for group email communication Supported, for group email communication
Email Archiving Supported, with retention policies and archiving options Email retention available, but no built-in archiving
Mobile Access Dedicated mobile apps available (e.g., Outlook) Dedicated mobile apps available (e.g., Gmail)
Calendar Integration Integration with Outlook calendar Integration with Google Calendar
Migration Tools Robust migration tools and services available Migration tools and services available
Compliance Features Robust security and compliance features Robust security and compliance features
eDiscovery Advanced eDiscovery capabilities Basic eDiscovery capabilities
Legal Hold Legal hold and data retention capabilities


Source: https://spanning.com/blog/microsoft-365-vs-google-workspace/

Monday, May 8, 2023

Hosting you website and Cloud Service Providers

Web Hosting Service Descriptions

Web Hosting Types of Services

Shared Hosting
Shared hosting is a type of web hosting where multiple websites share the same physical server and resources such as RAM, CPU, and storage. This is the most cost-effective hosting solution and is suitable for small websites, blogs, and businesses with low to moderate traffic levels.

WordPress Hosting
WordPress hosting is a type of web hosting specifically designed for WordPress websites. These hosting plans offer optimized performance, security, and support for WordPress sites. They often include automatic updates, backups, and caching solutions to ensure the best possible performance and uptime.

VPS Hosting
Virtual Private Server (VPS) hosting is a type of hosting where websites are hosted on a virtual server, which is created using virtualization technology. Each VPS acts as an independent server with its own dedicated resources such as RAM, CPU, and storage. VPS hosting offers more control, scalability, and performance compared to shared hosting, making it suitable for growing businesses and websites with higher traffic levels.

Dedicated Hosting
Dedicated hosting is a type of web hosting where a client leases an entire physical server exclusively for their website. This means that the website has full access to all the server's resources, providing the highest level of performance, security, and control. Dedicated hosting is suitable for large businesses and high-traffic websites with demanding performance requirements. 

Other Services
Some web hosting providers offer additional services such as:

  • Website Builders: Drag-and-drop tools that allow users to create a website without any coding knowledge.
  • WooCommerce Hosting: Hosting plans optimized for eCommerce websites using the WooCommerce plugin for WordPress.
  • Reseller Hosting: Hosting plans that allow users to sell hosting services to their own clients under their own brand name.
  • Cloud Hosting: A type of hosting that uses a network of virtual servers to provide scalable, flexible, and reliable hosting resources.
  • CDN & Security: Services that improve website performance and security, such as content delivery networks (CDNs) and SSL certificates.
  • Domain Registration: Services that allow users to register and manage domain names for their websites.

Cloud Service Provider

Cloud service providers (CSPs) are companies that offer a range of computing services over the internet. These services are broadly divided into three categories: Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS).

  • Infrastructure as a Service (IaaS): This is the most basic category of cloud services. With IaaS, you rent IT infrastructure—servers, virtual machines (VMs), storage, networks, and operating systems—from a cloud provider on a pay-as-you-go basis.
  • Platform as a Service (PaaS): PaaS is designed to support the complete web application lifecycle: building, testing, deploying, managing, and updating. This is a complete development and deployment environment in the cloud, with resources that enable you to deliver everything from simple cloud-based apps to sophisticated, cloud-enabled enterprise applications.
  • Software as a Service (SaaS): SaaS is a method for delivering software applications over the Internet, on demand and typically on a subscription basis. Cloud providers host and manage the software application and underlying infrastructure, and handle any maintenance, like software upgrades and security patching.
These providers enable companies to use computing resources as a utility, rather than having to maintain computing infrastructure in-house. This can lead to cost savings, increased scalability, improved productivity, and more.

Some of the major cloud service providers as 2021 include:

·       Amazon Web Services (AWS): Offers a broad set of global compute, storage, database, analytics, application, and deployment services that help organizations move faster, lower IT costs, and scale applications.

·       Microsoft Azure: A growing collection of integrated cloud services that developers and IT professionals use to build, deploy, and manage applications through Microsoft's global network of datacenters.

·       Google Cloud Platform: Provides a series of modular cloud services including computing, data storage, data analytics and machine learning, and networking.

·       IBM Cloud: Offers a wide range of cloud services including IaaS, PaaS, and SaaS through all delivery models including public, private, and hybrid cloud.

·       Oracle Cloud: Offers IaaS, PaaS, SaaS, and Data as a Service (DaaS) with a range of functionalities for analytics, management, integration, security, artificial intelligence (AI), and blockchain.

Remember that each cloud service provider has its unique strengths and weaknesses that might make them a better fit for certain use cases or organizational needs.

Web Hosting Matrix

Some of the hosting providers as of 2021 include:

ProviderShared HostingWordPress HostingVPS HostingDedicated HostingOther Services
Bluehost$2.95 - $13.95/mo$2.95 - $5.45/mo$18.99 - $59.99/mo$79.99 - $119.99/mo-
SiteGround$6.99 - $14.99/mo$6.99 - $14.99/mo--WooCommerce: $6.99 - $14.99/mo
Cloud: $80 - $240/mo
HostGator$2.75 - $5.95/mo$5.95 - $9.95/mo$19.95 - $39.95/mo$89.98 - $139.99/mo-
InMotion Hosting$2.49 - $12.99/mo$6.99 - $105.69/mo$17.99 - $69.34/mo$99.99 - $539.99/mo-
A2 Hosting$2.99 - $14.99/mo$2.99 - $14.99/mo$6.59 - $65.99/mo$99.59 - $248.99/mo-
GreenGeeks$2.49 - $11.95/mo$2.49 - $11.95/mo$39.95 - $109.95/mo-Reseller: $19.95 - $34.95/mo
DreamHost$2.59 - $4.95/mo$2.59 - $16.95/mo$10.00 - $80.00/mo$149.00 - $379.00/mo-
Hostinger$0.99 - $3.99/mo$1.99 - $11.59/mo$3.95 - $38.99/mo-Cloud: $9.99 - $69.99/mo
Cloudflare----CDN & Security: Varies
Domain Registration: Varies
WP Engine-$25 - $258/mo---
GoDaddy$5.99 - $19.99/mo$6.99 - $15.99/mo$4.99 - $69.99/mo$129.99 - $399.99/mo-
Liquid Web-$19 - $999/mo$15 - $95/mo$199 - $599/moManaged WooCommerce: $19 - $999/mo
Squarespace----Website Builder: $12 - $40/mo
Wix----Website Builder: Free - $39/mo
Namecheap$1.58 - $4.80/mo$3.88 - $11.88/mo$8.88 - $48.88/mo$56.88 - $172.88/mo-
FastComet$3.48 - $9.58/mo$3.48 - $9.58/mo$47.95 - $111.95/mo$139 - $349/mo-

Cloud Service Providers

ProviderCompute ServicesStorage ServicesDatabase ServicesOther ServicesPrice Range
Microsoft AzureVirtual Machines, App Services, FunctionsBlob Storage, File Storage, Disk StorageAzure SQL Database, Cosmos DB, MySQL, PostgreSQLCDN, Security, AI & Machine Learning, Networking, Analytics, IoTVaries (pay-as-you-go, free tier available)
Google CloudCompute Engine, App Engine, Cloud FunctionsCloud Storage, Persistent Disk, FilestoreCloud SQL, Cloud Spanner, Firestore, BigtableCDN, Security, AI & Machine Learning, Networking, Analytics, IoTVaries (pay-as-you-go, free tier available)
Amazon Web Services (AWS)EC2, Lambda, Elastic BeanstalkS3, EBS, EFSRDS, DynamoDB, Aurora, ElastiCacheCDN, Security, AI & Machine Learning, Networking, Analytics, IoTVaries (pay-as-you-go, free tier available)

Page crafted with ChatGPT MLL; 5/8/2023. by Larry Billinghurst

Friday, April 21, 2023

DIY Email Security Upgrade: A Step-by-Step Guide for Business Owners

Introduction 

As a business owner, ensuring the security of your client data is a top priority. In today's digital age, a secure and professional email system is essential for businesses of all sizes to maintain trust and build a strong reputation. If you're still using a free email service, it's time to consider a DIY upgrade to a more secure option. In this blog post, we'll walk you through the three simple steps to upgrade your email security, along with links to popular providers.

Step 1: Find and Register a Domain

The first step in upgrading your email security is finding and registering your preferred domain. A custom domain not only looks more professional, but it also lends credibility to your business. Several domain registrars are available, with competitive pricing and additional features. Here are some popular options:

  • Instant Domain Search (https://instantdomainsearch.com/)
  • GoDaddy (https://www.godaddy.com/)
  • Namecheap (https://www.namecheap.com/)
  • Google Domains (https://domains.google/)

Step 2: Choose a Business Email Provider

Next, choose a suitable business email provider. There are numerous providers available, offering various levels of security, features, and pricing options. Choose a provider that meets your specific needs and budget. Here are some popular business email providers:

Microsoft 365 (https://www.microsoft.com/en/microsoft-365/business/compare-all-microsoft-365-business-products)

  • Google Workspace (https://workspace.google.com/)
  • Zoho Mail (https://www.zoho.com/mail/)
  • Fastmail (https://www.fastmail.com/)
  • ProtonMail (https://protonmail.com/)

Step 3: Set Up and Configure Your Professional Email

    Once you've chosen a provider, set up and configure your new professional email. Most providers offer step-by-step instructions and support during the setup process. Ensure that you configure your email settings with a focus on security, such as enabling two-factor authentication (2FA) and creating strong, unique passwords.

Conclusion

By following these three simple DIY steps, you'll enhance your email security and contribute to the overall success of your business. Investing in a secure and professional email system is a small price to pay for the peace of mind and credibility it brings to your business. Start the process today and protect your valuable client data while maintaining trust with your customers.

If you need help with any of these steps reach out to your your tech provider or book a call with book.trifused.com

Friday, February 24, 2023

Merge-csv in powershell

 This is a powershell script to merge all csv files in a folder.  

This works where you have multiple files with the same structure into a single file.

 

#Get the header from one of the CSV Files, write it to outfile.tmp
Get-ChildItem *.csv|select -First 1|Get-Content|select -First 1|Out-File -FilePath .\outfile.tmp -Force
#Get the content of each file, excluding the first line and append it to outfile.tmp
Get-ChildItem *.csv|foreach {Get-Content $_|select -Skip 1|Out-File -FilePath .\outfile.tmp -Append}
#rename the file with timestamp to run muliple time
Rename-Item -Path .\outfile.tmp -NewName .\"Output-$(get-date -f yyyyMMddHHMMss).txt"

 # Used code from this blog - https://stackoverflow.com/questions/27892957/merging-multiple-csv-files-into-one-using-powershell/54130274#54130274


Sunday, January 22, 2023

Password Strength

 When 8 is not enough, it can be cracked in 39 or less with GPU farms.

See the Password strength calculator at GRC

grc.com/haystack.htm




Friday, January 6, 2023

Hi ChatGPT, What is the difference between a program, software and a application.

 ChatGPT:

A program is a set of instructions that a computer can execute to perform a specific task. The instructions are written in a programming language, such as C++ or Python.

Software is a collection of programs and related data that provide the instructions for telling a computer what to do and how to do it.

An application is a specific type of software that is designed to perform a specific function or set of functions for the user. Applications are often designed to be used by end users, rather than by other software or systems.

So, to summarize:

  • A program is a set of instructions that a computer can execute.
  • Software is a collection of programs and data that provide instructions for telling a computer what to do.
  • An application is a specific type of software that is designed to be used by end users to perform specific functions.