From 9788b9d9bb598b1b7a9780908595b99aca0cb0ae Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Fri, 5 Sep 2025 10:07:23 +0200 Subject: [PATCH] Updated scripts --- config/hypr/hyprland.conf | 5 +- config/nvim/init.lua | 4 +- pico-load.sh | 3 +- tmux.conf | 6 +- uf2conv.py | 288 ++++++++++++++++++++++++++++++++++++++ update_arch.sh | 45 +----- 6 files changed, 304 insertions(+), 47 deletions(-) create mode 100755 uf2conv.py diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index c630059..7628e84 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -18,7 +18,8 @@ exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # exec-once = /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec-once = udiskie exec-once = waybar -exec-once = systemctl --user start sunshine +exec-once = wayvnc 0.0.0.0 5900 +exec-once = systemctl --user import-environment PATH ############################# ### ENVIRONMENT VARIABLES ### @@ -27,8 +28,6 @@ env = XCURSOR_SIZE,24 env = HYPRCURSOR_SIZE,24 env = QT_QPA_PLATFORM,wayland env = QT_QPA_PLATFORMTHEME,qt5ct # for Qt apps -# env = GTK_THEME,Adwaita:dark -# env = QT_STYLE_OVERRIDE,adwaita-dark ##################### ### LOOK AND FEEL ### diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 7eac0ef..fac1a04 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -97,7 +97,7 @@ vim.pack.add({ { src = "https://github.com/neovim/nvim-lspconfig" }, { src = "https://github.com/lewis6991/gitsigns.nvim" }, { src = "https://github.com/MunifTanjim/nui.nvim" }, - { src = "https://github.com/folke/noice.nvim" }, + -- { src = "https://github.com/folke/noice.nvim" }, { src = "https://github.com/L3MON4D3/LuaSnip" }, { src = "https://github.com/rafamadriz/friendly-snippets" }, { src = "https://github.com/saghen/blink.cmp" }, @@ -108,7 +108,7 @@ vim.pack.add({ ------------------------------------------------------------------- -- Plugin config ------------------------------------------------------------------- -require("noice").setup() +-- require("noice").setup() require("netrw").setup() require("conform").setup({ formatters_by_ft = { diff --git a/pico-load.sh b/pico-load.sh index ed8520f..ebbf1e1 100755 --- a/pico-load.sh +++ b/pico-load.sh @@ -28,5 +28,6 @@ elif [ "$OS" == "Arch Linux" ]; then sleep 1 done set -e - cargo run --release --target thumbv6m-none-eabi + # cargo run --release --target thumbv6m-none-eabi + cargo objcopy --release -- -O binary target/thumbv6m-none-eabi/release/rp2040.bin && python3 ~/linuxbox/uf2conv.py -b 0x10000000 -f 0xe48bff56 -c -o /media/RPI-RP2/firmware.uf2 target/thumbv6m-none-eabi/release/rp2040.bin fi diff --git a/tmux.conf b/tmux.conf index b2cff85..b04ed86 100644 --- a/tmux.conf +++ b/tmux.conf @@ -36,8 +36,10 @@ set -g @smart-splits_resize_down_key 'M-j' # --"-- set -g @smart-splits_resize_up_key 'M-k' # --"-- set -g @smart-splits_resize_right_key 'M-l' # --"-- -bind h if -F "#{@pane-is-vim}" 'split-window -h -b -c "#{pane_current_path}" "source ~/.bashrc && nvim"' 'split-window -h -b' -bind l if -F "#{@pane-is-vim}" 'split-window -h -c "#{pane_current_path}" "source ~/.bashrc && nvim"' 'split-window -h' +# bind h if -F "#{@pane-is-vim}" 'split-window -h -b -c "#{pane_current_path}" "source ~/.bashrc && nvim"' 'split-window -h -b' +# bind l if -F "#{@pane-is-vim}" 'split-window -h -c "#{pane_current_path}" "source ~/.bashrc && nvim"' 'split-window -h' +bind h split-window -h -b -c "#{pane_current_path}" +bind l split-window -h -c "#{pane_current_path}" bind j split-window -v -p 10 -c "#{pane_current_path}" bind k split-window -v -b -c "#{pane_current_path}" diff --git a/uf2conv.py b/uf2conv.py new file mode 100755 index 0000000..1fcc17f --- /dev/null +++ b/uf2conv.py @@ -0,0 +1,288 @@ +#!/usr/bin/env python3 + +import sys +import struct +import subprocess +import re +import os +import os.path +import argparse + + +UF2_MAGIC_START0 = 0x0A324655 # "UF2\n" +UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected +UF2_MAGIC_END = 0x0AB16F30 # Ditto + +INFO_FILE = "/INFO_UF2.TXT" + +appstartaddr = 0x2000 +familyid = 0x0 + + +def is_uf2(buf): + w = struct.unpack(" 476: + assert False, "Invalid UF2 data size at " + str(ptr) + newaddr = hd[3] + if curraddr == None: + appstartaddr = newaddr + curraddr = newaddr + padding = newaddr - curraddr + if padding < 0: + assert False, "Block out of order at " + str(ptr) + if padding > 10*1024*1024: + assert False, "More than 10M of padding needed at " + str(ptr) + if padding % 4 != 0: + assert False, "Non-word padding size at " + str(ptr) + while padding > 0: + padding -= 4 + outp.append(b"\x00\x00\x00\x00") + outp.append(block[32:32 + datalen]) + curraddr = newaddr + datalen + return b"".join(outp) + +def convert_to_carray(file_content): + outp = "const unsigned char bindata_len = %d;\n" % len(file_content) + outp += "const unsigned char bindata[] __attribute__((aligned(16))) = {" + for i in range(len(file_content)): + if i % 16 == 0: + outp += "\n" + outp += "0x%02x, " % file_content[i] + outp += "\n};\n" + return bytes(outp, "utf-8") + +def convert_to_uf2(file_content): + global familyid + datapadding = b"" + while len(datapadding) < 512 - 256 - 32 - 4: + datapadding += b"\x00\x00\x00\x00" + numblocks = (len(file_content) + 255) // 256 + outp = [] + for blockno in range(numblocks): + ptr = 256 * blockno + chunk = file_content[ptr:ptr + 256] + flags = 0x0 + if familyid: + flags |= 0x2000 + hd = struct.pack(b"= 3: + drives.append(words[2] + "/") + return drives + return parse_linux_mount_output(check_errors(subprocess.run(['mount'], capture_output=True, text=True))) + +def info_uf2(d): + try: + with open(d + INFO_FILE, mode='r') as f: + return f.read() + except: + return "UF2 Bootloader" + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/update_arch.sh b/update_arch.sh index c1a5254..f8178b4 100755 --- a/update_arch.sh +++ b/update_arch.sh @@ -82,7 +82,7 @@ if pacman -Qs timeshift >/dev/null; then fi # Enable multilib (if applicable) -if [ "${ROLES[GAME]}" == "yes" ] || [ "${ROLES[MUSIC]}" == "yes" ]; then +if [ "${ROLES[GAME]}" == "yes" ]; then if ! grep -q "^\[multilib\]" /etc/pacman.conf; then printf -- '\033[33m Enabling multilib\n\033[37m' sudo tee -a /etc/pacman.conf >/dev/null </dev/null <