Skip to content

Instantly share code, notes, and snippets.

View koverholt's full-sized avatar

Kristopher Overholt koverholt

View GitHub Profile
PROJECT_ID = "[your-project-id]" # @param {type:"string"}
LOCATION = "us-central1" # @param {type:"string"}
import vertexai
vertexai.init(project=PROJECT_ID, location=LOCATION)
from vertexai.generative_models import (
FunctionDeclaration,
GenerationConfig,
GenerativeModel,
PROJECT_ID = "[your-project-id]" # @param {type:"string"}
LOCATION = "us-central1" # @param {type:"string"}
import vertexai
vertexai.init(project=PROJECT_ID, location=LOCATION)
from vertexai.generative_models import (
FunctionDeclaration,
GenerationConfig,
GenerationResponse,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import vertexai
from vertexai.generative_models import (
FunctionDeclaration,
GenerationConfig,
GenerativeModel,
Part,
Tool,
)
from datetime import datetime
@koverholt
koverholt / 1-soap-request.py
Last active January 26, 2025 19:05
Sending a SOAP request with Python
import json
import requests
import xmltodict
import pandas as pd
# SOAP URL, payload, and headers
url = "https://hydrometdata.lcra.org/service.asmx"
payload = """<?xml version="1.0" encoding="utf-8"?>
@koverholt
koverholt / clean_repeated_dates_in_filenames.py
Created November 24, 2019 04:42
Remove repeated dates after "--" strings in Markdown filenames
import os
def find_second(string, substring):
return string.find(substring, string.find(substring) + 1)
for root, dirs, files in os.walk("."):
for file in files:
if file.endswith(".md"):
old_path = os.path.join(root, file)
second_location = find_second(file, "--")
@koverholt
koverholt / clean_markdown_titles.py
Created November 24, 2019 04:42
Remove H1 titles from beginning of Markdown files
import os
buff = []
for root, dirs, files in os.walk("."):
for file in files:
if file.endswith(".md"):
path = os.path.join(root, file)
with open(path, "r") as f:
print(path)
@koverholt
koverholt / split.py
Created November 20, 2019 18:12
Split delimited Markdown files into smaller files
with open("export.md", "r") as f:
buff = []
i = 1
for line in f:
if line.strip() and line.strip() != "---":
buff.append(line)
# Preserve newlines in file
if not line.strip():
buff.append("\n")
#!/usr/bin/env python
"""
Display the per-commit size of a file in a git repository.
$ python counter.py setup.py
82e2452, 2016-02-23T23:57:25-05:00, 14 lines
94e26ae, 2016-02-24T12:01:39-06:00, 15 lines
26e51c5, 2016-03-07T13:35:19-06:00, 19 lines
fed0eb8, 2016-03-15T15:03:36-05:00, 18 lines