Skip to content

Instantly share code, notes, and snippets.

View cyberandy's full-sized avatar
:octocat:
Yo!

Andrea Volpini cyberandy

:octocat:
Yo!
View GitHub Profile
@cyberandy
cyberandy / read-GNews.py
Last active January 5, 2024 19:48
A super-simple python script to read Google News RSS feeds and store data in a CSV file.
# Expected use >> python read-GNews.py -q [query] -l [language] -p [country]
# The following command will search for the latest news written in German from Austria about "Redbull"
# python read-GNews.py -q Redbull -l de -p AT
#
# Queries can be provided as strings using quotation marks >> python read-GNews.py -q "Redbull Media House" -l de
# Multiple queries can be executed at once >> python read-GNews.py -q "Redbull Media House" -q Redbull -l de -p at -p de
# The script will save a CSV file containing Title, Link, pubDate, Description, Source and Alexa Traffic Rank.
import feedparser
import time
import requests
from bs4 import BeautifulSoup
import time
USER_AGENT = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'}
def fetch_results(search_term, number_results, language_code):
assert isinstance(search_term, str), 'Search term must be a string'
assert isinstance(number_results, int), 'Number of results must be an integer'
@cyberandy
cyberandy / wordlift-graphql-data-agent-powered-by-llamaindex-a-simple-demo.ipynb
Last active September 26, 2023 14:05
wordlift-graphql-data-agent-powered-by-llamaindex-a-simple-demo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cyberandy
cyberandy / generate-md.py
Last active August 19, 2023 18:53 — forked from pshapiro/metadesc.py
Use sumy summarizer to extract summary from HTML pages that can be used for meta descriptions.
import csv
import os
import requests, sys
import pandas as pd
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
{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "https://wordlift.io/blog/en/#website",
"type": "http://schema.org/WebSite",
"http://schema.org/alternateName": "SEO made simple",
"http://schema.org/name": "WordLift Blog",
"http://schema.org/potentialAction": {
"type": "http://schema.org/SearchAction",
"http://schema.org/query-input": "required name=search_term_string",
"http://schema.org/target": "https://wordlift.io/blog/en/?s={search_term_string}"
@cyberandy
cyberandy / lodgingbusiness-wordlift-markup
Last active March 24, 2023 06:47
Example of a JSON-LD for LodgingBusiness that WordLift produces
[
{
"@context": "http://schema.org",
"@id": "http://data.wordlift.io/[entity-name]",
"@type": ["LodgingBusiness"],
"description": "Here goes the description",
"mainEntityOfPage": "https://www.happywordliftclient.com",
"image": [
{ "@type": "ImageObject", "url": "https://www.happywordliftclient.com/wp-content/uploads/2011/07/img-19az-1200x675.jpg", "width": 1200, "height": 675 },
{ "@type": "ImageObject", "url": "https://www.happywordliftclient.com/wp-content/uploads/2011/07/img-19az-1200x900.jpg", "width": 1200, "height": 900 },
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
0-100 porsche macan
0-60 porsche macan
1 porsche cayenne
1. porsche 911
1950s porsche
1950s porsche speedster
1955 porsche 356
1956 porsche 356
1956 porsche speedster
1959 porsche
{
"embeddings": [
{
"tensorName": "My tensor",
"tensorShape": [
1000,
50
],
"tensorPath": "https://gist.githubusercontent.com/cyberandy/d85af5a612c9763928542708c0ac0bf6/raw/b0c02e2f4324657ec7632e6a1e3cffc138e4a845/embeddings_vectors_porsche.tsv",
"metadataPath": "https://gist.githubusercontent.com/cyberandy/9a629edef01df3255d1e33b9875eadc9/raw/aab52346e227428ee1cf5d85dd4f7fbf2e227918/embeddings_meta_porsche.tsv"
@cyberandy
cyberandy / embeddings_vectors_porsche.tsv
Created December 15, 2021 13:55
embeddings_vectors_porsche
We can't make this file beautiful and searchable because it's too large.
-0.5113864 0.9224017 0.8275403 0.011984834 0.76330054 0.33919206 0.28311774 0.14538139 0.7499551 -0.03052776 0.10189354 0.99692094 -1.2256945 -0.02824433 0.162615 -0.051211037 -0.41829008 0.7155175 0.14836389 0.008838273 0.8170797 0.25933984 -0.16603503 0.44063374 0.08697651 -0.24981156 0.16387565 0.09536284 -0.37290013 0.050002567 0.2126679 0.35391727 0.2208684 0.14932127 -0.13903382 -0.30882716 -0.58008456 0.067993 0.26419926 0.028330343 0.06412557 0.14603412 -0.5382476 -1.1023028 0.92313683 0.5652307 -0.5976789 -0.08452714 -0.6236737 0.13708875 -0.045952026 0.32799286 0.12108048 -1.1154692 -0.09747529 0.20141003 -0.14496945 -1.254203 -0.3187798 1.0494366 0.06164006 -0.21705215 0.14927948 -0.097200364 0.3465199 -0.42689615 0.09920918 0.19603547 -0.5898324 -0.34810644 0.72347945 -0.60483193 0.7405867 0.65496427 0.36481908 0.13829523 -1.104363 0.23256357 0.46551976 0.01618421 0.32897347 -0.45708355 -0.34825176 0.96820194 0.6563605 -0.2686824 1.2559417 -0.80211407 0.28347582 -0.053863037 0.34286124 -0.4816527
@cyberandy
cyberandy / embeddings_meta.tsv
Last active December 8, 2021 15:16
KG embeddings meta
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
wl0216/entity/artificial_intelligence
wl0216/entity/gennaro_cuofano
wl0216/entity/google
wl0216/entity/google_analytics
wl0216/entity/how_to_optimize_your_website_for_voice_search
wl0216/entity/json-ld
wl0216/entity/knowledge_graph
wl0216/entity/metadata
wl0216/entity/microdata_html
wl0216/entity/natural_language_processing