• How to Get Org-Mode Filetags

    I recently needed to change the behavior of a library (org-download) based on the tags of the current buffer. Most of the answers I found online are incorrect (and so was ChatGPT) for Org version 9.5.

    Here’s how to get the filetags of an org-mode buffer or file programatically:

    (org-collect-keywords '("FILETAGS"))
    

    I used this to write a function to check whether or not the org-mode file was private or not.

    (defun my/org-file-is-private ()
        (let ((tags (car (cdr (car (org-collect-keywords '("FILETAGS")))))))
          (if (stringp tags)
              (member "private" (split-string tags))
            nil)))
    

  • Sorting Vector Store Results

    Many vector databases can find the top k most similar results to a query but are unable to sort by other document metadata. This is a pretty severe limitation for building LLM applications, especially for ones where time is dimension (meetings, calendars, task lists, etc.). For example, retrieving the 10 most similar results to the phrase “team meeting notes” but not being able to retrieve the team meeting notes from the last month.

    To work around the limitation of sorting vector query results, the most common suggestion is to pre-process a query or run multiple queries with different strategies at once and then combine the results. For example, first query for documents with a string similar to “meeting notes” (maybe using fuzzy, full-text search) filtered by date, then constrain a vector query search based on the collection of filtered records, and then pass the results to an LLM to synthesize the results and respond.

    See also:


  • Alfred Snippets on IOS

    Alfred does not have a mobile application that can make snippets available from your desktop to your phone. Here’s how to use Shortcuts on iOS to do that.

    First, export your snippets in Alfred by going to Features -> Snippets -> right click the collection and select Export and save the file to Dropbox.

    Next, create a shortcut on your phone with the following.

    (Not pictured in the screenshot, add a step to copy the value to your clipboard or do something else with the value)

    Now when you run the shortcut, you’ll be able access your snippets on your phone.

    Make sure to replace the file path with the path to your snippets file stored in Dropbox. This also works if you store the file someplace else because the file that Alfred stores for snippets is a zipped json file.


  • How to Build an Intuition of What AI Can Do

    One of the difficult parts of applying AI to existing processes and products is that people aren’t calibrated on what generative AI can and can’t do. This leads to both wild ideas that are not possible and missed opportunities to automate seemingly difficult work that is possible.

    How do you build an intuition of what AI can do?

    There’s no substitute for trying out these tools on your own. Not just fiddling around with ChatGPT but actually trying to solve a real problem using LLMs. Surprise plus memory equals learning, so the more things you try, the more surprises you will encounter, and the more you can learn about what it can and can’t do.

    Speaking for myself, I’ve been quietly working on one of one software that helps me explore the latest AI advancements in a safe place. I built org-ai to try out RAG techniques over a large number of documents (my public and private notes). I then applied what I learned to a prototype at work using the same techniques. From there I spotted problems with prompts and retrieving relevant documents that helped me understand some limitations of vector databases and RAG.

    I’m documenting a list of prompts that I can reuse for various problems. I wrote a script to use AI in a Google spreadsheet and wrote a prompt to detect specific kinds of spam signups. I wrote a prompt to help summarize the last week and communicate it to the team based on previous examples to match my writing style.

    Once you build up the habit of applying AI to real problems it starts to become a default starting point for new solutions. Not everything can or should be solved with AI but as a way to rapidly explore the space and gain real-world experience, learning by doing is unmatched.


  • Use AI in a Google Sheets

    I want to be able to use generative AI in spreadsheets to solve unique problems. I want to call OpenAI from a cell that passes in a prompt and a value from a column then returns an answer I can easily parse.

    Thankfully, you can do this in Google Sheets and Apps Script!

    First, create the script using App Script. In your spreadsheet go to Extensions -> Apps Script then add the script.

    function AI(prompt, value) {
      // Replace YOUR_API_KEY with your actual OpenAI API key
      const apiKey = 'YOUR_KEY';
      const apiURL = 'https://api.openai.com/v1/chat/completions';
    
      const payload = JSON.stringify({
        "model": "gpt-4-turbo",
        "frequency_penalty": 0,
        "presence_penalty": 0,
        "temperature": 0,
        "messages": [
          {"role": "system", "content": `${prompt}`},
          {"role": "user", "content": `${value}`}
        ]
      });
    
      const options = {
        "method": "post",
        "contentType": "application/json",
        "payload": payload,
        "headers": {
          "Authorization": "Bearer " + apiKey
        },
        "muteHttpExceptions": false
      };
    
      try {
        const response = UrlFetchApp.fetch(apiURL, options);
        const json = JSON.parse(response.getContentText());
        const resultText = json.choices[0].message.content;
        return resultText;
      } catch (e) {
        Logger.log(e.toString());
      }
    }
    

    Finally, call the App Script from a cell like you would any formula =AI(PROMPT, COLUMN).

    (Based on this thread in the OpenAI forum)

    See also:


  • Pricing for a Wide Range of Company Sizes

    When selling a B2B SaaS product to a wide range of company sizes (e.g. SMB, mid-market, enterprise), you generally want smaller companies to pay less and larger companies to pay more. This makes pricing difficultโ€”make it too one-size-fits-all and you can accidentally price out the smaller customers, make it too a la carte, and all customers will find your pricing confusing.

    What are some pricing techniques you can use when you have a wide range of business sizes to sell to?

    Pricing tiers using caps

    If you design pricing plans around the expected size of customer, you can make it clear who should be buying which plan and make a natural upgrade path. One way to do this is to include caps around one of the variable like the number of employees. For example, plan A is for up to 50 employees, plan B up to 500 employees, and so on.

    Simple and advanced

    Providing versions of the same feature can be used to appeal to different size customers and signal to the bigger companies which plans they should be on. For example, you might provide hosting on the basic plan for SMBs but faster CDN for mid-market companies and the ability to set custom headers for enterprises.

    Add-ons

    Pricing with tiered plans (which is most common for SaaS) comes with the downside that their may be a few critical features that a customer really needs but is stuck between plans. Using add-ons allows customers to pull forward from higher plans to get what they need. Have 51 employees and the cap is 50? Provide an upsell for each additional employee after the cap. Really need a CDN because you are an e-commerce shop? Purchase the CDN add-on for the basic plan.

    See also:


  • Shawn's Eskimo

    In an episode of Boy Meets World, Shawn is in a competition of who can wait longest on a billboard suspended high up in the air in order to win tickets to the Super Bowl. He stays there until the only two people left on a cold night are him and an Eskimo eating ice cream.

    When Corey tries to talk him down (literally), Shawn tells him that he has to stay. All his life there was always something in his way, preventing him from what he wanted to achieve.

    Shawn finally gives up on the contest, but goes to San Diego on his own, eventually finding a way into the Super Bowl.

    While the lesson of the episode was that Corey can’t solve all of Shawn’s problems for him, I remember it differentlyโ€”there will always be someone better than you no matter how hard you try, but that is not a reason to give up. There is more than one path.


  • Getting Ready for AI

    The other day I noticed a tweet from Justin Duke which outlined a plan to get his company’s codebase ready for Devinโ€”a programming focused generative AI product. While many are skeptical about AI taking over coding tasks, progress happening quickly and it seems likely that these tools will help software engineers, though maybe not replace the job outright).

    If we think AI can positively impact many domains, the question becomes, how can we position ourselves today to take advantage of it in the future?

    Writing more is almost certainly one way. Large language models operate on content. That content is mostly text. If you want to have a future co-pilot that can help you build useful and unique knowledge (and potentially avoid knowledge collapse), it’s reasonable to believe you need to be writing a heck of a lot so that AI can draw from what you already know. For example, in a video of Reid Hoffman interviewing himself as an AI, the AI was trained on every book Reid has written and every talk he’s given.

    When it comes to code, writing comments explaining what the code is doing and why that’s important seems like it would help generative AI make better contributions that need less supervision. After all, reading someone else’s code is hard enough! I would love to read some research on performance improvements not just on writing code but about comprehension of business logic and how documentation helps or hurts.

    Running a business, building a culture where writing is thinking and the primary way teams work asynchronously will amplify every future investment in AI. When Notion rolled out their AI-powered search, a new hire at Mosey started asking it questions about projects, tools, processes, and terms he didn’t understandโ€”the responses helped him get up to speed quickly. FAQs don’t work, but being able to respond to almost any question however it’s formulated sure does!


  • Net Magic Number

    Net magic number is a measurement of go-to-market (GTM) efficiency for SaaS businesses. A magic number less than 1.0 indicates the business will lose money on each customer. Top SaaS businesses making less than $25MM in revenue per year have a magic number of 1.7 according to benchmarks from Iconiq Capital as in their business returns 1.7x for every sales and marketing dollar they spent to acquire customers.

    Net magic number is calculated by taking the current quarter’s revenue less previous quarter’s revenue times 4 divided by the previous quarter’s sales and marketing spend.

    By looking at the previous quarter, net magic number accounts for the average sales cycle to complete which makes it a better measurement for enterprise SaaS that has a sales motion.

    See also:


  • Data Marketing

    When companies run surveys and industry analysis that they share with the media, they’re gaining exposure for themeselves. While data may be contained within a blog post or report, the unit of value is the data point that a journalist can extract into their article (with a mention of the source).


  • What I Read Every Morning

    I try to be careful about what I read in the morning as that has a way of setting the tone for the day. I stick to things that are informative or entertaining but don’t need a lot of energy to get into like a long-form essay.

    • HackerNews: I read the comments first and then the linked article if it seems interesting. When I was first trying to get into tech many years ago, I thought the go-to places were mainstream outlets like TechCrunch and Mashable (at the time). Turns out, the best place to observe what’s going on is seeing what the people building the software are talking about.
    • Dealbook: Maybe the exact opposite is Dealbook. Being a founder makes me more sensitive to the macro market and political landscape because it drives the behavior of our customers, investors, and the industry. It doesn’t matter if consensus macro forecasts are useless, it’s what everyone else thinks (or thinks they think) which helps me avoid being too myopic.
    • NY Times: Headlines onlyโ€”is there anything pressing going to be on everyone’s mind that we need to navigate today?
    • Money Stuff: I love Matt Levine’s writing so if there is a topic close to my areas of interest it’s well worth stretching my finance competence and reading it.
    • Other: Reddit for pure sugar, heavily curated to avoid rage-inducing content, when I just need to see some pictures of puppies to get the day going. During baseball season, checking updates of my fantasy baseball team (yes, it’s possible to be a code writing tech nerd and love baseballโ€”there are dozens of us).

  • HeLa Cells

    Henrietta Lacks passed away from cervical cancer in 1951, but her cells have been continuously used in medical tests due to their ability to replicate quickly. She might be the first immortal women as her lineage of cells have been used for the last 70 years.

    Her cells were extracted without her permission and given away freely for use in medical research.

    See also:


  • Proportional Decision Making

    The energy spent making a decision should be proportional to the consequences. The larger the consequences, the more energy should go into making the decision. The smaller the consequences, the less energy should go into them.

    While this is akin to Amazon’s type 1, type 2 decisions (trap door vs two-way door), proportional decision making describes a continuum which better matches the variety of decisions we see in reality (or at least I think so).

    What does this mean? We should be quick to make decisions that are inconsequential to avoid bike shedding. We should be rigorous and scruntinize decisions that deeply effect our interests. Mixing up the two would clearly be bad.

    From Dharmesh Shah on Lenny’s Podcast.

    See also: