Skip to content

Instantly share code, notes, and snippets.

View b0o's full-sized avatar
👻

Maddison Hellstrom b0o

👻
View GitHub Profile
@b0o
b0o / test.lua
Last active April 19, 2024 06:40
local n = require 'nui-components'
local signal = n.create_signal {
name = '',
description = '',
}
local function test_ui()
local renderer = n.create_renderer {
width = 60,
Error executing Lua callback: ...nvim/nui-components.nvim/lua/nui-components/utils/fn.lua:18: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
...nvim/nui-components.nvim/lua/nui-components/utils/fn.lua:18: in function 'get_max_width'
...vim/nui-components.nvim/lua/nui-components/paragraph.lua:133: in function 'on_layout'
...ui-components.nvim/lua/nui-components/component/size.lua:208: in function 'get_size'
...ui-components.nvim/lua/nui-components/component/init.lua:358: in function 'render'
...ui-components.nvim/lua/nui-components/component/init.lua:346: in function 'func'
...nvim/nui-components.nvim/lua/nui-components/utils/fn.lua:19: in function 'ireduce'
...ui-components.nvim/lua/nui-components/component/init.lua:344: in function 'render'
@b0o
b0o / popup-detect.js
Last active March 21, 2024 01:12
Sway browser pop-up window float hack
// ==UserScript==
// @name Sway Popup Window Detector
// @namespace https://maddison.io/
// @version 0.1
// @description Detect "pop-up" windows because for some reason Wayland doesn't have a built-in way to do it??!
// @author Maddison Hellstrom <github.com/b0o>
// @include /^.*$/
// @grant none
// @run-at document-start
// ==/UserScript==
@b0o
b0o / surfingkeys.js
Last active February 20, 2024 20:50
Maddy's SurfingKeys Configuration (OUTDATED: See https://github.com/b0o/surfingkeys-conf)
// OUTDATED
// See the current version here:
// github.com/b0o/surfingkeys-conf
// Unmap undesired defaults
var unmaps = [ "sb" , "sw", "ob"
, "ow" , "cp", ";cp"
, ";ap", "spa", "spb"
, "spd", "sps", "spc"
, "spi", "sfr", "zQ"
@b0o
b0o / update
Last active February 7, 2024 07:19
Arch Linux update script which checks for Arch news, then updates the system via Yay or Pacman, plus support for updating user-space utilities such as NPM, Yarn, RubyGems, Cargo, and more.
#!/bin/bash
#
# Copyright (c) 2018 Maddison Hellstrom (github.com/b0o)
# Released under the MIT License
#
# Arch Linux update script which checks for Arch news, then updates the system
# via Yay or Pacman, with seamless support for updating user-space utilities
# such as NPM, Yarn, RubyGems, Cargo, and more. Plus it has pretty colors :)
#
# Screencast:
Outer
execve("/usr/bin/entr", ["entr", "bash", "./self-entr.sh", "--inner"], 0x7fff5e5a1088 /* 179 vars */) = 0
brk(NULL) = 0x563684b3a000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc98182a70) = -1 EINVAL (Invalid argument)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=322755, ...}, AT_EMPTY_PATH) = 0
mmap(NULL, 322755, PROT_READ, MAP_PRIVATE, 3, 0) = 0x14884d01e000
close(3) = 0
openat(AT_FDCWD, "/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
#!/usr/bin/env bash
if [[ ${1:-} == "--inner" ]]; then
echo "Inner"
exit 0
fi
echo "Outer"
echo "${BASH_SOURCE[0]}" | entr "${BASH_SOURCE[0]}" --inner
Dec 07 17:03:46 computer1 systemd[3951]: Started GnuPG cryptographic agent and passphrase cache.
Dec 07 17:03:46 computer1 gpg-agent[1740396]: gpg-agent (GnuPG) 2.4.3 starting in supervised mode.
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 3 for extra socket (/run/user/1000/gnupg/S.gpg-agent.extra)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 4 for browser socket (/run/user/1000/gnupg/S.gpg-agent.browser)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 5 for std socket (/run/user/1000/gnupg/S.gpg-agent)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: using fd 6 for ssh socket (/run/user/1000/gnupg/S.gpg-agent.ssh)
Dec 07 17:03:46 computer1 gpg-agent[1740396]: listening on: std=5 extra=3 browser=4 ssh=6
Dec 07 17:03:46 computer1 sway[4049]: 21:51:40.094 [DEBUG] [wlr] [types/wlr_text_input_v3.c:185] Text input commit received without focus
Dec 07 17:03:46 computer1 sway[4049]: 21:51:40.094 [DEBUG] [sway/input/text_input.c:159] Text input committed update
Dec 07 17:03:46 computer1 sway[
-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
@b0o
b0o / README.md
Last active December 3, 2023 00:56
LSP support in injected code blocks with Otter.nvim

LSP support in injected code blocks with Otter.nvim

Otter.nvim makes it possible to attach LSPs to embedded code blocks. For example, inside JavaScript/TypeScript files, you can use tagged template literals:

const frag = glsl`
void main() {
  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
`;