HackerTrans
TopNewTrendsCommentsPastAskShowJobs

thomastay

no profile record

Submissions

Decompressing a gzip file by hand (sorta), part 2: Now with Huffman

thomastay.dev
24 points·by thomastay·3 năm trước·4 comments

comments

thomastay
·7 tháng trước·discuss
This is really cool! It's like Excel's goal seek but can also handle the case of arbitrary input cells. Goal seeek can only handle one input and one output cell.

But how do you handle the case where multiple variables can be changed? If multiple input cells is the key difference from Goal seek, i think some more rigor should be placed into the algorithm here

e.g. setting A1 + B1 and wanting the result to be 5. Currently it bumps both A1 and B1 equally. What's the thought process behind this?
thomastay
·năm ngoái·discuss
> However, diving into a new caching approach without a deep understanding of our current system seemed premature

Love love love this - I really enjoy reading articles where people analyze existing high performance systems instead of just going for the new and shiny thing
thomastay
·năm ngoái·discuss
I think it's pretty cool that the source code is all in a single file called app.js, and it's just doing simple DOM manipulations, no React, no minification, no libraries. I like to think it's just written like that too, a gigantic file that the author just iterates on.
thomastay
·năm ngoái·discuss
Dhall has imports from URLs, much like Javascript. From their tutorial:

  {- Need to generate a lot of users?
  
     Use the `generate` function from the Dhall Prelude
  -}
  
  let generate = https://prelude.dhall-lang.org/List/generate
  
  {- You can import Dhall expressions from URLs that support
     CORS
  
     The command-line tools also let you import from files,
     environment variables, and URLs without CORS support.
  
     Browse https://prelude.dhall-lang.org for more utilities
  -}
  
  let makeUser = \(user : Text) ->
        let home       = "/home/${user}"
        let privateKey = "${home}/.ssh/id_ed25519"
        let publicKey  = "${privateKey}.pub"
        in  { home, privateKey, publicKey }
  
  let buildUser = \(index : Natural) ->
        {- `Natural/show` is a "built-in", meaning that
           you can use `Natural/show` without an import
        -}
        makeUser "build${Natural/show index}"
  
  let Config =
        { home : Text
        , privateKey : Text
        , publicKey : Text
        }
  
  in  {- Try generating 20 users instead of 10 -}
      generate 10 Config buildUser
thomastay
·2 năm trước·discuss
icic, yeah that definitely shouldn't be allowed
thomastay
·2 năm trước·discuss
Obv it depends, but one way to "solve" this it is to show an edit history, or at least the latest edit timestamp along with some visual indicator that the message was edited recently
thomastay
·2 năm trước·discuss
yeah, having eventual consistency for messages across homeservers makes the work on the client harder. I guess they just have to accept that messages will "appear in the past" as you said.

But at least for messages sent within the same homeserver, I would think that those two apis should return the same data
thomastay
·2 năm trước·discuss
Having dealt with this problem at work for several years now, I feel the pain of keeping different clients in sync - it's extremely difficult. Not sure if it's possible in Matrix, but consider having a message ID that increments by one on every message in a room. That lets the client know pretty quickly if there's a gap or a misordering.

Not really getting this point though:

  The /sync API returns events in an order "according to the arrival time of the event on the homeserver".

  The spec for /messages says it returns events "in chronological order. (The exact definition of chronological is dependent on the server implementation.)".
Why would those two return different results? When does the chronological order of two messages differ from the arrival time of the event on the homeserver?
thomastay
·2 năm trước·discuss
Whenever iterator design comes up, I always have to refer to munificent's excellent article: https://journal.stuffwithstuff.com/2013/01/13/iteration-insi...

tldr: The gold standard is if your iterator syntax / syntaxes can support these two types of iteration:

1. Interleaving two sequences

2. In-order tree traversal
thomastay
·2 năm trước·discuss
Thanks! just read a few, was a real blast from the past
thomastay
·2 năm trước·discuss
I really wish there was another platform than the app formerly known as Twitter, where AI discourse is thriving. Because right now, it seems that AI papers, discussions and articles are all being shared there first. Threads might be a competitor for that but I don't see that happening anytime soon.
thomastay
·2 năm trước·discuss
It's $8/24 per M input/output tokens. For reference, GPT4-Turbo is 10/30, and GPT4 is 30/60

https://docs.mistral.ai/platform/pricing/
thomastay
·2 năm trước·discuss
Hi mtlynch, I just wanna say that your post brought back a lot of memories for me. I distinctly remember reading your original post back in 2018. I remember feeling that I really hoped you would succeed since your complaints were so authentic. When I was reading this post, I was like - wait, i think i remember this post - and it's you! Happy to hear that you've made it with tinypilot
thomastay
·2 năm trước·discuss
Can't you just ask GPT to give you a summary? Here's my prompt for 3.5, it's not very sophisticated.

  System: You are a helpful AI assistant who follows instructions to the letter. You will generate a summary of the article.
  Article: {ARTICLE}
  User: Summarize the previous text in one paragraph. Include as many topics as possible, make every word count. Create only one single summary and stop once you are done.
thomastay
·2 năm trước·discuss
A bit tongue in cheek, but I summarized your article using artificial intelligence ;)

P.S. GPT 3.5 has a 16k context window now

--- AI Generated summary:

Marco's newsletter introduces a tutorial on developing a system in Node.js to generate summaries from YouTube videos using OpenAI's completions API. The architecture involves extracting text from videos and then creating text summaries. The process includes scraping subtitles, chunking text, and recursively summarizing using OpenAI. The system is built using Yarn, Node.js, Axios, and other libraries. The CLI allows users to summarize videos by providing the YouTube link and language code. Node.js is favored due to its flexibility, efficiency, and compatibility with the ChatGPT API. The project code and details are available on Marco's GitHub repository.

1: What prerequisites do I need to know before using ChatGPT API and Node.js for summarizing YouTube videos?

A: Before using ChatGPT API and Node.js for summarizing YouTube videos, you need to have Yarn and Node.js installed, familiarity with ES6 syntax, knowledge of HTTP calls using Axios, understanding of handling queues for promises, and the ability to work with interactive command line tools using yargs.

2: How can the ChatGPT API be applied to summarize the content of a YouTube video?

A: The ChatGPT API can be applied to summarize the content of a YouTube video by first extracting text from the video, chunking the text into manageable parts, and then using the recursive summarization technique to generate a summary by submitting prompts to the completions API. This process involves managing multiple promises concurrently to avoid rate-limiting issues and slower response times.

3: Why is Node.js a preferred choice for implementing a project that summarizes YouTube videos with the ChatGPT API?

A: Node.js is a preferred choice for implementing a project that summarizes YouTube videos with the ChatGPT API due to its efficiency in handling asynchronous operations, ease of building scalable applications, compatibility with various libraries and tools required for the project, and support for modern JavaScript features like ES6 syntax.
thomastay
·3 năm trước·discuss
I'd recommend anyone who's interested in testing Chatbots to checkout https://chat.lmsys.org/

It lets you test out two random different chatbots with the same prompt and compare them. Best thing is, your votes are used to rank LLMs on a public leaderboard, which helps AI researchers.

Here's my prompt I was playing with, which basically only Claude 2 and GPT4 answers well:

  How many legs do ten platypuses have, if eleven of them are legless? Platypuses have 3 legs. Walk it through step by step