Skip to content

Instantly share code, notes, and snippets.

View eliasdabbas's full-sized avatar
💭
https://chatnificent.com/

Elias Dabbas eliasdabbas

💭
https://chatnificent.com/
View GitHub Profile
@eliasdabbas
eliasdabbas / serp_anthropic.py
Created June 9, 2026 22:37
Run SERP analysis of Anthropic web search results in bulk
"""
``serp_anthropic`` — run templated web-search queries across a matrix of
models, locations, and web-search tool versions, returning a tidy DataFrame of
ranked citations.
"""
from __future__ import annotations
import itertools
@eliasdabbas
eliasdabbas / headroom_chatnificent.py
Last active June 3, 2026 13:33
Use headroom AI to compress messages in a chatnificent app
# /// script
# requires-python = "<=3.13"
# dependencies = [
# "chatnificent>=0.0.25",
# "headroom-ai",
# "openai>=2.0.0",
# ]
# ///
import chatnificent as chat
from headroom import compress
@eliasdabbas
eliasdabbas / ai_website_search_alsoasked.py
Created May 11, 2026 15:21
How to create an AI website search app with Chatnificent
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "chatnificent[anthropic]>=0.0.23",
# ]
# ///
import chatnificent as chat
welcome_message = """
## Welcome to the AlsoAsked AI assistant!
@eliasdabbas
eliasdabbas / chatnificent_mutli.py
Created February 3, 2026 10:59
Chatnificent multi page app using use_pages=True
"""
Multi-Page Chatnificent App Example
====================================
This file shows how to create a multi-page app with Chatnificent.
Since Chatnificent is a subclass of Dash, you can use all Dash features
including multi-page apps with the pages/ directory structure.
Directory Structure:
--------------------
@eliasdabbas
eliasdabbas / ai_website_search.py
Last active February 3, 2026 18:59
Chatbot that searches and generates answers from the given domains
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "anthropic>=0.77.0",
# "chatnificent>=0.0.10",
# "dash-bootstrap-components>=2.0.4",
# ]
# ///
import chatnificent as chat
from anthropic.types import TextBlock
@eliasdabbas
eliasdabbas / app.py
Created December 27, 2024 02:37
A demo Dash app demonstrating how to run uv scripts remotely
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "dash",
# "dash-bootstrap-components",
# ]
# ///
from dash import Dash, html, dcc, Output, Input
import dash_bootstrap_components as dbc
@eliasdabbas
eliasdabbas / direct_labeling_plotly_express.py
Last active November 6, 2024 12:25
Direct labeling with plotly.express
import plotly.express as px
fig = px.line(
stocks,
x='date',
template='plotly_white',
y=stocks.columns[1:],
color_discrete_sequence=cat_scale,
labels={'y': 'stock price'},
height=600,)
@eliasdabbas
eliasdabbas / cartogram.py
Last active November 6, 2024 12:07
Create a cartogram by assigning size to flags (or two letter symbols) without displaying map lines
import plotly.express as px
import adviz
import numpy as np
import pandas as pd
population = pd.read_html('https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_population')
pop = population[0][['Location', 'Population']].copy()
flags = []
for country in pop['Location']:
try:
@eliasdabbas
eliasdabbas / filter_non_200_status_codes.py
Created June 2, 2024 19:17
Filter non 200 status codes on a daily basis
import os
import datetime
import pandas as pd
today = datetime.datetime.now(datetime.UTC).strftime('%Y_%m_%d')
url_status_time = pd.concat(
pd.read_json(f'/path/to/status_codes/{file}',
lines=True)
@eliasdabbas
eliasdabbas / daily_status_code.py
Created June 1, 2024 20:00
Setting up a daily status code checker
import datetime
import advertools as adv
today = datetime.datetime.now(datetime.UTC).strftime("%Y_%m_%d")
sitemap = adv.sitemap_to_df("https://example/sitemap.xml")
adv.crawl_headers(
sitemap["loc"],