several updates

This commit is contained in:
Felix Van der Jeugt 2024-08-02 11:37:09 +02:00
parent dac9f903c9
commit 4bc4e5b8ad
11 changed files with 91 additions and 161 deletions

View File

@ -7,7 +7,7 @@
[merge] [merge]
conflictstyle = diff3 conflictstyle = diff3
[push] [push]
default = simple default = current
followTags = true followTags = true
[gpg] [gpg]
program = gpg program = gpg
@ -18,11 +18,18 @@
[alias] [alias]
pf = push --force-with-lease pf = push --force-with-lease
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ff = merge --ff-only @{upstream} ff = merge --ff-only
jn = merge --no-ff --log --edit jn = merge --no-ff --log --edit
s = status -vv s = status -vv
ce = commit -m '' --allow-empty-message ce = commit -m '' --allow-empty-message
ap = add -p
claim = blame -M -C -C -C
nuke = !git rm --cached -r . && git reset --hard
[rebase] [rebase]
autoSquash = true autoSquash = true
[rerere] [rerere]
enabled = true enabled = true
[core]
hooksPath = /home/ninewise/.config/git/hooks
[init]
defaultBranch = development

View File

@ -1,3 +1,2 @@
audio_cache = false audio_cache = false
gapless = true gapless = true
audio_backend = "pipe"

View File

