Skip to content

Instantly share code, notes, and snippets.

View lukestanley's full-sized avatar

Luke Stanley lukestanley

View GitHub Profile
@lukestanley
lukestanley / logging_server_aio.py
Last active October 21, 2024 22:32
Log arbitrary webpage text changes to JSONL file from all tabs to local server: Browser UserScript and Python server. MIT license (c) Luke Stanley 2024
"""
# MIT License (c) Luke Stanley 2024
AIOHTTP server to save webpage text changes with timestamps.
Prints changes to the console and saves them to 'changes.jsonl' in the background.
Dependencies: aiohttp, asyncio
Install: pip install aiohttp
Run: python3 logging_server_aio.py
@lukestanley
lukestanley / paul_graham_essays_visual_map.ipynb
Last active August 8, 2024 14:09
Visualises Paul Graham's essays using OpenAI embeddings and t-SNE. Fetches essays from Swartz's RSS API, embeds with OpenAI's text-embedding-3-small model, and reduces dimensions with t-SNE for plotting. Thanks to PG for the advice and $700 cheque, and to the late Aaron Swartz for RSS, the feed, & those keeping things running behind scenes!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukestanley
lukestanley / Quantum Consciousness: Connor Leahy and David Pearce.md
Last active June 17, 2024 15:43
Connor Leahy and David Pearce discuss if quantum mechanics can explain the nature of consciousness, exploring differing viewpoints.

Despite best intentions, for my own failings, I found the exchange between my good friend David Pearce and the influential Connor Leahy hard to follow so I had GPT-4o translate and summarise it for me, including some extracts David pointed to from his sites.

You can see how it was made here: https://chatgpt.com/share/fe5493d7-b725-4c30-abe1-763bb4bd5eab

Introduction

This explains a conversation between Connor Leahy and David Pearce about quantum consciousness. It also breaks down David Pearce’s ideas on how our perception of reality might be distorted.

Connor Leahy:

@lukestanley
lukestanley / git_untracked_easy_filter.py
Last active June 15, 2024 10:52
List recently changed files that git is not tracking so you don't loose your files, with persistent filtering that's easy to change. So once you finally know what is missing, you can git add them and you should commit them. Useful when you have a big project you need to get more control of!
#!/usr/bin/env python3
"""
You can put this script somewhere you can easily run it.
You can mark it executable and run it directly on nix systems, e.g Mac, Linux etc.
Assuming you saved it to your home directory, mark it executable:
chmod +x ~/git_untracked_easy_filter.py
Usage:
`~/git_untracked_easy_filter.py`
@lukestanley
lukestanley / making_podcast_summary_from_audio.txt
Created April 11, 2024 06:48
making podcast summary with Whisper speech to text model on Replicate with ChatGPT 4
Making podcast summaries when only the audio is available.
Find MP3 of the podcast.
Use a Whisper API, such as https://replicate.com/thomasmol/whisper-diarization (I logged in via GitHub with my paid account). I put the mp3 URL into the file_url section. I set the num_speakers to 2 (which turned out to be a bit wrong after I heard the podcast, due to additional voices for the adverts). I put 'en' as the language.
In the prompt string I pasted an introduction to the podcast to help it be more accurate with names.
I pressed "Run". 2 minutes later, I checked out the JSON section on the right hand side, and pressed the copy button.
I selected an extract of the start of the JSON, showing the structure, stopped after the first array item that contained the transcript text and speaker ID. I saved it as a JSON file.
I provided it to ChatGPT 4. In particular I used this instruction after the extract:
`Parse the JSON to get a text transcript. Think step by step sharing very detailed working out. Use Python. we want o
@lukestanley
lukestanley / extract_chatgpt_conversations.py
Created February 14, 2024 00:31
A method to get easily parsable conversations from a ChatGPT data export of Feb 2024 vintage
def extract_messages(file_path="conversations.json", conversation_limit=None, message_limit=None):
with open(file_path, "r") as file:
data = json.load(file)
extracted_conversations = []
conv_titles = []
# Use the specified limits or the entire data length if no limit is specified
conversation_count = conversation_limit if conversation_limit else len(data)
@lukestanley
lukestanley / visual_programming_podcast_maggie_appleton_transcript.txt
Last active January 16, 2024 15:40
`Metamuse Episode 37 — August 19, 2021 Visual programming with Maggie Appleton, Mark and Adam. From https://museapp.com/podcast/37-visual-programming/ and transcribed with https://replicate.com/thomasmol/whisper-diarization
Maggie: Maybe the past generation of programmers were sort of subjecteded to a really awful version of visual programming, but it would be really sad to let that frustration that other people have felt ruin what visualprogramming could be in a much better design format, or just done in very different ways, done in ways that combine graphics and text.
Adam: Hello, and welcome to Metamuse. Muse is a tool for thought on iPad. But this podcast isn't about Muse the product, it's about Muse the company and the small team behind it. I'm Adam Wiggins, joined by my colleague Mark McGranigan. Hey, Adam. And our guest, Maggie Appleton from Egghead.
Maggie: Hello.
Adam: Thanks for joining us, Maggie. Now, listeners of the podcast will know that Mark and I are fans of computing history. We think sometimes the technology industry is a little unaware of its own history. And I understand you recently visited a museum on that topic in your area.
Maggie: I did. I got last weekend to go up to Cambridge, which is about an hour a
@lukestanley
lukestanley / local_first_whisper_transcript.txt
Created January 16, 2024 11:31
Local-first software with Martin Kleppmann automated transcript
And I feel like this idea really changes the abstractions that operating systems should provide, because maybe OSes should not just be providing this model of files as a sequence of bytes, but this higher-level CRDT-like model. And how does that impact the entire way how software is developed? And we've talked before about Mark's dabbling in playing the piano. I understand this is a hobby you're starting to look into as well, Martin. Oh, yes. I've been playing the piano, trying to do it a bit more consistently for the last year and a half or so. A lockdown project. And you have a technique for not annoying your neighbors. For the neighbors? Or is this an electronic piano, or how do you do that? It's an electric piano, although I don't think it's too bad for the neighbors. Lately, I've been trying to learn a Debussy 400 piece that I can play together with my wife. So she'll play two hands, and I'll play the other two. Nice. I suspect a lot of our listeners know you already, Martin. I think you're within your s
@lukestanley
lukestanley / archive_all_done_linear_tasks.py
Created January 5, 2024 13:32
Archive all done Linear issues
# Set API_KEY!
import requests
headers = {
'Authorization': API_KEY,
'Content-Type': 'application/json'
}
query = """
@lukestanley
lukestanley / archive_done_linear_sync_tasks.py
Last active January 5, 2024 12:34
Archives done Linear Sync tasks via GraphQL API
# Set API_KEY!
import requests
headers = {
'Authorization': API_KEY,
'Content-Type': 'application/json'
}
# Search for issues that have been synced from LinearSync: