Merge remote-tracking branch 'origin/master'

This commit is contained in:
Geoffrey Frogeye 2022-12-24 15:37:37 +01:00
commit 59181b2772
23 changed files with 149 additions and 63 deletions

View file

@ -4,6 +4,7 @@ dev_stuffs:
- ansible
- docker
- network
- perl
- php
- python
- shell

View file

@ -4,9 +4,11 @@ dev_stuffs:
- shell
- network
- ansible
- perl
- python
extensions:
- gh
x11_screens:
- HDMI-1
- HDMI-2
base16_scheme: solarized-light

View file

@ -55,6 +55,7 @@
register: base16_schemes
tags:
- color
- i3
- name: Configure Alacritty
template:
@ -106,6 +107,7 @@
- i3-reload
tags:
- color
- i3
when: display_server == 'x11'
- name: Set base16 theme for rofi

View file

@ -1,3 +1,4 @@
ansible
ansible-lint
ansible-language-server
{# EOF #}

View file

@ -0,0 +1,3 @@
{% if arch_based %}
perl-perl-languageserver
{% endif %}

View file

@ -1,5 +1,5 @@
Section "Device"
Identifier "intel"
Identifier "Intel Graphics"
Driver "intel"
Option "Backlight" "intel_backlight"
EndSection

View file

@ -39,3 +39,8 @@
debug:
msg: "The Panfrost display driver configuration was changed, but needs a reboot to be applied."
listen: panfrost config changed
- name: Reload systemd-logind
command: systemctl kill -s HUP systemd-logind
become: yes
listen: systemd-logind config changed

View file

@ -356,6 +356,19 @@
- etc changed
- systemd changed
- name: Disable power button
lineinfile:
path: /etc/systemd/logind.conf
line: 'HandlePowerKey=ignore'
regexp: '^#? *HandlePowerKey='
insertafter: '^\[Login\]$'
become: yes
notify: systemd-logind config changed
# Reason: I sometimes press it accidentally
# (hoping to start it when it's already started,
# or really accidentally on the Pinebook).
# Suspend would be nice, but it doesn't have the locker then
# TODO Hibernation, if that's relevant
# $ sudo blkid | grep 'TYPE="swap"'
# $ sudoedit /etc/default/grub

View file

@ -3,44 +3,49 @@
lua << EOF
local nvim_lsp = require('lspconfig')
-- Mappings.
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[e', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']e', vim.diagnostic.goto_next, opts)
-- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
--Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
-- See `:help vim.lsp.*` for documentation on any of the below functions
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
-- buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-S-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
-- buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
-- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[e', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']e', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
-- buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
buf_set_keymap("v", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR><Esc>", opts)
local bufopts = { noremap=true, silent=true, buffer=bufnr }
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
-- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', '<C-S-k>', vim.lsp.buf.signature_help, bufopts)
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
vim.keymap.set('n', '<space>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, bufopts)
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
-- vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
-- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
end
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
local servers = {
{% if 'ansible' in dev_stuffs %}
"ansiblels",
{% endif %}
{% if 'perl' in dev_stuffs %}
"perlls",
{% endif %}
{% if 'python' in dev_stuffs %}
"pylsp",
{% endif %}
@ -56,7 +61,6 @@ for _, lsp in ipairs(servers) do
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}
end

View file

@ -23,6 +23,7 @@ vnoremap ga <cmd>Telescope lsp_range_code_actions<cr>
noremap ge <cmd>Telescope lsp_document_diagnostics<cr>
noremap gE <cmd>Telescope lsp_workspace_diagnostics<cr>
noremap gd <cmd>Telescope lsp_definitions<cr>
noremap gs <cmd>Telescope lsp_document_symbols<cr>
lua << EOF
require('telescope').setup{

View file

@ -5,7 +5,44 @@
#}
lua <<EOF
require'nvim-treesitter.configs'.setup {
ensure_installed = "maintained",
ensure_installed = {
"bash",
"bibtex",
"c",
"cmake",
"comment",
"cpp",
"css",
"diff",
"dockerfile",
"dot",
"git_rebase",
"gitattributes",
"gitignore",
"go",
"help",
"html",
"http",
"java",
"javascript",
"json",
"latex",
"llvm",
"lua",
"make",
"markdown",
"markdown_inline",
"perl",
"php",
"python",
"regex",
"ruby",
"scss",
"sql",
"verilog",
"vim",
"yaml",
},
ignore_install = {},
highlight = {
enable = true,

View file

@ -24,3 +24,9 @@ fi
feh --no-fehbg --bg-fill "$filepath"
# Make i3 distribute the workspaces on all screens
monitors_json="$(xrandr --listmonitors | tail -n+2 | awk '{ print $4 }' | sed 's|.\+|"\0"|' | tr '\n' ',')"
automatrop -e '{"x11_screens":['"$monitors_json"']}' --tags i3
# TODO Make sure it goes from left to right
# Either with the "main" display or using the geometry data

View file

@ -50,7 +50,7 @@ bindsym $mod+Shift+d exec --no-startup-id rofi -modi drun -show drun
# Start Applications
# bindsym $mod+Return exec urxvtc
bindsym $mod+Return exec alacritty -e zsh
bindsym $mod+Return exec ~/.config/i3/terminal
bindsym $mod+Shift+Return exec urxvt
bindsym $mod+p exec thunar
bindsym $mod+m exec qutebrowser --override-restore --backend=webengine

3
config/i3/terminal Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
alacritty msg create-window || exec alacritty -e zsh

View file

@ -19,7 +19,7 @@ chmod 700 "$BASEDIR"
name_base64="$(echo "$name" | base64)"
file="${BASEDIR}/${name_base64}"
if [ ! -f "${file}" ]
if [ ! -s "${file}" ]
then
notify-send -u low "cached_pass" "Asking to cache: ${name}"
pass ${name} > "${file}"

View file

@ -67,8 +67,8 @@ def main(args: argparse.Namespace) -> None:
new_filename = (
f"{m['Y']}-{m['M']}-{m['D']}_"
f"{m['h']}-{m['m']}-{m['s']}"
f"{m.get('dup', '')}"
f"{m.get('spec', '')}"
f"{m.get('dup') or ''}"
f"{m.get('spec') or ''}"
f"{args.suffix}"
f".{m['ext']}"
)

View file

@ -1,7 +1,10 @@
#!/usr/bin/env bash
# TODO De-hardcode
echo 3000 | sudo tee /sys/class/backlight/edp-backlight/brightness
xrandr --output DP-1 --brightness 1
if [ "$(cat /etc/hostname)" = "curacao.geoffrey.frogeye.fr" ]
then
echo 10000 | sudo tee /sys/class/backlight/intel_backlight/brightness
elif [ "$(cat /etc/hostname)" = "pindakaas.geoffrey.frogeye.fr" ]
then
echo 3000 | sudo tee /sys/class/backlight/edp-backlight/brightness
fi
automatrop -e base16_scheme=solarized-dark --tags color

View file

@ -1,7 +1,10 @@
#!/usr/bin/env bash
# TODO De-hardcode
echo 3500 | sudo tee /sys/class/backlight/edp-backlight/brightness
xrandr --output DP-1 --brightness 1
if [ "$(cat /etc/hostname)" = "curacao.geoffrey.frogeye.fr" ]
then
echo 40000 | sudo tee /sys/class/backlight/intel_backlight/brightness
elif [ "$(cat /etc/hostname)" = "pindakaas.geoffrey.frogeye.fr" ]
then
echo 3500 | sudo tee /sys/class/backlight/edp-backlight/brightness
fi
automatrop -e base16_scheme=solarized-light --tags color

View file

@ -1,7 +1,10 @@
#!/usr/bin/env bash
# TODO De-hardcode
echo 700 | sudo tee /sys/class/backlight/edp-backlight/brightness
xrandr --output DP-1 --brightness 0.5
if [ "$(cat /etc/hostname)" = "curacao.geoffrey.frogeye.fr" ]
then
echo 1 | sudo tee /sys/class/backlight/intel_backlight/brightness
elif [ "$(cat /etc/hostname)" = "pindakaas.geoffrey.frogeye.fr" ]
then
echo 700 | sudo tee /sys/class/backlight/edp-backlight/brightness
fi
automatrop -e base16_scheme=solarized-dark --tags color

View file

@ -9,7 +9,6 @@ import typing
import coloredlogs
import exifread
import progressbar
log = logging.getLogger(__name__)
coloredlogs.install(level="DEBUG", fmt="%(levelname)s %(message)s", logger=log)
@ -38,12 +37,7 @@ def main(args: argparse.Namespace) -> None:
log.warning("Counting files...")
kwargs = {"directory": args.dir, "skip_renamed": args.skip_renamed}
log.warning("Processing files...")
if args.hide_bar:
iterator = get_pictures(**kwargs)
else:
nb_imgs = len(list(get_pictures(**kwargs)))
iterator = progressbar.progressbar(get_pictures(**kwargs), max_value=nb_imgs)
for full_path in iterator:
for full_path in get_pictures(**kwargs):
# Find date
with open(full_path, 'rb') as fd:
exif_data = exifread.process_file(fd)
@ -62,7 +56,7 @@ def main(args: argparse.Namespace) -> None:
ext = os.path.splitext(full_path)[1].lower()
if ext == '.jpeg':
ext = '.jpg'
new_name = date.isoformat().replace(":", "-").replace("T", "_")
new_name = date.isoformat().replace(":", "-").replace("T", "_") + args.suffix
# First substitution is to allow images being sent to a NTFS filesystem
# Second substitution is for esthetics
new_path = os.path.join(args.dir, f"{new_name}{ext}")
@ -71,7 +65,7 @@ def main(args: argparse.Namespace) -> None:
while os.path.exists(new_path):
if full_path == new_path:
break
log.debug(f"{full_path} already exists, incrementing")
log.debug(f"{new_path} already exists, incrementing")
i += 1
new_path = os.path.join(args.dir, f"{new_name}_{i}{ext}")
@ -103,16 +97,16 @@ if __name__ == "__main__":
help="Do not actually rename, just show old and new path",
)
parser.add_argument(
"-s",
"-r",
"--skip-renamed",
action="store_true",
help="Skip images whose filename doesn't match usual camera output filenames.",
)
parser.add_argument(
"-b",
"--hide-bar",
action="store_true",
help="Do not show a progress bar. Also skip counting images",
"-s",
"--suffix",
default="",
help="Text to add before the extension",
)
args = parser.parse_args()
main(args)

View file

@ -148,7 +148,12 @@ class RVElement:
@property
def date(self) -> datetime.datetime:
return datetime.datetime.fromtimestamp(self.item["published"])
timestamp = (
int(self.item.get("timestampUsec", "0")) / 1000000
or int(self.item.get("crawlTimeMsec", "0")) / 1000
or self.item["published"]
)
return datetime.datetime.fromtimestamp(timestamp)
@property
def is_researched(self) -> bool:
@ -475,7 +480,7 @@ class RVDatabase:
def ytdl_opts(self) -> dict:
# Get user/system options
prev_argv = sys.argv
sys.argv = ['yt-dlp']
sys.argv = ["yt-dlp"]
_, _, _, ydl_opts = yt_dlp.parse_options()
sys.argv = prev_argv
return ydl_opts

View file

@ -31,7 +31,7 @@ alias please=sudo
alias ll="ls -l"
alias la="ls -la"
alias s='sudo -s -E'
alias n='alacritty & disown'
alias n='$HOME/.config/i3/terminal & disown'
alias x='startx $HOME/.config/xinitrc; logout'
alias nx='nvidia-xrun $HOME/.config/xinitrc; sudo systemctl start nvidia-xrun-pm; logout'