You are a teacher of algorithms and data-structures who specializes in the use of the socratic method of teaching concepts. You build up a foundation of understanding with your student as they advance using first principles thinking. Explain the subject that the student provides to you using this approach. By default, do not explain using source code nor artifacts until the student asks for you to do so. Furthermore, do not use analysis tools. Instead, explain concepts in natural language. You are to assume the role of teacher where the teacher asks a leading question to the student. The student thinks and responds. Engage misunderstanding until the student has sufficiently demonstrated that they've corrected their thinking. Continue until the core material of a subject is completely covered. I would benefit most from an explanation style in which you frequently pause to confirm, via asking me test questions, that I've understood your explanations so far. Particularly helpful are test questions related to sim
This is a tool that sorts images into folders using "AI". You create the folders you want the images to be put into.
I got 'claude' to write with a couple prompts. Make venv and install deps with pip.
- Use microsoft/git-large-coco To turn images into short descriptions of images - https://huggingface.co/microsoft/git-large-coco
- Use all-MiniLM-L6-v2 to turn short descriptions into 'embedding vectors' - https://www.sbert.net/docs/sentence_transformer/pretrained_models.html
- Compare the embedding vector of the image, with the embedding vectors of the folders - choose the best folder to put the image into
#!/usr/bin/env python | |
import datetime as dt | |
from cryptography import x509 | |
from cryptography.hazmat.backends.openssl import backend | |
from cryptography.hazmat.primitives import serialization | |
from cryptography.hazmat.primitives.asymmetric import ed25519, x25519 | |
from cryptography.x509.oid import NameOID | |
issuer_private_key = ed25519.Ed25519PrivateKey.generate() |
re = require "re" | |
sqlite3 = require "lsqlite3" | |
reNumberPath = re.compile[[^/([0-9][0-9]*)$]] | |
function SetupSql() | |
if not db then | |
db = sqlite3.open('redbean.sqlite3') | |
db:busy_timeout(1000) | |
db:exec[[PRAGMA journal_mode=WAL]] |
This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/
the command zig run my_code.zig
will compile and immediately run your Zig
program. Each of these cells contains a zig program that you can try to run
(some of them contain compile-time errors that you can comment out to play
with)
This walk through comes from @GalacticFurball who tweeted two images representing the youtube_dl source code as of 2020-09-20. They mentioned later in the thread that they struggled converting the gzip-compressed tarball of the source code with Imagemagick to a PNG, so they ended up using a 3rd party website to do the work. This Gist will show you how to do it cleanly and exactly.
If you would like to convert any non-image binary into PNG, Imagemagick makes this trivial. I will be executing the commands on a Debian Linux system, so you may need to adjust the commands for BSD, macOS, or Windows as necessary.
#!/usr/bin/python3 | |
import sys | |
import asyncio | |
import greenlet | |
class AsyncIoGreenlet(greenlet.greenlet): | |
def __init__(self, driver, fn): | |
greenlet.greenlet.__init__(self, fn, driver) | |
self.driver = driver |
"""This is a simpler version of the greenlet | |
example at https://gist.github.com/zzzeek/4e89ce6226826e7a8df13e1b573ad354 | |
Instead of the "await" keyword, we use the "await_()" function to interact with | |
the greenlet context. the greenlet context itself is 23 lines of code right | |
here. | |
""" | |
import asyncio |
This is a cross post of something I just posted on the Python bug tracker at https://bugs.python.org/msg373145.
I seem to have two cents to offer so here it is. An obscure issue in the Python bug tracker is probably not the right place for this so consider this as an early draft of something that maybe I'll talk about more elsewhere.
> This basically divides code into two islands - async and non-async
"""This program is exactly the same as that of | |
https://gist.github.com/zzzeek/33943060f7a08cf9e82bf8df1f0f75de , | |
with the exception that the add_and_select_data function is written in | |
synchronous style. | |
UPDATED!! now includes refinements by @snaury and @Caselit . SIMPLER | |
AND FASTER!! | |