Skip to content

Instantly share code, notes, and snippets.

View idontcalculate's full-sized avatar
🫘
magic

Sirius1389 idontcalculate

🫘
magic
View GitHub Profile
{
"manifest_version": 3,
"name": "Hyperfocus",
"version": "1.0",
"description": "A productivity extension for ADHD-friendly browsing with readability and AI summarization features.",
"permissions": ["storage", "activeTab", "scripting"],
"action": {
"default_popup": "popup.html"
},
"content_scripts": [
// Wait for the DOM to load before attaching event listeners
document.addEventListener('DOMContentLoaded', () => {
const fontSizeInput = document.getElementById('font-size');
const bgColorInput = document.getElementById('bg-color');
const summarizeButton = document.getElementById('summarize-btn');
// Load settings from storage and apply them to the inputs
chrome.storage.sync.get(['fontSize', 'bgColor'], (settings) => {
if (settings.fontSize) fontSizeInput.value = settings.fontSize;
if (settings.bgColor) bgColorInput.value = settings.bgColor;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hyperfocus</title>
<style>
body {
font-family: Arial, sans-serif;
width: 200px;
padding: 10px;
// Load user settings and apply them to the page
chrome.storage.sync.get(['fontSize', 'bgColor'], (settings) => {
if (settings.fontSize) {
document.body.style.fontSize = `${settings.fontSize}px`;
}
if (settings.bgColor) {
document.body.style.backgroundColor = settings.bgColor;
}
});
use io_uring::{IoUring, opcode, types::Fd};
use std::net::SocketAddr;
use std::os::fd::AsRawFd;
use tokio::net::{TcpListener, TcpStream};
use std::io::Result;
async fn handle_client(stream: TcpStream, ring: &mut IoUring) -> Result<()> {
let mut buf = [0; 1024];
// Prepare a read operation
#[tokio::main]
async fn main() -> Result<()> {
let addr = "127.0.0.1:8080".parse::<SocketAddr>().unwrap();
let listener = TcpListener::bind(addr).await.unwrap();
let mut ring = IoUring::new(256)?;
loop {
let (stream, _) = listener.accept().await?;
handle_client(stream, &mut ring).await?;
}
[package]
name = "io_server"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = { version = "1", features = ["full"] }
io-uring = "0.5"
[[bin]]
from query import search_books
def main():
query_text = "carl sagan, cosmos"
results = search_books(query_text)
if not results:
print("No results found")
else:
for point in results:
import os
from qdrant_client import QdrantClient
from fastembed import TextEmbedding
from dotenv import load_dotenv
from qdrant_client.http.models import Distance, VectorParams
# Load environment variables from a .env file
load_dotenv()
# Access the environment variables
import os
import csv
from concurrent.futures import ThreadPoolExecutor
from qdrant_client import QdrantClient
from qdrant_client.http.models import PointStruct
from fastembed import TextEmbedding
from dotenv import load_dotenv
# Load environment variables from a .env file
load_dotenv()