Posts

Practical Web Scraping with Python: A Clean, Safe Pattern for Pulling Company Names & Emails

Image
Practical Web Scraping with Python: A Clean, Safe Pattern for Pulling Company Names & Emails Turn that quick-and-dirty script into a reliable tool you won’t be afraid to run twice. Meta description suggestion: Learn a production-friendly pattern for scraping company names and emails with Python, Requests, and BeautifulSoup—featuring retries, timeouts, robots.txt checks, pagination, and CSV export. On this page The problem The cleaned, safe solution Copy-paste code How it works How to run it Practical use cases Pitfalls & guardrails Variations & alternatives What to try next The problem You’ve got a page of companies and you want the name and email for each one. The “first pass” script might work on your machine, but it’s brittle: no retries, no timeouts, no robots.txt check, and it assumes every email is a mailto: link. The cleaned, safe ...

Python CSV cleaner

Build a simple CSV cleaner web app with Streamlit + Pandas Meta description suggestion: Turn a small Pandas cleaning script into a Streamlit web app: upload any CSV, remove empty rows and duplicates, preview the result, and download a cleaned file in seconds. Why I built this CSV files are everywhere. They’re also a little chaotic on a good day. You’ll open one and find blank rows, repeated records, odd spacing, or columns that look fine until your import tool refuses them. I wanted a tiny “do the obvious cleanup” button that works for any CSV: upload → clean → preview → download. No hunting for the right Excel filter, no redoing the same steps every week. What this app does The app gives you a few practical cleaning options that cover the most common CSV headaches: Remove empty rows (rows where every value is blank) Remove duplicate rows (or duplicates based on...

A Quick Python Script to Extract Emails From a Web Page

A Quick Python Script to Extract Emails From a Web Page Sometimes you land on a website and think: I know there’s a contact email here somewhere… but it’s buried in a footer, hidden on an “About” page, or lost in a long block of text. If you do research, vendor reviews, outreach, or you’re just trying to save time, copying and pasting around a page gets old fast. This short Python script automates that step. You give it a URL, it downloads the page, pulls out the readable text, then returns any email addresses it finds. What the script does At a high level, it does four things: Fetches the page using requests Parses the HTML and extracts visible body text using selectolax Searches for email patterns with a regular expression (regex) Removes duplicates so you get a clean list of unique results The output is a simple list like: ['info@company.com', 'support@company.com'] Why this is useful This is a small script, but it solves a...

List Saved Wi-Fi Profiles on Windows Using Python

List Saved Wi-Fi Profiles on Windows Using Python (Safe Audit Script) If you use a Windows laptop for work and personal networks, it collects a list of saved Wi-Fi profiles over time. Sometimes you just want to audit what’s stored on your machine (for cleanup, troubleshooting, or basic hygiene). This mini Python script does exactly that: it lists saved Wi-Fi profile names (SSIDs) without exposing passwords. Why this is useful Cleanup: spot old networks you don’t use anymore. Troubleshooting: confirm whether a Wi-Fi profile is saved before re-adding it. Security hygiene: review saved networks on shared or travel devices. Important note You’ll find scripts online that dump saved Wi-Fi passwords. That’s risky and easy to abuse. This version is intentionally safer: it only lists profile names. If you forgot a Wi-Fi password, the best option is to check the router label/admin page or ask the network owner/admin. Script import subprocess from dataclasses import data...

Pydantic: your bouncer for messy data (with real examples)

Pydantic: your bouncer for messy data (with real examples) If you’ve ever had a pipeline blow up because "quantity" showed up as "two" , you already get why validation matters. Meta description suggestion: Learn how to use Pydantic (v2) to validate API inputs, clean data-pipeline rows, load typed settings from environment variables, and produce clear error messages—with practical Python examples. Quick jumps Why validation saves your sanity The problem Pydantic solves Install Examples you can copy/paste Benefits Use cases Wrap-up Why validation saves your sanity Pydantic is a guardrail for input data. You describe the shape using Python type hints, and Pydantic checks it at runtime. When something’s off, you get a clean ValidationError that tells you exactly what faile...

Compress a Folder of Images with Python

Compress a Whole Folder of Images with Python (Resize + Subfolders + Smart PNG→JPEG) If you keep images for a blog, documentation, or a project folder, file size becomes a problem fast. Big images slow down pages, take space, and make sharing annoying. This script automates the cleanup: it walks through a folder (and subfolders), optionally resizes images to a max width, compresses JPEGs, compresses PNGs, and can convert PNG to JPEG when it actually makes sense. When this is useful Before publishing: shrink images for faster blog load times. Docs + screenshots: reduce size without manually exporting every file. Photo folders: compress camera images and keep a clean “compressed” copy. Automation: run it after exporting images from tools like Snipping Tool, Photoshop, or PowerPoint. What it does Walk subfolders automatically and keeps the same folder structure in the output. Resize to a max width (keeps aspect ratio, never upscales). Compress JPEG us...

Testing with Pytest

Image
Pytest fixtures: clean tests without the ceremony Pytest makes testing feel less like a chore and more like a safety net—especially once fixtures enter the picture. Meta description suggestion: Learn how Pytest fixtures and markers help you write clean, isolated tests that scale—from simple unit tests to large CI pipelines. Quick jumps Why Pytest clicks The testing problem Using fixtures the right way Markers for test control Pros & cons Wrap-up Why Pytest clicks Pytest is one of those tools that feels obvious after you’ve used it for a bit. Tests are just functions. Assertions read like normal Python. And when you need context—database sessions, config, mock data—you reach for fixtures instead of duct tape. The big idea Pytest fixtures handle setup and teardown for you, so eac...

Generate a PDF Invoice from a Web Form with Flask + WeasyPrint

Generate a PDF Invoice from a Web Form with Flask + WeasyPrint If you already collect invoice details in a simple web form, the next step is usually: generate a clean PDF and download it. This Flask + WeasyPrint setup does exactly that. User submits a form, Flask renders an HTML invoice template, and WeasyPrint converts that HTML into a PDF you can download right away. Typical use cases Quick internal invoices (freelance, side projects, small business) Generate PDFs from structured form data (quotes, receipts, reports) Create consistent PDFs using HTML/CSS instead of “drawing” PDFs manually Install pip install flask weasyprint Note: WeasyPrint may require OS-level libraries depending on your system (common on Linux). If install fails, check the WeasyPrint docs for your OS. Improved script (safer, cleaner, returns PDF download) Changes from the original: Returns the PDF as a download instead of saving a fixed invoice.pdf on disk Basic input cleanup + ...

How to Insert Code Blocks in Blogger (Blogspot)

How to Insert Code Blocks in Blogger (Blogspot) If you write about Python, SQL, PowerShell, or anything technical, you’ll eventually need clean code blocks that don’t break formatting. Blogger doesn’t have a perfect “code block” button by default, but you can get reliable results with a few simple patterns. Method 1: The simple, built-in way (<pre><code>) This is the most common and reliable method. You write your post normally, switch to HTML view , and wrap your code with <pre><code>...</code></pre> . Open your post in Blogger. Switch the editor to HTML view (look for an HTML / <> toggle or dropdown). Paste your code wrapped like this (example below). Example (Python): import requests from selectolax.parser import HTMLParser import re def extract_emails(url): response = requests.get(url) tree = HTMLParser(response.text) emails = set(re.findall(r"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-z]{2,}", t...

SSRS Font Weight expressions

Image
Recently I was tasked to edit an old SSRS report, the report has multiple columns and I need to change the font weight to BOLD based on a specific value. It's so simple but annoying that it needs to be done manually to all the columns that you need the expression to check. which was 25 columns in my case! Steps: Right-click on the column and select "text Box Properties" Select "Font" from the left menu Next to BOLD click on the expression menu In the expression screen; write the expression based on your column and the condition. =IIF(Fields!JB.Value > 0, "Bold","Normal") So here I'm setting the Property "FontWeight" of the textbox to be "Bold" when the value is greater than 0, otherwise, you're setting it to "Normal". hope that helps!

Splunk - Mini Blog - Why learn Splunk after the age of 40! my Journey from MSBI to Splunk certified!

Why would you learn Splunk! Why particularly I choose Splunk! In today's world, data is king! we know that as a BI developers already !!  and cybersecurity is a critical component of every organization's IT infrastructure. As a business intelligence and data scientist developer, you may have heard of Splunk, a powerful software platform used for analyzing and monitoring machine-generated data. If you are looking to enhance your career and be open to new opportunities in the new hot trend of cybersecurity, learning Splunk and getting certified can be a game-changer for you, you still also can write dashboards, reports and alerts in Splunk! Yep!! So, why should you learn Splunk and get certified in it? Let's take a closer look at some of the reasons why Splunk is the future of cybersecurity. Splunk is a Leader in the Cybersecurity Industry Splunk is one of the most widely used cybersecurity tools in the industry. It has been recognized as a leader in the Gartner Magic Quadran...

Splunk - Mini Blog - How to learn Splunk after the age of 40! my Journey to get Splunk certified!

Learning Splunk, or any new technology, can be challenging at any age, but it's never too late to start. In this series I'll blog and document my personal experience at age of 40 to learn about Splunk to get certified to further enhance my career Here are some tips that can help you learn Splunk quickly and effectively: Start with the basics: Familiarize yourself with the Splunk architecture and its core concepts, such as indexing, search, and reporting. Why? How? When? Get hands-on experience: Splunk is a tool that can be learned best by doing. Create your own instances and practice with sample data to get a feel for how it works. How? Cost? When? Take online courses: There are many online courses and tutorials available that can help you learn Splunk quickly. Consider taking an online course to get a comprehensive understanding of the tool. Where? Cost? When? Join the Splunk Community: The Splunk community is a great resource for learning and getting support. Join the Splunk ...

Power query for Excel

I was looking for the download link for office 2013, here it is if you ever need it. Download from here : https://www.microsoft.com/en-us/download/details.aspx?id=39379

Open SSRS Linked URLS in a new window

Image
Greetings....as I mentioned before sometimes I use my blog posts as a way to remind myself of the stuff that I need frequently and never keep to memory. I needed to add a link in a new SSRS report and the link has to open in a new browser's window. Just Right click on your report field, select "Text Box Properties", select "Action", click on the "FX" sign to write that special expression. ="javascript:void(window.open('" + Fields!URL.Value + "','_blank'))" Assuming that your URL is dynamic and the column name is "URL" in your dataset SSRS Link in  new Browser's Window Hope that helps...

T-SQL Month Name,Number,Start and End of month

Image
Hi, Today's requirement is to create a month's table, to be used in a SSRS report parameters, to be passed to a stored procedure. the parameters needs to have Month Name, Number, Abbreviation, Start and End of month. Please find the T-sql code below: ; WITH months (MonthNumber) AS ( SELECT 1 UNION ALL SELECT MonthNumber + 1 FROM months WHERE MonthNumber < 12) SELECT MonthNumber, DATENAME( month , DATEADD( month , MonthNumber, -1)) AS [MonthName], UPPER ( LEFT (DATENAME( month , DATEADD( month , MonthNumber, -1)), 3)) AS MonthAbbr, DATEADD( month , DATEDIFF( month , 0, CONVERT ( VARCHAR (2), MonthNumber) + '/1/' + CONVERT ( VARCHAR (4), YEAR (GETDATE()))), 0) AS StartOfMonth, DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, CONVERT ( VARCHAR (2), MonthNumber) + '/1/' + CONVERT ( VARCHAR (4), YEAR (GETDATE()))) + 1, 0)) AS EndOfMont...