Skip to content

Instantly share code, notes, and snippets.

View Xyborg's full-sized avatar
🐍
Python for SEO

Martín Aberastegue Xyborg

🐍
Python for SEO
View GitHub Profile
@natzir
natzir / getPercentDiff.js
Last active February 29, 2024 02:16
getPercentDiff.js
javascript:(function()%7Bjavascript%3A!function()%7Bfunction%20e(e)%7Blet%20l%3De.querySelectorAll(%22tr%22)%2Cn%3Dl%5B1%5D%3Bif(!(n%26%26(n.querySelector(%22%3Anth-child(4)%20%3E%20span%20%3E%20span%20%3E%20span%22)%7C%7Cn.querySelector(%22%3Anth-child(7)%20%3E%20span%20%3E%20span%20%3E%20span%22))))for(let%20a%3D1%3Ba%3Cl.length%3Ba%2B%2B)%7Blet%20r%3Dl%5Ba%5D%3Br.cells%5B1%5D.getAttribute(%22data-numeric-value%22)%3Blet%20i%3Dr.cells%5B2%5D.getAttribute(%22data-numeric-value%22)%2Cc%3Dr.cells%5B3%5D.getAttribute(%22data-numeric-value%22)%3Br.cells%5B4%5D.getAttribute(%22data-numeric-value%22)%3Blet%20s%3Dr.cells%5B5%5D.getAttribute(%22data-numeric-value%22)%2Co%3Dr.cells%5B6%5D.getAttribute(%22data-numeric-value%22)%2Cd%3Di%2Cu%3Ds%2Cp%3Dt(c%2Cd)%2Ch%3Dt(o%2Cu)%2Cf%3Dr.querySelector(%22%3Anth-child(4)%20%3E%20span%20%3E%20span%22)%2Cm%3Dr.querySelector(%22%3Anth-child(7)%20%3E%20span%20%3E%20span%22)%2Cg%3Ddocument.createElement(%22span%22)%2C%24%3Ddocument.createElement(%22span%22)%3Bg.innerText%3D%60%20(
@siliconvallaeys
siliconvallaeys / GPT Suggestions for RSAs with Google Ads Scripts
Last active March 28, 2024 10:04
Generate a spreadsheet of ad text assets for a Google Ads accounts and use GPT to suggest new ad variations.
/******************************************
* RSA Report
* @version: 3.0
* @authors: Naman Jindal (Optmyzr), Frederick Vallaeys (Optmyzr)
* -------------------------------
* Install this script in your Google Ads account (not an MCC account)
* to generate a Google Sheet with a list of all your responsive search ads
* and their headlines and descriptions.
* For RSAs that are not using the maximum number of allowed variations,
* this script will suggest new variations for headlines and descriptions
@siliconvallaeys
siliconvallaeys / Google RSA Report
Last active April 24, 2023 00:14
Generate a Google sheet with RSAs from your account and make it easier to find RSAs that don't use the maximum allowable number of headlines and descriptions.
/******************************************
* RSA Report
* @version: 1.0
* @author: Naman Jindal (Optmyzr)
* -------------------------------
* This script can be used to find responsive search ads
* that don't have the desired minimum number of headlines
* and descriptions.
*
* Optmyzr subscribers can use the Ad Text Optimization (RSA) tool
@ttrahan
ttrahan / ColorEvents
Last active April 9, 2023 22:39
Google Apps Script to color code Calendar events based on one to many keywords in Event Title
// This script will color code Events in Google Calendar. For setup, follow the instructions posted here:
// https://www.linkedin.com/pulse/automate-color-coding-your-google-calendar-marguerite-thibodeaux-acc/?trk=articles_directory
function colorEvents() {
const today = new Date();
const endDate = new Date();
// Set the end date for calendar events - set below at 31 days from current date
endDate.setDate(endDate.getDate() + 31);
Logger.log(today + " " + endDate);
@luratic-devs
luratic-devs / GA4 - Dimensions & Metrics Cheatsheet - Changelog.md
Last active December 3, 2023 18:37
GA4 - Dimensions & Metrics Cheatsheet - Changelog.md
@fedegomez
fedegomez / checkTitles.js
Last active May 24, 2023 03:38
Checks if the title of the result in the SERP matches the title of the URL
javascript: (function (doc){var changed=0; function checkTitles(){console.log('jQuery version ', $.fn.jquery, ' loaded'); var position=1; var items=[]; var results=$('#rso .kp-blk .g, #rso .g[class="g"], #rso .srg .g').not('.kno-kp .g').find('div:first').find('a:first'); $('.title-changed, #CountTitlesChanged').remove(); results.each(function (){if (!$(this).parents('.related-question-pair').length){var parent=$(this).closest('.tF2Cxc').length > 0 ? $(this).closest('.tF2Cxc') : $(this).closest('li'); items.push([ position, $(this).find('h3').text(), encodeURI($(this).attr('href')), parent]); position++;}}); var numItems=1; cors_proxies=[ 'https://api.codetabs.com/v1/proxy?quest=', 'https://jsonp.afeld.me/?url=',]; items.forEach(item=>{$.ajax({url: cors_proxies[Math.floor(Math.random() * cors_proxies.length)] + item[2], success: function (data, status, xhr){title=$(data).filter('title').text(); var html='<div class="title-changed">'; if (title !=item[1]){html +='<span style="font-weight: bold;color: #ff6961;">
@natzir
natzir / puppeteer-fetch-and-render.js
Last active August 25, 2023 23:44
Fetch and Render as Googlebot
// This code allows you to render a page as Googlebot with puppeter (headless Chrome).
// It even renders elements with the lazy-load implemented through IntersectionObserver.
// Copy and paste it here: https://try-puppeteer.appspot.com/
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Descriptors for other mobile devices: https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts
const mobile = {
name: 'Nexus 5X',
from urllib.parse import urlparse
import re
url="https://www.amazon.com/SanDisk-128GB-microSDXC-Memory-Adapter/dp/B073JYC4XM/"
print(set(re.split("[/-]", urlparse(url).path)))
#output
#{'', 'B073JYC4XM', 'dp', '128GB', 'microSDXC', 'Memory', 'SanDisk', 'Adapter'}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
import sys, os, time
import tweepy
keys = dict(
consumer_key='_YOUR_CONSUMER_KEY',
consumer_secret='_YOUR_SECRET_KEY',
access_token='_YOUR_ACCESS_TOKEN',
access_token_secret='_YOUR_ACCESS_TOKEN_SECRET'
)