Skip to content

Instantly share code, notes, and snippets.

@Duartemartins
Duartemartins / batchtrequest.rb
Last active May 2, 2024 19:57
Google Search Console Batch Index Requesting
require 'googleauth'
require 'json'
require 'net/http'
require 'uri'
require 'nokogiri' # to parse the sitemap
require 'cgi'
SCOPES = ['https://www.googleapis.com/auth/indexing']
ENDPOINT = 'https://indexing.googleapis.com/v3/urlNotifications:publish'
JSON_KEY_FILE = 'page-indexing-000000-26ca419af0a4.json' #replace with your json key file
# Import necessary libraries
from http.client import HTTPSConnection
from base64 import b64encode
from json import loads
from json import dumps
import os
from dotenv import load_dotenv
import json
import pandas as pd
# Import necessary libraries
from http.client import HTTPSConnection
from base64 import b64encode
from json import loads
from json import dumps
import os
from dotenv import load_dotenv
import json
import pandas as pd
@Duartemartins
Duartemartins / chatgpt.rb
Last active May 27, 2023 16:49
This Ruby script enables interactive editing of files using the OpenAI GPT-4 language model. The user provides instructions or prompts, either standalone or related to a specific file. If a file is specified, the script reads its contents and passes them, along with the user's instruction, to the GPT-4 model. The script also uses the tree comman…
#!/Users/duarte/.asdf/shims/ruby
require 'openai'
require 'json'
require 'tempfile'
require 'open3'
OpenAI.configure do |config|
config.access_token = ENV['OPENAI_API_KEY']
config.organization_id = 'ABC' # Optional, if you belong to multiple organizations