Compare commits

...

11 Commits

19 changed files with 141 additions and 54 deletions

View File

@ -6,6 +6,7 @@ dev_stuffs:
- network
- ansible
- docker
- php
software_full: yes
has_battery: yes
auto_numlock: yes

View File

@ -67,6 +67,14 @@
become: yes
when: arch_based
- name: Enable makepkg color
replace:
path: /etc/makepkg.conf
regexp: '^BUILDENV=(.+)!color(.+)$'
replace: 'BUILDENV=\1color\2'
become: yes
when: arch_based
- name: Enable makepkg ccache
replace:
path: /etc/makepkg.conf
@ -75,6 +83,24 @@
become: yes
when: arch_based
- name: Remove -mtune from makepkg CFLAGS
replace:
path: /etc/makepkg.conf
regexp: '^#? *CFLAGS=(.+)-mtune=\S+\s(.*)$'
replace: "CFLAGS=\\1\\2"
become: yes
when: arch_based
tags: g
- name: Change -march to native from makepkg CFLAGS
replace:
path: /etc/makepkg.conf
regexp: '^#? *CFLAGS=(.+)-march=\S+(\s)(.*)$'
replace: "CFLAGS=\\1-march=native\\2\\3"
become: yes
when: arch_based
tags: g
- name: Set makepkg MAKEFLAGS
replace:
path: /etc/makepkg.conf
@ -85,14 +111,6 @@
j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}"
when: arch_based
- name: Enable makepkg color
replace:
path: /etc/makepkg.conf
regexp: '^BUILDENV=(.+)!color(.+)$'
replace: 'BUILDENV=\1color\2'
become: yes
when: arch_based
- name: Enable pacman ParallelDownloads
lineinfile:
path: /etc/pacman.conf
@ -161,6 +179,9 @@
notify: "software changed"
tags: softwarelist
- debug:
msg: "{{ packages }}"
- name: Install packages (Arch-based)
aur:
name: "{{ packages }}"

View File

