Skip to content

Instantly share code, notes, and snippets.

@tomaszkubacki
tomaszkubacki / keymaps.lua
Created October 1, 2025 15:55
Lazy vim keymaps.lua mapping to execute current line in terminal
-- Keymaps are automatically loaded on the VeryLazy event
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here
--
local map = LazyVim.safe_keymap_set
function execute_line()
-- Yank the current line into the default register
vim.cmd('normal! ""yy')
@tomaszkubacki
tomaszkubacki / yank_line_and_send_to_terminal.lua
Created September 9, 2025 05:24
Execute current line in neovim terminal (LazyVim)
local function yank_line_and_send_to_terminal()
-- Yank the current line into the default register
vim.cmd('normal! ""yy')
local text = vim.fn.getreg('"')
local snacks_terminal = require("snacks.terminal")
local terminal = snacks_terminal.get()
if not terminal then
terminal = snacks_terminal.open()
end
--- Feed keys into Neovim one by one, simulating a typewriter effect.
--- @param keys string The string to type.
--- @param mode string|nil Feedkeys mode (default "t")
--- @param escape_csi boolean|nil Escape CSI (default false)
--- @param delay_ms number|nil Delay between keystrokes in ms (default 100)
function typewriter(keys, mode, escape_csi, delay_ms)
mode = mode or "t"
escape_csi = escape_csi or false
delay_ms = delay_ms or 100
@tomaszkubacki
tomaszkubacki / dab
Created May 17, 2024 07:07
Repeat DLT
title: 'Event driven communication repeat and dlt'
boxes ids: 'component' 'repeat-0' at: [-6,0] size: [2,2] span: 1
box id: account text: 'account' size: [4,1] at: [0,-1] color: black
box id: user text: 'balance: 10' size: [4,2] color: black
line at: [-7,-1] end: [-1, -1] width: 2
line at: [-5,-1] end: [-5, 0] width: 2
line at: [-2,-1] end: [-2, 0] width: 2
box: 'event broker' at: [-7, -2] size: [3,1] color: white
dot id: ch1 at: [-8.5, -1.5] visible: false color: black
dot id: ch2 at: [-8.5, -1.5] visible: false color: black
@tomaszkubacki
tomaszkubacki / passclip
Created July 22, 2023 09:46
How to copy pass (passwordstore.org) result to clipbaord
#!/usr/bin/env bash
pass $1 | xclip -sel clip
@tomaszkubacki
tomaszkubacki / fix_touchoad_dell_latitude_5480.sh
Created July 11, 2023 06:36
Fix touchpad being frozen after wake up on Dell Latitude 5480 Ubuntu 23.04
#!/bin/sh
sudo /sbin/rmmod i2c_hid_acpi
sudo /sbin/modprobe i2c_hid_acpi
@tomaszkubacki
tomaszkubacki / docker-compose.yml
Created October 18, 2022 03:28
Simple Kafka test environment with AKHQ gui ready toconnect from localhost
version: "3"
services:
zookeeper:
image: 'bitnami/zookeeper:latest'
restart: always
ports:
- '2181:2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
@tomaszkubacki
tomaszkubacki / docker-compose.yml
Created October 4, 2022 17:46
live coding env linuxserver.io
version: "2.1"
services:
code-server:
image: lscr.io/linuxserver/code-server:latest
container_name: code-server
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Warsaw
- PASSWORD=MY_SECRET_PASSWORD
@tomaszkubacki
tomaszkubacki / fortivpn.sh
Created September 4, 2022 08:29
fortivpn config to add routes on start
#!/bin/sh -e
# create executable file at /etc/ppp/ip-up.d/openfortivpn (any name is allow ed, but do not end with .sh)
# pass routes to add via pppd-ipparam
# eg. put this into your openfortivpn config file:
# set-routes=0
# pppd-ipparam=192.168.77.209 192.168.77.233 192.168.77.205
logger "forticlient connection is up $PPP_IFACE connection ip routes: ${6}"
IPS="${6}"
@tomaszkubacki
tomaszkubacki / bashrc
Created March 26, 2020 13:04
xmodmap Remap Logitech mx keys DE version right control and right alt and left win with left alt
setxkbmap -option altwin:swap_lalt_lwin
xmodmap -e "clear mod4" && xmodmap -e "add mod4 = Super_L"
xmodmap -e "keycode 134 = ISO_Level3_Shift"
xmodmap -e "keycode 108 = Control_R"
xmodmap -e "remove Control = Control_R"
xmodmap -e "add Control = Control_R"