Skip to content

Instantly share code, notes, and snippets.

View folke's full-sized avatar
🌴
On vacation soon

Folke Lemaitre folke

🌴
On vacation soon
View GitHub Profile
// eslint-disable-next-line import/no-commonjs
var assert = require('assert');
function starRegex(pattern: string) {
return RegExp(
pattern
.split('.')
.map(x => {
if (x === '**') return '[a-zA-Z\\.]*';
if (x.includes('**'))
@folke
folke / apropos.fish
Created October 1, 2020 12:34
Using `apropos` on macos rebuilds the whatis database every time. Fish shell uses apropos for command completion.
# Fixes extremely slow apropos command on macos
# Using `apropos` on macos rebuilds the whatis database every time.
# Fish shell uses apropos for command completion.
# Simply add the file below to `~/.config/fish/conf.d` to fix the issue
set db ~/.whatis.db
function apropos_update
echo "Updating apropos / whatis database at $db"
man --path | tr ":" " " | xargs /usr/libexec/makewhatis -o $db
@folke
folke / lua-lsp.lua
Last active March 7, 2023 19:17
Correct sumneko lua lsp setup for init.lua and plugin development
-- put this file somewhere in your nvim config, like: ~/.config/nvim/lua/config/lua-lsp.lua
-- usage: require'lspconfig'.sumneko_lua.setup(require("config.lua-lsp"))
local library = {}
local path = vim.split(package.path, ";")
-- this is the ONLY correct way to setup your path
table.insert(path, "lua/?.lua")
table.insert(path, "lua/?/init.lua")
@folke
folke / quake.sh
Created January 26, 2023 20:59
Hyprland Quake Mode
#!/bin/env bash
WORKSPACE=$(hyprctl clients -j | jq -rec '.[] | select(.class == "quake") | .workspace .name')
if [ -z "$WORKSPACE" ]; then
echo "start"
hyprctl dispatch -- exec wezterm --config window_background_opacity=0.9 start --class quake
elif [ "$WORKSPACE" == "special" ]; then
echo "show"
hyprctl dispatch movetoworkspace "1,^(quake)\$"