@ -7,6 +7,7 @@ config.backend = "webengine"
config.load_autoconfig(False) config.load_autoconfig(False)
c.completion.shrink = True c.completion.shrink = True
c.confirm_quit = ["downloads"] c.confirm_quit = ["downloads"]
c.content.notifications.enabled = False
c.downloads.location.directory = "/tmp" c.downloads.location.directory = "/tmp"
c.downloads.location.suggestion = "both" c.downloads.location.suggestion = "both"
c.downloads.open_dispatcher = "rifle" c.downloads.open_dispatcher = "rifle"
@ -22,8 +23,8 @@ c.session.default_name = "default"
c.tabs.background = True c.tabs.background = True
c.tabs.last_close = "close" c.tabs.last_close = "close"
c.tabs.show = "multiple" c.tabs.show = "multiple"
c.tabs.favicons.show = "never" c.tabs.favicons.show = "pinned"
c.url.default_page = "about:blank" c.url.default_page = "qute://bookmarks"
c.url.start_pages = ["qute://bookmarks"] c.url.start_pages = ["qute://bookmarks"]
c.url.searchengines = { "startpage": "https://startpage.com/do/search?query={}" c.url.searchengines = { "startpage": "https://startpage.com/do/search?query={}"
, "ecosia": "https://www.ecosia.org/search?q={}" , "ecosia": "https://www.ecosia.org/search?q={}"

View File

@ -1,110 +0,0 @@
-- Copyright 2006-2017 Mitchell mitchell.att.foicica.com. See LICENSE.
-- Markdown LPeg lexer.
local l = require('lexer')
local token, word_match = l.token, l.word_match
local P, R, S = lpeg.P, lpeg.R, lpeg.S
local M = {_NAME = 'markdown'}
-- Whitespace.
local ws = token(l.WHITESPACE, l.space^1)
-- Block elements.
local header = token('h6', l.starts_line('######') * l.nonnewline^0) +
token('h5', l.starts_line('#####') * l.nonnewline^0) +
token('h4', l.starts_line('####') * l.nonnewline^0) +
token('h3', l.starts_line('###') * l.nonnewline^0) +
token('h2', l.starts_line('##') * l.nonnewline^0) +
token('h1', l.starts_line('#') * l.nonnewline^0)
local blockquote = token(l.STRING,
lpeg.Cmt(l.starts_line(S(' \t')^0 * '>'),
function(input, index)
local _, e = input:find('\n[ \t]*\r?\n',
index)
return (e or #input) + 1
end))
local blockcode = token('code', l.starts_line(P(' ')^4 + P('\t')) * -P('<') *
l.nonnewline^0)
local hr = token('hr', lpeg.Cmt(l.starts_line(S(' \t')^0 * lpeg.C(S('*-_'))),
function(input, index, c)
local line = input:match('[^\n]*', index)
line = line:gsub('[ \t]', '')
if line:find('[^'..c..']') or #line < 2 then
return nil
end
return (input:find('\n', index) or #input) + 1
end))
-- Span elements.
local dq_str = token(l.STRING, l.range('"', false, true))
local sq_str = token(l.STRING, l.range("'", false, true))
local paren_str = token(l.STRING, l.range('()'))
local link = token('link', P('!')^-1 * l.range('[]') *
(P('(') * (l.any - S(') \t'))^0 *
(S(' \t')^1 *
l.range('"', false, true))^-1 * ')' +
S(' \t')^0 * l.range('[]')) +
P('http://') * (l.any - l.space)^1)
local link_label = token('link_label', l.range('[]') * ':') * ws *
token('link_url', (l.any - l.space)^1) *
(ws * (dq_str + sq_str + paren_str))^-1
local strong = token('strong', (P('**') * (l.any - '**')^0 * P('**')^-1) +
(P('__') * (l.any - '__')^0 * P('__')^-1))
local em = token('em',
l.range('*', true) + l.range('_', true))
local code = token('code', (P('``') * (l.any - '``')^0 * P('``')^-1) +
l.range('`', true, true))
local escape = token(l.DEFAULT, P('\\') * 1)
local list = token('list',
l.starts_line(S(' \t')^0 * (S('*+-') + R('09')^1 * '.')) *
S(' \t'))
M._rules = {
{'header', header},
{'blockquote', blockquote},
{'blockcode', blockcode},
{'hr', hr},
{'list', list},
{'whitespace', ws},
{'link_label', link_label},
{'escape', escape},
{'link', link},
{'strong', strong},
{'em', em},
{'code', code},
}
local font_size = 10
local hstyle = 'fore:red'
M._tokenstyles = {
h6 = hstyle,
h5 = hstyle..',size:'..(font_size + 1),
h4 = hstyle..',size:'..(font_size + 2),
h3 = hstyle..',size:'..(font_size + 3),
h2 = hstyle..',size:'..(font_size + 4),
h1 = hstyle..',size:'..(font_size + 5),
-- code = l.STYLE_EMBEDDED..',eolfilled',
code = 'fore:blue'..',eolfilled',
hr = l.STYLE_DEFAULT..',bold',
link = 'underlined',
link_url = 'underlined',
link_label = l.STYLE_LABEL,
strong = 'bold',
em = 'italics',
list = l.STYLE_CONSTANT,
}
-- Embedded HTML.
local html = l.load('html')
local start_rule = token('tag', l.starts_line(S(' \t')^0 * '<'))
local end_rule = token(l.DEFAULT, P('\n')) -- TODO: l.WHITESPACE causes errors
l.embed_lexer(M, html, start_rule, end_rule)
return M

View File

@ -5,30 +5,43 @@
require('vis') require('vis')
require('plugins/complete-word') require('plugins/complete-word')
require('plugins/myfiletype') require('plugins/myfiletype')
require('plugins/editorconfig/editorconfig') require('plugins/editorconfig')
vis.events.subscribe(vis.events.INIT, function() vis.events.subscribe(vis.events.INIT, function()
-- Your global configuration options -- Your global configuration options
vis:command('set escdelay 0') vis:command('set escdelay 0')
vis:command('set tabwidth 4')
vis:command('set autoindent on') vis:command('set autoindent on')
vis:command('set theme dark-16') vis:command('set theme base-16')
end) end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win) vis.events.subscribe(vis.events.WIN_OPEN, function(win)
-- Your per window configuration options -- Your per window configuration options
vis:command('set show-tabs on') vis:command('set tabwidth 4')
vis:command('set showtabs on')
vis:command('set number') vis:command('set number')
end) end)
vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, path) vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win)
if file.size ~= 0 and file:content(file.size - 1, 1) ~= "\n" then if win.file.path and win.file.path:match('.*%.tsx') then
file:insert(file.size, "\n") win:set_syntax('javascript')
end end
return true
end) end)
vis:map(vis.modes.NORMAL, ";;", "<vis-window-next>") vis:map(vis.modes.NORMAL, ";;", "<vis-window-next>")
vis:map(vis.modes.NORMAL, '<C-o>', '<vis-window-next>')
--------------------------------------------------------------------------------
-- Activate open-file-on-enter mode in this window
vis:map(vis.modes.NORMAL, ";e", function()
vis.win:map(vis.modes.NORMAL, "<Enter>", function()
local line = vis.win.file.lines[vis.win.selection.line]
local filename = string.find(line, ':')
local linenumber = string.find(line, ':', filename + 1)
local column = string.find(line, ':', linenumber + 1)
vis:command(string.format('open "%s"', string.sub(line, 0, filename - 1)))
vis.win.selection:to(tonumber(string.sub(line, filename + 1, linenumber - 1)), tonumber(string.sub(line, linenumber + 1, column - 1)))
end)
end)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Escape removes counts -- Escape removes counts
@ -41,15 +54,6 @@ vis:map(vis.modes.NORMAL, "<Escape>", function()
end end
end) end)
--------------------------------------------------------------------------------
-- Fancy cd
vis:command_register("rcd", function(argv, force, cur_win, selection, range)
handle = io.popen('f=$(mktemp); st -e ranger --choosedir="$f" --show-only-dirs; cat "$f"')
local output = handle:read()
handle:close()
vis:command('cd '..output)
end)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Fuzzy search filenames to open files -- Fuzzy search filenames to open files
@ -90,12 +94,13 @@ end, 'fuzzy line copy')
-- Fuzzy search lines to open files -- Fuzzy search lines to open files
vis:command_register("rg", function(argv, force, cur_win, selection, range) vis:command_register("rg", function(argv, force, cur_win, selection, range)
local out = io.popen("sk --ansi -i -c 'rg --color=always --line-number "..'"{}"'.."'"):read() local out = io.popen("sk --ansi -i -c 'rg --color=always --line-number --column --colors column:fg:green "..'"{}"'.."'"):read()
if out then if out then
local filename = string.find(out, ':') local filename = string.find(out, ':')
local linenumber = string.find(out, ':', filename + 1) local linenumber = string.find(out, ':', filename + 1)
local column = string.find(out, ':', linenumber + 1)
vis:command(string.format(argv[1]..' "%s"', string.sub(out, 0, filename - 1))) vis:command(string.format(argv[1]..' "%s"', string.sub(out, 0, filename - 1)))
vis.win.selection:to(tonumber(string.sub(out, filename + 1, linenumber - 1)), 0) vis.win.selection:to(tonumber(string.sub(out, filename + 1, linenumber - 1)), tonumber(string.sub(out, linenumber + 1, column - 1)))
vis:feedkeys("<vis-redraw>") vis:feedkeys("<vis-redraw>")
end end
end, 'fuzzy grep open') end, 'fuzzy grep open')
@ -198,3 +203,30 @@ vis:command_register("sts", function(argv, force, win, selection, range)
end end
return true return true
end, "Strip line trailing spaces") end, "Strip line trailing spaces")
--------------------------------------------------------------------------------
-- Git
git_commands = {
["add"] = function(argv, force, win, selection, range)
local output = io.popen('git add ' .. vis.win.file.path):read()
if (output) then
vis:message(output)
end
end,
["status"] = function(argv, force, win, selection, range)
local output = io.popen('git status'):read()
if (output) then
vis:message(output)
end
end,
}
vis:command_register("git", function(argv, force, win, selection, range)
local command = git_commands[argv[1]]
if (command) then
command(argv, force, win, selection, range)
else
vis:message("Unknown git command")
end
end, "Git commands")

