Skip to main content
memo.forof
  • index
  • tags
  • rss
  • An Ollama cheatsheet

    October 14 2024

    An #ollama cheatsheet...

    Also, I saw a hero trailer on netflix that had obviously been AI dubbed... sounded totally demented.

    links #

    • https://secretdatascientist.com/ollama-cheatsheet/
  • It's pronounced `queue_target`

    October 10 2024

    #til I mixed up #ecto queue_target for queue_interval

    links #

    • https://hexdocs.pm/db_connection/DBConnection.html#start_link/2-queue-config
    • https://elixirforum.com/t/ecto-query-timeout/27946/6
  • CAPSLOCK IS STUCCCCCCCK

    October 09 2024

    #til how to turn capslock off when I magically get it stuck under #windows:

    Ctrl + ALT then Ctrl + k
    

    I am occasionally mired in using an Ubuntu guest with a Windows host. I swap back and forth quickly, and something about the way I type yields a state where capslock is just... stuck... worth mentioning that I remap capslock to ctrl anywhere that I can, so when I get into this state, I can't simply hit capslock.

  • bigfiles

    October 08 2024

    #vim bigfiles #

    #til a sweet lil' hack to disable #neovim plugins and features that might make things sluggish... this has definitely not happened to me 100 times before.

    local bigfile = vim.api.nvim_create_augroup('bigfile', { clear = true })
    
    vim.g.bigfile_size = 1024 * 1024 * 1.5
    
    vim.filetype.add({
      pattern = {
        [".*"] = {
          function(path, buf)
            return vim.bo[buf].filetype ~= "bigfile" and path and vim.fn.getfsize(path) > vim.g.bigfile_size and "bigfile"
              or nil
          end,
        },
      },
    })
    
    vim.api.nvim_create_autocmd({ "FileType" }, {
      group = bigfile,
      pattern = "bigfile",
      callback = function(ev)
        vim.b.minianimate_disable = true
        vim.schedule(function()
          vim.bo[ev.buf].syntax = vim.filetype.match({ buf = ev.buf }) or ""
        end)
      end,
    })

    trigger actions on events with vim.api.nvim_create_autocommand #

    -- vim.api.nvim_create_autocmd({event}, {opts})
    
    vim.api.nvim_create_autocmd(
      -- the event
      "BufWritePost",
    
      -- the effect
      {
        pattern = "*.js",
        command = "silent! !prettier --write %",
      }
    )
    

    organizing autocommands with vim.api.nvim_create_augroup #

    local myGroup = vim.api.nvim_create_augroup("MyAutoGroup", { clear = true })
    
    vim.api.nvim_create_autocmd(
      "BufWritePost",
    
      {
        -- the group
        group = myGroup,
        pattern = "*.js",
        command = "silent! !prettier --write %",
      }
    )

    links #

    • https://github.com/LazyVim/LazyVim/commit/938a6718c6f0d5c6716a34bd3383758907820c52
  • head in hand, vmware carnage

    October 07 2024

    #vmware disk going berserker-mode #

    Had to tear down my long-lived guest VM today. After bumping to Ubuntu 24 LTS, the disk inexplicably grew to 390gb...

    • i'd set a disk size... way smaller than 390gb
    • no snapshots...
    • no space to triage
    • corporate security that kills usb
    • having to virtualize my daily-dev env is, uh... productive

    #fly.io, #phoenix & queue_interval #

    Found a helpful thread for tuning how phoenix will talk to the db, in my case supabase. queue_interval: 500 is pretty long, but seems to help with the machine resume thing...

  • Emojis

    October 04 2024

    emoji keyboard #macos #

    beep beep: Control (⌃) + Command (⌘) + Space

    #phoenix minus #tailwind #

    I've been deleting most of the default tailwind classes attached to the core components that Phoenix generates. Think I'll start my next #phoenix project with --no-tailwind.

    Links #

    • elixir forums
    • Changelog for v1.7
    • aria-describedby
  • While parsing markdown...

    October 03 2024

    vim-test #

    Using vim-test with #vim, #til how to scroll the :terminal. Just hit <C-o>. Scroll a bit. Then i to get back into insert mode.

    On Neovim the "basic" and "neovim" strategies will run test commands using Neovim's terminal, and leave you in insert mode, so that you can just press "Enter" to close the terminal session and go back to editing. If you want to scroll through the test command output, you'll have to first switch to normal mode. The built-in mapping for exiting terminal insert mode is CTRL-\ CTRL-n, which is difficult to press, so I recommend mapping it to CTRL-o:

    Enum.find |> Enum.into #

    Instead of doing a series of Enum.find across an #elixir list, pipe the contents of the find straight into Enum.into to produce a %{} that's easier to pluck values out of.

    list = [
      {
        "img",
        [
          {"alt", "a shadow"},
          {"src", "..."},
          {"width", "792"},
          {"height", "528"}
        ],
        []
      }
    ]
    
    with {"img", attrs, _} <- Enum.find(list, fn {tag, _, _} -> tag == "img" end),
         %{"alt" => alt, "src" => src} <- Enum.into(attrs, %{}) do
      "![#{alt}](#{src})"
    end
  • supabase and fly.io

    October 02 2024

    #supabase vs. #fly #

    Kicking out some toy apps, and fiddling with a #phoenix app deployed to fly.io — they have an alpha integration back to supabase, nice. I don't want to manage #postgres. BUT when my fly machines are suspended, I'll frequently hit an #ecto issue whereby the database times out, and the user is presented with a disappointing "internal server error" screen. Refresh the page, everything is fine...

    The internet is a series of tubes. The tubes are clogged when my fly machines are stopped. Guess I'll set fly.toml to always have one machine up. #til

    [http_service]
      ...
      min_machines_running = 1

    pending... fly.io may have a more bespoke approach for managed postgres soon. Surely there's a way to have these cold-boot machines more quickly connect to supabase.

    Remembering that I've forgotten how to type an em—dash #

    Option + Shift + Hyphen = lol

    etc. #

    hamhock/hipbone hambone/legbone

    Links #

    • https://fly.io/docs/elixir/the-basics/clustering/
    • https://hexdocs.pm/ecto_sql/Ecto.Adapters.Postgres.html#module-connection-options
    • https://fly.io/docs/supabase/#main-content-start
    • https://fly.io/docs/launch/autostop-autostart/#apps-that-shut-down-when-idle
    • https://fly.io/phoenix-files/shut-down-idle-phoenix-app/
  • October, unsurprisingly.

    October 01 2024

    #11ty images #

    #til how to use @11ty/eleventy-img on this very blog. It'll slurp media from elsewhere. Also, flickr makes it damn-near impossible to find the static links to your pictures these days. More internet bitrot.

    {% image "http://killtheliterate.com/zines/the-grackles-seething/img/helicopter.jpg", "a shadow" %}

    a shadow

    Clarifying "ballistics" #

    Probably obvious to a lot of people, but given Israel's invasion of Lebanon, and Iran's "preparation" to launch ballistic missiles ostensibly to somewhere within Israel, I wondered "when is a missile not ballistic?". #til the answer is when it's a cruise missile. Ballistic missiles are delivered along (ahem) gravity's rainbow, and cruise missiles are unpiloted kamikaze jets.

    devcontainers #

    One of the things I've heard about, and chose to ignore. Encountered a #devcontainer (.devcontainer) file after cloning a file, so #til what it actually is. Seems like a pragma for operating an IDE within the context of a container, so that one doesn't have to install all the stuff, e.g. black or prettier or node.

    soup beans #

    A post elsewhere sent me on a journey learning about pellagra, salmon cakes and therefore #til what soup beans are.

    a photo that looks old in which a man is eating what I assume are soup beans.

  • The bees made honey in the lion's skull.

    September 30 2024

    Kicking things off. #til about a few #11ty and #nunjucks incantations. A few observations as well:

    • MDN is highly involved with nunjucks?
    • Eleventy feels way behind with regard to modern tooling. esm, type-checking, that sort of thing.
    • I've immediately collided with the eleventy API. The documentation is not that easy to navigate, and lack of typing means that it's a bit more difficult to interrogate the user-facing API directly.

    This all seems a bit odious. However, I'm probably not the target audience for a tool like 11ty (eleventy?). It seems like it has the same core "I'm a big loop" as CMSs I've used before.

    To get the following to print, I've had to wrap the fenced block with a nunjucks raw tag.

    {#
      nunjucks will render some very strange stuff if you don't do variable
      assignments properly.
    #}
    
    {# this #}
    {% set hashtags = post.data.hashtagMap | getHashtags %}
    
    {# not this #}
    {% set hashtags %}{{post.data.hashtagMap | getHashtags}}{% endset %}
    
4/4
  • Previous