Skip to content

Instantly share code, notes, and snippets.

View iamFIREcracker's full-sized avatar

Matteo Landi iamFIREcracker

View GitHub Profile
@iamFIREcracker
iamFIREcracker / _readme.md
Created January 10, 2025 11:55 — forked from mislav/_readme.md
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@iamFIREcracker
iamFIREcracker / download
Created November 16, 2024 14:06 — forked from evanrelf/download
Offline Advent of Code
#!/usr/bin/env bash
set -Eeuo pipefail
IFS=$'\n\t'
if [ "$#" -ne 1 ]; then
echo "usage: ./download <year>" >&2
exit 1
fi
@iamFIREcracker
iamFIREcracker / xterm-bg.sh
Created September 5, 2024 07:02 — forked from blueyed/xterm-bg.sh
Query background setting from terminal (xterm / rxvt-unicode)
#!/bin/sh
#
# Query a property from the terminal, e.g. background color.
#
# XTerm Operating System Commands
# "ESC ] Ps;Pt ST"
oldstty=$(stty -g)
# What to query?
@iamFIREcracker
iamFIREcracker / index.js
Created August 28, 2024 10:27 — forked from w33ble/index.js
native promise mapSeries implementation
function mapSeries(arr) {
if (!Array.isArray(arr)) throw new Error('mapSeries requires an Array');
const length = arr.length;
const results = new Array(length);
arr.reduce((chain, item, i) => {
return chain.then(() => item).then(val => results[i] = val);
}, Promise.resolve())
.then(() => results);
}
@iamFIREcracker
iamFIREcracker / linux-setup.sh
Created March 27, 2024 13:55 — forked from dhh/linux-setup.sh
linux-setup.sh
# CLI
sudo apt update
sudp apt install \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev libsqlite3-0 \
redis-server mysql-server sqlite3 libmysqlclient-dev apache2-utils \
rbenv
@iamFIREcracker
iamFIREcracker / path.md
Created February 10, 2024 15:38 — forked from romainl/path.md
Off the beaten path

Off the beaten path

What is &path used for?

Vim uses :help 'path' to define the root directories from where to search non-recursively for files.

It is used for:

  • gf, gF, <C-w>f, <C-w>F, <C-w>gf, <C-w>gF,
  • :find, :sfind, :tabfind,
#!/usr/bin/env bash
# Utility script which creates and display a QR code with the content of
# positional arguments or with everything stored within the WM clipboard.
#
# Depends on xclip, curl and xdg-open
set -e
TEMP=""
@iamFIREcracker
iamFIREcracker / browser
Created October 28, 2012 10:59 — forked from defunkt/browser
pipe html to a browser
#!/bin/bash -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo '<h1>hi mom!</h1>' | browser
# $ ron -5 man/rip.5.ron | browser
OPEN=xdg-open
if [ -t 0 ]; then