Skip Navigation
Order of magnitude is a hell of a drug
  • It all depends on the precision you need. You could use an infinite series to get to the precision needed but for most use-cases it’s just a double baked into the binary itself, hence O(1)

  • Anon is a statistic
  • Could just be a story about a man getting pegged by his wife

  • Compilation mode for neovim
  • Spite really is the best motivator

  • Telescope.nvim picker to choose different pyenv install for pylsp.

    Preview

    !

    ---

    What

    So I really needed my pylsp to use a different pyenv install, and just want to share my basic solution in hopes it'll help someone else.

    The basic gist of it is that I use vim.system() to get the version paths through pyenv: bash pyenv root pyenv versions --bare --skip-aliases and create a telescope picker for selection.

    Then I use vim.lsp.client.notify() with the workspace/didChangeConfiguration lsp method to change pylsp's settings (for which options can be found here).

    Code

    ```lua local pickers = require("telescope.pickers") local finders = require("telescope.finders") local conf = require("telescope.config").values local actions = require("telescope.actions") local action_state = require("telescope.actions.state")

    local M = {}

    M.get_pyenv_root = function() if not vim.fn.executable('pyenv') then vim.notify("pyenv executable not in path.", vim.log.levels.WARN) return nil end

    local root_cmd = vim.system({ 'pyenv', 'root', }):wait()

    if root_cmd.code ~= 0 then vim.notify('"pyenv root" command returned non zero exit status.', vim.log.levels.WARN) return nil end

    local pyenv_root = string.gsub(root_cmd.stdout, '%s+', '') local pyenv_versions_path = vim.fs.joinpath(pyenv_root, '/versions')

    if not vim.fn.isdirectory(pyenv_versions_path) then vim.notify("Failed to find pyenv versions directory, '" .. pyenv_versions_path .. "'.", vim.log.levels.WARN) return nil end

    return pyenv_versions_path end

    M.get_pyenv_version_paths = function() if not vim.fn.executable('pyenv') then vim.notify("pyenv executable not in path.", vim.log.levels.WARN) return nil end

    local cmd = { 'pyenv', 'versions', '--bare', '--skip-aliases' }

    local versions_cmd = vim.system(cmd):wait() if versions_cmd.code ~= 0 then vim.notify('command "' .. vim.inspect(cmd) .. '" returned non zero exit status.', vim.log.levels.WARN) return nil end

    local versions = vim.fn.split(versions_cmd.stdout, '\n') return versions end

    M.get_pyenv_results = function() local pyenv_versions_root = M.get_pyenv_root() local results = {}

    if pyenv_versions_root == nil then return nil end

    local pyenv_versions = M.get_pyenv_version_paths() if pyenv_versions == nil then return nil end

    for _, version_path in ipairs(pyenv_versions) do table.insert(results, { version_path, vim.fs.joinpath(pyenv_versions_root, version_path), }) end

    return results end

    M.set_pylsp_environment = function(python_env) local pylsp_clients = vim.lsp.get_clients({ name = "pylsp" }) if pylsp_clients == nil or next(pylsp_clients) == nil then vim.notify("No Pylsp clients found.", vim.log.levels.WARN) return end

    local clients = 0 for _, client in ipairs(pylsp_clients) do client.notify("workspace/didChangeConfiguration", { settings = { pylsp = { plugins = { jedi = { environment = python_env } } } } }) clients = clients + 1 end vim.notify("Set python environment to '" .. python_env .. "' for " .. clients .. " pylsp clients.") end

    M.pyenvs = function(opts) opts = opts or {} local version_results = M.get_pyenv_results() if version_results == nil then return end

    pickers.new(opts, { prompt_title = "pyenvs", finder = finders.new_table({ results = version_results, entry_maker = function(entry) return { value = entry, display = entry[1], ordinal = entry[1], } end, }), attach_mappings = function(prompt_bufnr, _) actions.select_default:replace(function() actions.close(prompt_bufnr) local selection = action_state.get_selected_entry() M.set_pylsp_environment(selection.value[2]) end) return true end, sorter = conf.generic_sorter(opts) }):find() end

    return M

    ```

    And now you can easily open the picker with the M.pyenvs() function.

    Also nice way to create the keymap for it is to wait for the LspAttach autocmd (which fires when an LSP is attached to a buffer) to fire and only create the keymap on the buffer that pylsp is attached to like so:

    (don't forget to change the '<module_name>')

    lua vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if client and client.name == "pylsp" then vim.keymap.set("n", "<leader>le", function() local pylsp_picker = require("<module_name>") pylsp_picker.pyenvs() end, { desc = "[e]nvironment (python)", buffer = args.buf }) end end })

    0
    SCP Academy | Part 001 - The Containment Breach

    Dark Math Films just released the first episode of their series SCP Academy and it’s a banger, go show em some love!

    1
    Universal health care
  • Plus it also means that the government has an actual incentive to keep the insurance companies honest

  • Universal health care
  • Well yeah but percentage of GDP is just the total spent. The point is that the USA relies primarily on employers paying for the insurance (through a pay cut) whereas in the EU it is generally subsidised with taxes. Which, if you tax fairly, means that the cost of healthcare is better for the average worker (e.g more based on how much any individual earns)

  • Man set to be executed in Missouri even though DNA evidence acquits him

    From the video description:

    > How does an innocent man get executed in America today? In Missouri, it might be easier than you think. > > For a state that incarcerates its population at a higher rate than most countries on earth the system has been rigged to make sure these convictions remain final no matter what comes to light. > > At the centre of it all: Marcellus Williams. Even though DNA evidence was discovered seven years ago that could have exonerated him, the state has refused to even allow an evidentiary hearing to present this. > > Marcellus Williams’ execution date is currently set for September 24th, 2024. > > Special Thanks: Noah Readhead, Matt Underwood, Trent Hover, Tim Donsbach, Rojo Bushnell, Kent Gipson, Greg Hampikiam, George Joseph Miller IV and all of my friends and family who supported this project and gave feedback along the way. > > To learn more about Marcellus case and others like him (and to donate to legal defence) visit: > > Innocence Project > > Midwest Innocence Project > > To contact the Congresswoman who oversees St. Louis County go here: > > Cori Bush, Congresswoman for Missouri’s 1st > > Wesley Bell will be assuming her seat after winning the primary. He has fought tirelessly for Marcellus innocence. > > Andrew Bailey’s Office: > > Andrew Bailey, Missouri Attorney General > > MO Senators: > > Eric Schmitt, U.S. Senator for Missouri > > Josh Hawley, U.S. Senator for Missouri

    0
    Tomb Cheese
  • Honestly the French would probably still have a go at it.

  • imagine if the crowsstrike bug was malicious...
  • If they made it malicious, we probably wouldn’t have noticed though

  • rule
  • :o=3

    :o==3

    :oc==3

    :D c==3

  • Wish I could charge people $100 an hour when I answer their calls like a 1-900 number
  • Am I weird for liking it better when people call me? Usually takes less time and effort to discuss something over the phone imo

  • Unused variables
  • Ah an avid dreambird user I see

  • interestingasfuck @lemmy.world N0tTheBees @sh.itjust.works
    Building a machine to create fractals through video feedback

    This man has spend the past 30+ years perfecting a machine to create beautiful fractals through HD video feedback

    !https://sh.itjust.works/pictrs/image/edd0a9a9-b07f-46b6-9b44-06ee1b8f2eb3.gif

    1
    and they were roommates
  • Hard men make sore buttholes

  • Why Lemmy will fail... and is racist
  • “Joined 2 hours ago”

  • RedHat Isolate New Code Behind RHEL Subscription
  • You are correct, CentOS is still downstream from RHEL, whereas CentOS Stream is just ahead of RHEL.

  • FYI, lots of users are polling to defederate sh.itjust.works
  • I heard there is the option to enable captcha in the new 0.18 version, so there should be some protection soon.

    edit: I had it the wrong way around and the removed captcha in 0.18 to reimplement it in a future version

  • FYI, lots of users are polling to defederate sh.itjust.works
  • We already have some rules including a no bigotry rule

    No bigotry - including racism, sexism, ableism, homophobia, transphobia, or xenophobia.

    So I guess as long as they can follow that rule they can stay, but I doubt it.

  • RedHat Isolate New Code Behind RHEL Subscription
  • Luckily rocky linux will take it’s place downstream from RHEL also aiming for bug-for-bug compatibility. and with one the original creators behind it the future is looking solid. I’ve replaced our CentOS instances at work with rocky linux and it’s essentially the same.

    edit: I completely missed that RHEL is going closed source and thought this was about CentOS stream. This means rocky (or relatives) won’t actually be a solution for you as can only compile from the stream branch.

    Does IBM really have to ruin everything it touches?

  • How credible is this starship combat art?
  • Way too credible, the U.S. Space Force would like to know how you obtained these plans.

  • N0tTheBees N0tTheBees @sh.itjust.works
    Posts 5
    Comments 19