@ -11,3 +11,4 @@ highlight
{% endif %}
{# For nvim's :Telescope live_grep #}
ripgrep
{# EOF #}

View File

@ -0,0 +1 @@
{# EOF #}

View File

@ -1,9 +1,10 @@
mypy
{% if not arch_based %}
black
{# On arch it's installed as a dependency, also it's called python-black #}
{% endif %}
{% if arch_based %}
python-language-server
pyls-mypy
python-language-server-black
python-lsp-server
python-mypy-ls
python-lsp-black
{% endif %}

View File

@ -6,3 +6,10 @@ Section "InputClass"
Option "StartKeysEnabled" "False" #Disable mouse
Option "StartMouseEnabled" "False" #support
EndSection
# Same thing for DualShock 4 touchpad
Section "InputClass"
Identifier "ds4-touchpad"
Driver "libinput"
MatchProduct "Wireless Controller Touchpad"
Option "Ignore" "True"
EndSection

View File

@ -35,6 +35,7 @@ source ~/.config/vim/theme.vim
" Search/replace
{{ use_plugin('abolish') }}
{{ use_plugin('easy_align') }}
" Sourounding pairs
{{ use_plugin('surround') }}
@ -70,6 +71,9 @@ source ~/.config/vim/theme.vim
{% if variant == 'nvim' %}
{{ use_plugin('treesitter') }}
{{ use_plugin('ts-rainbow') }}
{# TODO
{{ use_plugin('indent-blankline') }}
#}
{% endif %}
" Snippets

View File

@ -0,0 +1,3 @@
{# Show ident lines #}
{{ add_source('lukas-reineke/indent-blankline.nvim') -}}
let g:indent_blankline_char_highlight_list = ['Error', 'Function']

View File

@ -42,7 +42,10 @@ end
-- map buffer local keybindings when the language server attaches
local servers = {
{% if 'python' in dev_stuffs %}
"pyls",
"pylsp",
{% endif %}
{% if 'php' in dev_stuffs %}
"phpactor", -- Install this one manually https://phpactor.readthedocs.io/en/master/usage/standalone.html#global-installation
{% endif %}
}
for _, lsp in ipairs(servers) do

View File

@ -18,9 +18,9 @@ noremap gc <cmd>Telescope commands<cr>
noremap gr <cmd>Telescope lsp_references<cr>
noremap ga <cmd>Telescope lsp_code_actions<cr>
vnoremap ga <cmd>Telescope lsp_range_code_actions<cr>
noremap gq <cmd>Telescope lsp_document_diagnostics<cr>
noremap ge <cmd>Telescope lsp_document_diagnostics<cr>
noremap gE <cmd>Telescope lsp_workspace_diagnostics<cr>
noremap ge <cmd>Telescope lsp_definitions<cr>
noremap gd <cmd>Telescope lsp_definitions<cr>
lua << EOF
require('telescope').setup{

View File

@ -1,5 +1,5 @@
{# Randomly color parentheses pairs #}
{{add_source('p00f/nvim-ts-rainbow')-}}
{{ add_source('p00f/nvim-ts-rainbow') -}}
lua << EOF
require'nvim-treesitter.configs'.setup {
rainbow = {

View File

@ -25,6 +25,8 @@ set visible-stats off
$if mode=vi
# these are for vi-command mode
set keymap vi-command
"k": history-search-backward
"j": history-search-forward
"\e[A": history-search-backward
"\e[B": history-search-forward
Control-l: clear-screen

View File

@ -1,3 +1,18 @@
#!/usr/bin/env bash
sudo kexec -l /boot/vmlinuz-linux --initrd=/boot/initramfs-linux.img --reuse-cmdline
set -euxo pipefail
# Set variables
name="${1:-linux}"
kernel="/boot/vmlinuz-$name"
initrd="/boot/initramfs-$name.img"
# Test if required files are present
[ -f $kernel ]
[ -f $initrd ]
command -v kexec &> /dev/null
# Configure the next kernel to load
sudo kexec -l $kernel --initrd=$initrd --reuse-cmdline
# Gracefully restart on the next kernel
sudo systemctl kexec

View File

@ -18,7 +18,8 @@ then
# Copying files
grep -o '^[^#]*' ~/.config/shell/trimmed.bash > "${WORK}/.bashrc"
grep -o '^[^#]*' ~/.config/inputrc > "${WORK}/.inputrc"
grep -o '^[^"]*' ~/.config/vim/vimconfig.vim > "${WORK}/.vimrc"
# grep -o '^[^"]*' ~/.config/vim/vimconfig.vim > "${WORK}/.vimrc"
# TODO Above file doesn't work anymore with automatrop
#mkdir -p "${WORK}/terminfo/${TERM:0:1}"
#if [ -f "/usr/share/terminfo/${TERM:0:1}/${TERM}" ]
#then

View File

@ -3,26 +3,19 @@
import sys
import random
# maj = True
for line in sys.stdin:
nl = ""
word = ""
grace = True
for c in line:
if c.isalpha():
if grace:
nl += word
nl += c
word = ""
grace = False
else:
word += c
word += c
else:
wrd = list(word)
random.shuffle(wrd)
nl += "".join(wrd)
nl += c
if len(word) > 2:
wrd = list(word)[1:]
random.shuffle(wrd)
nl += word[0] + "".join(wrd)
else:
nl += word
word = ""
grace = True
nl += c
print(nl, end="")

21
config/scripts/letrtes Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
import sys
import random
for line in sys.stdin:
nl = ""
word = ""
for c in line:
if c.isalpha():
word += c
else:
if len(word) > 3:
wrd = list(word)[1:-1]
random.shuffle(wrd)
nl += word[0] + "".join(wrd) + word[-1]
else:
nl += word
word = ""
nl += c
print(nl, end="")

View File

@ -678,7 +678,7 @@ class MelCLI:
Handles the user input and run asked operations.
"""
VERBOSITY_LEVELS = ["DEBUG", "INFO", "WARNING", "ERROR", "FATAL"]
VERBOSITY_LEVELS = ["NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
def apply_msgs_input(
self,

View File

@ -8,17 +8,16 @@ with the unread items (non-video links are ignored).
"""
# TODO Distribute this correclty, in the meanwhile please do
# pip install --user youtube-dl ConfigArgParse progressbar2
# pip install --user yt-dlp ConfigArgParse
# TODO Better logging (youtube-dl allow to pass loggers)
import sys
from typing import Dict, Set, Tuple
import urllib.request
import urllib.parse
import os
from xml.dom import minidom
import youtube_dl
import yt_dlp as youtube_dl
import configargparse
@ -95,18 +94,19 @@ def get_args() -> configargparse.Namespace:
return args
def get_links(args: configargparse.Namespace) -> Set[str]:
def get_links(args: configargparse.Namespace) -> list[str]:
"""
Read the feed XML, get the links
"""
links = set()
links = list()
with urllib.request.urlopen(args.feed) as request:
with minidom.parse(request) as xmldoc:
for item in xmldoc.getElementsByTagName("item"):
try:
linkNode = item.getElementsByTagName("link")[0]
link: str = linkNode.childNodes[0].data
links.add(link)
if link not in links:
links.append(link)
except BaseException as e:
print("Error while getting link from item:", e)
continue
@ -114,8 +114,8 @@ def get_links(args: configargparse.Namespace) -> Set[str]:
def get_video_infos(
args: configargparse.Namespace, ydl_opts: Dict, links: Set[str]
) -> Dict[str, Dict]:
args: configargparse.Namespace, ydl_opts: dict, links: list[str]
) -> dict[str, dict]:
"""
Filter out non-video links and store video download info
and associated filename
@ -148,8 +148,8 @@ def get_video_infos(
def get_downloaded_videos(
args: configargparse.Namespace, videosInfos: Dict[str, Dict]
) -> Tuple[Set[str], Set[str]]:
args: configargparse.Namespace, videosInfos: dict[str, dict]
) -> tuple[set[str], set[str]]:
videosDownloaded = set()
videosPartiallyDownloaded = set()
"""
@ -187,7 +187,7 @@ def get_downloaded_videos(
return videosDownloaded, videosPartiallyDownloaded
def get_tracked_videos(args: configargparse.Namespace, known: Set[str]) -> Set[str]:
def get_tracked_videos(args: configargparse.Namespace, known: set[str]) -> set[str]:
"""
Return videos previously downloaded (=tracked) amongst the unread videos.
This is stored in the tracking directory as empty extension-less files.
@ -220,6 +220,8 @@ def main() -> None:
print("→ Retrieveing RSS feed")
links = get_links(args)
# Oldest first
links = links[::-1]
print(f"→ Getting infos on {len(links)} unread articles")
videosInfos = get_video_infos(args, ydl_opts, links)
@ -236,8 +238,8 @@ def main() -> None:
markerPath = os.path.join(args.track, onlineFilename)
open(markerPath, "a").close()
videosToDownload: Set[str] = set()
videosReads: Set[str] = set()
videosToDownload: set[str] = set()
videosReads: set[str] = set()
for onlineFilename in videosInfos.keys():
# If the video was once downloaded but manually deleted,
# the marker should be left
@ -263,14 +265,19 @@ def main() -> None:
os.chdir(args.videos)
exit_code = 0
if not args.dryrun:
# TODO Progressbar one day maybe?
# We have all the info we need to make a reliable one
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
for onlineFilename in videosToDownload:
infos = videosInfos[onlineFilename]
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
for onlineFilename, infos in videosInfos.items():
if onlineFilename not in videosToDownload:
continue
# Really download
# Really download
if args.dryrun:
print(f"Would download {onlineFilename}")
else:
# Apparently that thing is transformed from a LazyList
# somewhere in the normal yt_dlp process
if isinstance(infos["thumbnails"], youtube_dl.utils.LazyList):
infos["thumbnails"] = infos["thumbnails"].exhaust()
try:
ydl.process_ie_result(infos, True, {})

View File

@ -9,6 +9,7 @@ import io
import pprint
import subprocess
import sys
import uuid
if __name__ == "__main__":
@ -72,6 +73,7 @@ if __name__ == "__main__":
if args.password:
password = args.password
args.password = "********"
mid = f"{uuid.uuid1()}@{args.helo}"
# Transmission content
@ -89,6 +91,7 @@ XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X"""
From: {getattr(args, 'from')}
Subject: {args.subject}
To: {args.to}
Message-ID: {mid}
Hello there,
@ -141,7 +144,10 @@ Input arguments:
next = True
while next:
line = p.stdout.readline()
code = int(line[:3])
try:
code = int(line[:3])
except ValueError:
raise ValueError(f"Could not parse line: '{line.decode()}'")
success = code < 400
color = colorama.Fore.GREEN if success else colorama.Fore.RED
if not args.quiet: