This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fd --type f -H --color=always | \ | |
rg -v '.git(\u001B\[[0-9;m]+)*/' $* | \ | |
fzf -e -m --ansi --preview 'bat --line-range 0:150 --tabs=4 -n --color=always {}' --preview-window='top:50%' --color="hl:51" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Data::TreeDumper ; | |
@a = (1, 3, 5, 6, 7, 8 ); | |
@b = ( 2, 3, 5, 7, 9); | |
# one loop | |
@union = @isect = @diff = (); | |
%union = %isect = %diff = (); | |
foreach $e (@a, @b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
# find which repositories have changes, input: lib local_commit repo_commit | |
while IFS=$'\t' read -r -a revs ; do [[ "${revs[1]}" == "${revs[2]}" ]] || changed[${revs[0]}]=1 ; done < revisions | |
# find what test they trigger, input: repo test1 test2 ... and tests list | |
while IFS=$'\t' read -r -a deps ; do ((changed[${deps[0]}])) && { printf "%s\n" "${deps[@]:1}" | grep -f tests ; } ; done < dependencies | |
# add previously failed tests, input: faile test1 tes2 ... | |
awk '{ OFS="\n" ; /failed/ ; $1="" }1' < status | |
} | sed '/^$/d' | sort -u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
bind -x '"'"\C-k"'":"set_command_cursor"' | |
set_command_cursor() | |
{ | |
local BACKSPACE=$(printf "0000000 005177\n0000002") | |
local TAB=$'\x09' | |
#local SHIFT_TAB=$(printf "????0000000 005033\n0000002") # todo: | |
#local SHIFT_TAB="$(echo -e '\e[Z')" #doesn'twork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
help_text=\ | |
"NAME | |
ir - create a temporary file structure and run a viewer | |
SYNOPSIS | |
ir | |
ir directory [directory ...] | |
non_interactive_commands_pipeline | ir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# prompt matching function for tmux | |
# it can be also defined elsewhere | |
if ! type -t __copy_app_match_my_prompt 1> /dev/null ; then | |
__copy_app_match_my_prompt() { printf '^(\\\\033\\[[^m]+m)?[[:digit:]]+\ ' ; } # the way it looks for me in a tmux buffer | |
fi | |
last_command() { history -p !! | perl -pe 's/^\s*[0-9]+\s*//' | tr -d '\n' ; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict ; | |
use warnings ; | |
# 256colors display index-rgb and small cubes | |
# 256colors index display system colors on background index | |
# 256colors R G B display system colors on background RGB | |
if(@ARGV == 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load docker completion | |
. /usr/share/bash-completion/completions/docker >/dev/null 2>&1 | |
alias d=docker | |
complete -F _docker d | |
# extract columns interactively | |
di() { _dcol 'image ls' 2 ; } | |
din() { _dcol 'image ls' 0 1 ; } | |
dc() { _dcol 'container ls' 1 ; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export bold='\e[01m' | |
export underlined='\e[04m' | |
export flashing='\e[05m' | |
export black='\e[30m' | |
export red='\e[31m' | |
export green='\e[32m' | |
export yellow='\e[33m' | |
export blue='\e[34m' | |
export magenta='\e[35m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict ; | |
use warnings ; | |
use Term::ANSIColor ; | |
if (grep {/^--help/} @ARGV) | |
{ | |
print <<'EOH' ; | |
Usage: $> command | color_pipe regex color [regex color ...] | command ... |