Skip to content

Instantly share code, notes, and snippets.

@pshapiro
pshapiro / CausalImpact.ipynb
Last active March 4, 2024 14:15
CausalImpact implementation in Python to demonstrate SEO A/B Testing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pshapiro
pshapiro / GoogleEntities.ipynb
Last active February 11, 2024 23:21
Extract Entities from Search Results using Google NLP for Keyword Research Opportunities
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
sticker tags
lucide//dice-6
board-games

Ranked List

  1. Barrage
  2. Maracaibo
  3. Hansa Teutonica
  4. Lost Ruins of Arnak
  5. Gaia Project
@pshapiro
pshapiro / Auto301Redirects.ipynb
Created June 19, 2019 16:50
Automatic 301 Redirects with SpaCy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pshapiro
pshapiro / metadesc.py
Created June 6, 2018 22:19
Use Text Summarization Algorithms to Help Aid the Writing of Meta Descriptions
import csv
import os
from sumy.parsers.html import HtmlParser
from sumy.parsers.plaintext import PlaintextParser
from sumy.nlp.tokenizers import Tokenizer
from sumy.summarizers.lsa import LsaSummarizer as Lsa
from sumy.summarizers.luhn import LuhnSummarizer as Luhn
from sumy.summarizers.text_rank import TextRankSummarizer as TxtRank
from sumy.summarizers.lex_rank import LexRankSummarizer as LexRank
from sumy.summarizers.sum_basic import SumBasicSummarizer as SumBasic
@pshapiro
pshapiro / internal-pagerank.r
Last active March 29, 2023 16:36
Calculate Internal PageRank from Screaming Frog Crawl
library("igraph")
# Swap out path to your Screaming Frog All Outlink CSV. For Windows, remember to change backslashes to forward slashes.
links <- read.csv("C:/Documents/screaming-frog-all-outlinks.csv", skip = 1) # CSV Path
# This line of code is optional. It filters out JavaScript, CSS, and Images. Technically you should keep them in there.
links <- subset(links, Type=="AHREF") # Optional line. Filter.
links <- subset(links, Follow=="true")
links <- subset(links, select=c(Source,Destination))
g <- graph.data.frame(links)
pr <- page.rank(g, algo = "prpack", vids = V(g), directed = TRUE, damping = 0.85)
values <- data.frame(pr$vector)
@pshapiro
pshapiro / YouTube-Playlists-Subtitles.ipynb
Last active February 27, 2023 23:06
Download auto-generated subtitles from a YouTube playlist and do a term frequency analysis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pshapiro
pshapiro / internal-pagerank.r
Last active August 3, 2022 08:53
Modification to assign PR a value between 1 and 10
library(igraph)
map <- function(x, range = c(0,1), from.range=NA) {
if(any(is.na(from.range))) from.range <- range(x, na.rm=TRUE)
## check if all values are the same
if(!diff(from.range)) return(
matrix(mean(range), ncol=ncol(x), nrow=nrow(x),
dimnames = dimnames(x)))
## map to [0,1]
@pshapiro
pshapiro / expired_domain_finder.ipynb
Created January 29, 2019 21:07
Jupyter Notebook that input outlink from Screaming Frog crawl, grabs PA & DA from Moz API, and uses WHOIS API to determine domain availability.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.