11
local/bin/.gitignore vendored
View File

@ -2,14 +2,22 @@
# Some actual binary files # Some actual binary files
alot alot
cabal cabal
chardetect
clirail
ctags ctags
dl_lines
dl_lines_colours
dl_stops
dl_stops_geojson
dmenu dmenu
dmenu_path dmenu_path
dmenu_run dmenu_run
drank
dvtm* dvtm*
dwm dwm
flask flask
ghc ghc
ghdl
gloss-juicy-viewer gloss-juicy-viewer
hledger hledger
hlint hlint
@ -18,6 +26,7 @@ jshon
khal khal
khald khald
mfauth mfauth
mmemoji
notmuch notmuch
qmk qmk
qutebrowser qutebrowser
@ -28,6 +37,7 @@ shelltest
shelltest shelltest
snakeviz snakeviz
snakeviz snakeviz
soup
st st
stest stest
stylish-haskell stylish-haskell
@ -35,6 +45,7 @@ tox
tox-quickstart tox-quickstart
unlit unlit
unpar unpar
vdirsyncer
vis vis
vis-* vis-*
wjt wjt

View File

@ -1 +0,0 @@
gitfetcher

View File

@ -1,22 +1,9 @@
#!/bin/sh #!/bin/sh
mac="${1:?Provide mac address as first argument}"
# Reading our private mac name="${2:-macvlan9000}"
here="$(dirname "$0")"
mac="${1:-$(cat "$here/macaddress")}"
enp="$(basename /sys/class/net/enp*)" enp="$(basename /sys/class/net/enp*)"
wlp="$(basename /sys/class/net/wlp*)"
# Setting the MAC address for our wired sudo ip link add link "$enp" address "$mac" name "$name" type macvlan
sudo ip link set "$enp" down /bin/sh
sudo ip link set "$enp" address "$mac" sudo ip link del "$name"
sudo ip link set "$enp" up
# No more wireless
if [ -e /var/service/iwd ]; then
sudo sv stop /var/service/iwd
sudo ip link set "$wlp" down
fi
# Restart tor on network change
sudo sv restart tor

