Skip to content

Instantly share code, notes, and snippets.

@snippins
snippins / bashrc_remote
Last active January 19, 2025 06:32
remote configs
stty -ixon;
_sw_completions() {
if [ "${#COMP_WORDS[@]}" != "2" ]; then
return
fi
# keep the suggestions in a local variable
# readarray -t suggestions < <(ls -1d /home/*/ | sed 's/.$//' | cut -c 7-)
readarray -t suggestions < <(ls --color=never -1d /home/*/ | sed 's/.$//' | cut -c 7-)
@snippins
snippins / regex-emacs.diff
Last active December 2, 2024 19:27
Emacs 30 patch for regex lookaround - rev a8169bee2064282a40214ef65ef0493233ed4669 - 2024-12-01 master
diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 3bf3ad9..8bbfb78 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -44,6 +44,9 @@
#endif
#define RE_DUP_MAX (0xffff)
+#define PREV_CHAR_BOUNDARY(p, limit) ((p)--)
+#define STRING_CHAR_AND_LENGTH(p, actual_len) ((actual_len) = 1, *(p))
@snippins
snippins / nov-grep
Last active September 9, 2020 18:33
(require 'counsel)
(defun my-nov-find-id-of-file (filename)
(interactive)
(let ((i 0)
(dontbreak t))
(while (and (< i (length nov-documents))
dontbreak)
(setq i (1+ i))
(when (string-equal filename (cdr (aref nov-documents i)))
(setq dontbreak nil)
@snippins
snippins / surfingkeys.conf
Last active April 25, 2024 16:36
Surfing keys config
settings.smoothScroll = true;
Hints.characters = 'cefhijklmnopqrstuvwxz';
map('<Alt-g>', 'sg');
map('<Alt-i>', 'i');
map('<Alt-;>', 'v');
unmapAllExcept(['<Alt-;>', '/', '<Alt-g>', '<Alt-i>']);
settings.theme = `
@snippins
snippins / ff57-tabs-mousewheel.js
Created March 4, 2018 18:18 — forked from benoitryder/ff57-tabs-mousewheel.js
Change tabs with mousewheel in Firefox 57
// Change tabs with mousewheel
// Run into Browser Toolbox console
var onTabWheel = function(ev) {
if (ev.deltaMode == 1 /* DOM_DELTA_LINE */) {
var idx = gBrowser.tabContainer.getIndexOfItem(gBrowser.selectedTab);
if (ev.deltaY > 0) {
if (idx + 1 < gBrowser.tabs.length) {
gBrowser.selectTabAtIndex(idx + 1);
}
#!/usr/bin/python3
from __future__ import print_function
import re
import signal
import subprocess
import sys
import psutil
from gi.repository import Gio, Gtk, GLib
@snippins
snippins / HUD.py
Last active October 2, 2020 16:01
HUD Menu
#!/usr/bin/python3
import gi
gi.require_version("Gtk", "3.0")
import configparser
import dbus
import dbus.service
import logging
import os