Compare commits

...

11 Commits

19 changed files with 141 additions and 54 deletions

View File

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

View File

@ -67,6 +67,14 @@
become: yes become: yes
when: arch_based 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 - name: Enable makepkg ccache
replace: replace:
path: /etc/makepkg.conf path: /etc/makepkg.conf
@ -75,6 +83,24 @@
become: yes become: yes
when: arch_based 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 - name: Set makepkg MAKEFLAGS
replace: replace:
path: /etc/makepkg.conf path: /etc/makepkg.conf
@ -85,14 +111,6 @@
j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}" j: "{{ [ansible_processor_nproc - 1, 1] | max | int }}"
when: arch_based 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 - name: Enable pacman ParallelDownloads
lineinfile: lineinfile:
path: /etc/pacman.conf path: /etc/pacman.conf
@ -161,6 +179,9 @@
notify: "software changed" notify: "software changed"
tags: softwarelist tags: softwarelist
- debug:
msg: "{{ packages }}"
- name: Install packages (Arch-based) - name: Install packages (Arch-based)
aur: aur:
name: "{{ packages }}" name: "{{ packages }}"

View File

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

View File

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

View File

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

View File

@ -6,3 +6,10 @@ Section "InputClass"
Option "StartKeysEnabled" "False" #Disable mouse Option "StartKeysEnabled" "False" #Disable mouse
Option "StartMouseEnabled" "False" #support Option "StartMouseEnabled" "False" #support
EndSection 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 " Search/replace
{{ use_plugin('abolish') }} {{ use_plugin('abolish') }}
{{ use_plugin('easy_align') }}
" Sourounding pairs " Sourounding pairs
{{ use_plugin('surround') }} {{ use_plugin('surround') }}
@ -70,6 +71,9 @@ source ~/.config/vim/theme.vim
{% if variant == 'nvim' %} {% if variant == 'nvim' %}
{{ use_plugin('treesitter') }} {{ use_plugin('treesitter') }}
{{ use_plugin('ts-rainbow') }} {{ use_plugin('ts-rainbow') }}
{# TODO
{{ use_plugin('indent-blankline') }}
#}
{% endif %} {% endif %}
" Snippets " 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 -- map buffer local keybindings when the language server attaches
local servers = { local servers = {
{% if 'python' in dev_stuffs %} {% 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 %} {% endif %}
} }
for _, lsp in ipairs(servers) do 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 gr <cmd>Telescope lsp_references<cr>
noremap ga <cmd>Telescope lsp_code_actions<cr> noremap ga <cmd>Telescope lsp_code_actions<cr>
vnoremap ga <cmd>Telescope lsp_range_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_workspace_diagnostics<cr>
noremap ge <cmd>Telescope lsp_definitions<cr> noremap gd <cmd>Telescope lsp_definitions<cr>
lua << EOF lua << EOF
require('telescope').setup{ require('telescope').setup{

View File

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

View File

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

View File

@ -1,3 +1,18 @@
#!/usr/bin/env bash #!/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 sudo systemctl kexec

View File

@ -18,7 +18,8 @@ then
# Copying files # Copying files
grep -o '^[^#]*' ~/.config/shell/trimmed.bash > "${WORK}/.bashrc" grep -o '^[^#]*' ~/.config/shell/trimmed.bash > "${WORK}/.bashrc"
grep -o '^[^#]*' ~/.config/inputrc > "${WORK}/.inputrc" 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}" #mkdir -p "${WORK}/terminfo/${TERM:0:1}"
#if [ -f "/usr/share/terminfo/${TERM:0:1}/${TERM}" ] #if [ -f "/usr/share/terminfo/${TERM:0:1}/${TERM}" ]
#then #then

View File

@ -3,26 +3,19 @@
import sys import sys
import random import random
# maj = True
for line in sys.stdin: for line in sys.stdin:
nl = "" nl = ""
word = "" word = ""
grace = True
for c in line: for c in line:
if c.isalpha(): if c.isalpha():
if grace: word += c
nl += word
nl += c
word = ""
grace = False
else:
word += c
else: else:
wrd = list(word) if len(word) > 2:
random.shuffle(wrd) wrd = list(word)[1:]
nl += "".join(wrd) random.shuffle(wrd)
nl += c nl += word[0] + "".join(wrd)
else:
nl += word
word = "" word = ""
grace = True nl += c
print(nl, end="") 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. 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( def apply_msgs_input(
self, 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 # 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) # TODO Better logging (youtube-dl allow to pass loggers)
import sys import sys
from typing import Dict, Set, Tuple
import urllib.request import urllib.request
import urllib.parse import urllib.parse
import os import os
from xml.dom import minidom from xml.dom import minidom
import youtube_dl import yt_dlp as youtube_dl
import configargparse import configargparse
@ -95,18 +94,19 @@ def get_args() -> configargparse.Namespace:
return args 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 Read the feed XML, get the links
""" """
links = set() links = list()
with urllib.request.urlopen(args.feed) as request: with urllib.request.urlopen(args.feed) as request:
with minidom.parse(request) as xmldoc: with minidom.parse(request) as xmldoc:
for item in xmldoc.getElementsByTagName("item"): for item in xmldoc.getElementsByTagName("item"):
try: try:
linkNode = item.getElementsByTagName("link")[0] linkNode = item.getElementsByTagName("link")[0]
link: str = linkNode.childNodes[0].data link: str = linkNode.childNodes[0].data
links.add(link) if link not in links:
links.append(link)
except BaseException as e: except BaseException as e:
print("Error while getting link from item:", e) print("Error while getting link from item:", e)
continue continue
@ -114,8 +114,8 @@ def get_links(args: configargparse.Namespace) -> Set[str]:
def get_video_infos( def get_video_infos(
args: configargparse.Namespace, ydl_opts: Dict, links: Set[str] args: configargparse.Namespace, ydl_opts: dict, links: list[str]
) -> Dict[str, Dict]: ) -> dict[str, dict]:
""" """
Filter out non-video links and store video download info Filter out non-video links and store video download info
and associated filename and associated filename
@ -148,8 +148,8 @@ def get_video_infos(
def get_downloaded_videos( def get_downloaded_videos(
args: configargparse.Namespace, videosInfos: Dict[str, Dict] args: configargparse.Namespace, videosInfos: dict[str, dict]
) -> Tuple[Set[str], Set[str]]: ) -> tuple[set[str], set[str]]:
videosDownloaded = set() videosDownloaded = set()
videosPartiallyDownloaded = set() videosPartiallyDownloaded = set()
""" """
@ -187,7 +187,7 @@ def get_downloaded_videos(
return videosDownloaded, videosPartiallyDownloaded 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. Return videos previously downloaded (=tracked) amongst the unread videos.
This is stored in the tracking directory as empty extension-less files. This is stored in the tracking directory as empty extension-less files.
@ -220,6 +220,8 @@ def main() -> None:
print("→ Retrieveing RSS feed") print("→ Retrieveing RSS feed")
links = get_links(args) links = get_links(args)
# Oldest first
links = links[::-1]
print(f"→ Getting infos on {len(links)} unread articles") print(f"→ Getting infos on {len(links)} unread articles")
videosInfos = get_video_infos(args, ydl_opts, links) videosInfos = get_video_infos(args, ydl_opts, links)
@ -236,8 +238,8 @@ def main() -> None:
markerPath = os.path.join(args.track, onlineFilename) markerPath = os.path.join(args.track, onlineFilename)
open(markerPath, "a").close() open(markerPath, "a").close()
videosToDownload: Set[str] = set() videosToDownload: set[str] = set()
videosReads: Set[str] = set() videosReads: set[str] = set()
for onlineFilename in videosInfos.keys(): for onlineFilename in videosInfos.keys():
# If the video was once downloaded but manually deleted, # If the video was once downloaded but manually deleted,
# the marker should be left # the marker should be left
@ -263,14 +265,19 @@ def main() -> None:
os.chdir(args.videos) os.chdir(args.videos)
exit_code = 0 exit_code = 0
if not args.dryrun: with youtube_dl.YoutubeDL(ydl_opts) as ydl:
# TODO Progressbar one day maybe? for onlineFilename, infos in videosInfos.items():
# We have all the info we need to make a reliable one if onlineFilename not in videosToDownload:
with youtube_dl.YoutubeDL(ydl_opts) as ydl: continue
for onlineFilename in videosToDownload:
infos = videosInfos[onlineFilename]
# 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: try:
ydl.process_ie_result(infos, True, {}) ydl.process_ie_result(infos, True, {})

View File

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