View File

@ -3,8 +3,8 @@
from youtube_search import YoutubeSearch # pip install youtube-search from youtube_search import YoutubeSearch # pip install youtube-search
from sys import argv from sys import argv
for result in YoutubeSearch(' '.join(argv[1:])).to_dict(): for result in reversed(YoutubeSearch(' '.join(argv[1:])).to_dict()):
print(result['duration'], print(result['duration'],
f"https://www.youtube.com{result['url_suffix']}", f"https://www.youtube.com{result['url_suffix'].split('&')[0]}",
f"{result['title']} -- {result['channel']}", f"{result['title']} -- {result['channel']}",
sep='\t') sep='\t')

View File

@ -14,6 +14,12 @@ ip route ls | grep -q '.'
# check if the gpg-agent is running # check if the gpg-agent is running
pgrep gpg-agent > /dev/null pgrep gpg-agent > /dev/null
# Don't sync mails while composing
! pgrep -f mcom > /dev/null
! pgrep -f mfwd > /dev/null
! pgrep -f mbnc > /dev/null
! pgrep -f mrep > /dev/null
# Sync email # Sync email
mbsync -a -q || true mbsync -a -q || true

10
zshrc
View File

@ -69,9 +69,7 @@ alias minbox="mdirs /data/mail | mlist -ndt | mpick -t 'flagged || ! seen' | mso
export MBLAZE_PAGER='less -RF' export MBLAZE_PAGER='less -RF'
# There is only one vis # There is only one vis
alias vim="vis"
alias vi="vis" alias vi="vis"
alias nano="vis"
# Ready for ssh'ing # Ready for ssh'ing
alias agent='eval "$(ssh-agent)" && ssh-add' alias agent='eval "$(ssh-agent)" && ssh-add'
@ -79,12 +77,12 @@ alias unlock='gpg-connect-agent <<<bye'
alias weechat="ssh -t weechat@Hetzner ./weechat.sh" alias weechat="ssh -t weechat@Hetzner ./weechat.sh"
function agenda() { agenda() {
khal calendar --format '{calendar-color}{cancelled}{start-end-time-style}{repeat-symbol} {title}{reset}' ${@:-today 2d} khal calendar --format '{calendar-color}{cancelled}{start-end-time-style}{repeat-symbol} {title}{reset}' ${@:-now 2d}
} }
function magnet() { magnet() {
ssh Tumbrel "transmission-remote --add '$(xclip -o -sel c)'" ssh Tumbrel "transmission-remote --add '$(xclip -sel c -o)'"
} }
# Ledger # Ledger