Skip to content

Instantly share code, notes, and snippets.

View fpcorso's full-sized avatar
Enjoying a fresh cup of tea...

Frank Corso fpcorso

Enjoying a fresh cup of tea...
View GitHub Profile
@fpcorso
fpcorso / wordcamp-sessions-xml-to-csv.py
Last active January 14, 2019 23:45
WordCamp Sessions XML to CSV
# Converts an XML generated from exporting
# sessions on a WordCamp site to a CSV file
# Use CMD/Powershell/Terminal to enter:
# python wordcamp-sessions-xml-to-csv.py
import xml.etree.ElementTree as ET
import csv
# Get the filenames
file_name = input("What is the XML file to convert? ")
@fpcorso
fpcorso / plugin-reviews.py
Last active December 26, 2023 05:40
WordPress Plugin Reviews Scraper
# Script: WordPress Plugin Reviews Scraper
# Author: Frank Corso
# Date Created: 08/16/2019
# Last Modified: 05/23/2020
# Python Version: 3.6.5
# There are waits built in to avoid putting strain on the wp.org servers.
# However, any amount of scraping adds to server load.
# So, please avoiding running this script on plugins with lots of reviews
# and try to only run this script once and not on any repeating schedule.
@fpcorso
fpcorso / license-calculations.py
Last active September 10, 2020 15:41
EDD Per Download License Calculations
# Script: EDD Per Download License Calculations
# Author: Frank Corso
# Date Created: 04/05/2020
# Last Modified: 07/16/2020
# Python Version: 3.6.5
# Takes exports of licenses from EDD and turns it into a CSV of totals and averages.
# To use, have CSVs of licenses for each download in EDD in a 'licenses' directory with each
# saved as edd-export-licenses-(download-slug).csv
# Put this script above that directory. In terminal, run python license_calculations.py
@fpcorso
fpcorso / customer-license-calculations.py
Last active September 10, 2020 15:43
EDD Customer License Calculations
# Script: EDD Customer License Calculations
# Author: Frank Corso
# Date Created: 04/06/2020
# Last Modified: 07/21/2020
# Python Version: 3.6.5
# Takes exports of licenses from EDD and turns it into a CSV of customers with total number of licenses,
# total number of sites, active licenses, and total active sites. This is meant as a stepping stone for
# further analysis.
# To use, have CSVs of licenses for each download in EDD in a 'licenses' directory with each
@fpcorso
fpcorso / domain-search.py
Last active September 14, 2020 17:08
Site Crawl - Domain Search
# Script: Site Crawl - Domain Search
# Author: Frank Corso
# Date Created: 09/14/2020
# Last Modified: 09/14/2020
# Python Version: 3.6.5
# Crawls a supplied url (hopefully your own) and searches for instances of links to a different supplied domain.
# i.e. Crawls site on https://example-one.com looking for any links to example-two.com.
# Avoid crawling for a link that is in your header or footer as this will capture all of those too.
# To run, use `python domain-search.py` and then supply the site to be crawled in `https://example-one.com` format.
@fpcorso
fpcorso / helpscout-api-to-csv.py
Last active March 4, 2024 15:31
Download conversations from a Help Scout mailbox and save as CSV file
"""
Download conversations from a Help Scout mailbox and save to CSV file.
Be sure to replace the App ID and Secret in the authorization call as well
as the Mailbox ID in the conversations API call.
Python: 3.9.0
"""
import csv
@fpcorso
fpcorso / csv_chunkifier.py
Created November 10, 2022 18:04
CSV Chunkifier using Pandas
import math
import pandas as pd
import typer
def main(file: str, to_format: str, size: int = typer.Argument(40000)):
"""
CSV Chunkifier uses Typer. Pass an existing CSV file, the name for the new files, and
size of each chunk to the command.