Skip to content

Instantly share code, notes, and snippets.

View intellectronica's full-sized avatar
🤔

Eleanor Berger intellectronica

🤔
View GitHub Profile
@intellectronica
intellectronica / redirect-to-archive-ph.js
Created October 25, 2024 13:20
Userscript (for running with your monkey extension of choice) to redirect paywalled site articles to their archive.ph copy
// ==UserScript==
// @name redirect-to-archive-ph
// @match *://*/*
// ==/UserScript==
(function() {
'use strict';
if (window.location.href.includes('archive.ph')) return;
from fasthtml.common import *
app, rt = fast_app()
@app.get("/showtime")
def showtime():
return Script("document.getElementById('time').innerText = (new Date()).toLocaleTimeString();" id='showtimescript')
@app.get("/")
def home():
@intellectronica
intellectronica / asyncai.py
Last active September 23, 2024 19:45
Running multiple LLM calls in parallel with asyncio
import asyncio
from openai import AsyncOpenAI
import random
oai = AsyncOpenAI()
numbers = [str(random.randint(0, 123456789)) for _ in range(7)]
async def explain_number(number):
print(f'START: Explain the number {number}') # DEBUG
german_text = "Sprachkenntnisse sind ein wichtiger Bestandteil der Kommunikation."
class TranslatedString(BaseModel):
input_language: str = Field(
...,
description="The language of the original text, as 2-letter language code."
)
translation: str
print("SCHEMA:")
@intellectronica
intellectronica / ug-to-mochi.py
Created July 29, 2024 08:56
Script for creating Mochi flashcards based on the Ultimate Geography card collection
import requests
import tempfile
import subprocess
import pandas as pd
import base64
from textwrap import dedent
from datetime import datetime
import random
import string
@intellectronica
intellectronica / aitz.py
Last active June 28, 2024 06:32
"Parsing" weird iCal timezones and converting them to standard timezones with GPT-3.5-turbo
# An iCal VTIMEZOME component looks like this:
#
# BEGIN:VTIMEZONE
# TZID:Romance Standard Time
# BEGIN:STANDARD
# DTSTART:16010101T030000
# TZOFFSETFROM:+0200
# TZOFFSETTO:+0100
# RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
# END:STANDARD

I bought everything at the $ store!

# fill auth token here. see https://github.com/nicolevanderhoeven/shortform-to-readwise#usage for how to get it
$authToken = '...'
$booksApiUrl = 'https://www.shortform.com/api/books/'
$bookSlug = $args[0]
$response = Invoke-WebRequest -Uri "$booksApiUrl$bookSlug" -Headers @{
"Authorization" = "Basic $authToken";
"X-Sf-Client" = "11.8.0";
}
#lang racket
(require compatibility/defmacro)
'(monkey . peanuts)
'(eenie . (meenie . (meiney . (moe . ()))))
'(eenie meenie meiney moe)

Keybase proof

I hereby claim:

  • I am intellectronica on github.
  • I am intellectronica (https://keybase.io/intellectronica) on keybase.
  • I have a public key whose fingerprint is AF7A 9377 5C36 35B8 3405 302C 10CD 6B4B DF71 7CCE

To claim this, I am signing this object: