Skip to content

Instantly share code, notes, and snippets.

@ericbn
ericbn / github-actions-faster-python-virtual-environments.yml
Last active July 23, 2024 15:36
GitHub Actions: Faster Python runs with cached virtual environments
# See https://adamj.eu/tech/2023/11/02/github-actions-faster-python-virtual-environments/
# ...
jobs:
example:
# ...
steps:
# ...
# xterm on Android termux
TERM=xterm-256color
Wait for prompt before pressing each key.
Press SPACE to skip to the next key.
Don't press any key within 10 seconds to abort.
Ready [y/N]? y
) Started application mode
) F1: ^[OP
) F2: ^[OQ
) F3: ^[OR
getseq () {
trap "stty ${$(stty -g 2>/dev/null):-echo -raw}" 0 1 2 15
stty raw -echo
local k='' seq='' i
for ((i=10; i>0; --i)); do
read -t -k 1 k && break
sleep 1
done
[[ -n $k ]] || return 1
[[ $k = $'\012' || $k = $'\015' || $k = ' ' ]] && return 0
@ericbn
ericbn / .vimrc
Last active October 12, 2024 07:35
Vim Powerline-like status line without the need of any plugin
" Statusline (requires Powerline font)
set statusline=
set statusline+=%(%{&buflisted?bufnr('%'):''}\ \ %)
set statusline+=%< " Truncate line here
set statusline+=%f\ " File path, as typed or relative to current directory
set statusline+=%{&modified?'+\ ':''}
set statusline+=%{&readonly?'\ ':''}
set statusline+=%= " Separation point between left and right aligned items
set statusline+=\ %{&filetype!=#''?&filetype:'none'}
set statusline+=%(\ %{(&bomb\|\|&fileencoding!~#'^$\\\|utf-8'?'\ '.&fileencoding.(&bomb?'-bom':''):'')