This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Number of rows to keep | |
k = 8 | |
# Keep k first rows + transpose df | |
temp = df.head(k).T | |
# If df has more than k rows, sum remaining rows | |
if len(df) > k: | |
temp['Other rows'] = df.tail(len(df)-k).sum() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from requests_html import requests_html | |
if __name__ == '__main__': | |
# Define test data | |
test_data = [ | |
{ | |
"url": "https://www.example.com/", | |
"status": 200, | |
"title": "Example Domain", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from validator_collection import validators, errors # pip install validator-collection | |
import requests # pip install requests | |
import time | |
def main(args): | |
with open(args.input) as f: | |
urls = f.readlines() | |
sitemap_urls = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ipaddress | |
import requests | |
def verify_googlebot_ips( | |
list_of_ips, | |
google_ips_list_url="https://developers.google.com/static/search/apis/ipranges/googlebot.json", | |
): | |
"""Checks if each IP address in given list is in Google's official list of IP ranges. | |
Args: | |
- list_of_ips: list of ipv4 or ipv6 to check, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Diff wrapper piping with diff-so-fancy | |
# | |
# Prerequiste: install diff-so-fancy | |
# https://github.com/so-fancy/diff-so-fancy | |
# | |
# Setup: | |
# - save this script somewhere | |
# - `chmod +x` the file |
OlderNewer