Skip to content

Instantly share code, notes, and snippets.

View alvaro-jmp's full-sized avatar
🎯
Focusing

alvaro-jmp alvaro-jmp

🎯
Focusing
View GitHub Profile
@alvaro-jmp
alvaro-jmp / run_mangohud_n_org.winehq.Wine_in_flatpak.sh
Created January 6, 2026 19:25
Example of how to run the MangoHUD extension for a Flatpak on the org.winehq.Wine application.
#!/usr/bin/bash
export games="/mnt/video_games"
export wine_dir="$HOME/.wine"
# To install the MangoHUD extension in Flatpak.
# Make sure to use the same branch for the MangoHUD extension and the org.winehq.Wine Flatpak application.
flatpak install org.freedesktop.Platform.VulkanLayer.MangoHud
@alvaro-jmp
alvaro-jmp / move-win-n-change-desk.js
Last active January 6, 2026 18:08
Script for kwin_wayland kwin scripts plasma 6 that changes a window and its virtual desktop to another virtual desktop simultaneously. For the case of 9 virtual desktops.
for (let i = 1; i < 10; i++) {
registerShortcut(`move-win-n-change-desk-${i}`,`Move window and change desktop to ${i}`,`Ctrl+Alt+${i}`, function(){
let window = workspace.activeWindow;
let sel = i-1;
if (window) {
window.desktops = [workspace.desktops[sel]];
workspace.currentDesktop = workspace.desktops[sel];
};
});
}
@alvaro-jmp
alvaro-jmp / fzf_launcher_wmctrl.sh
Last active October 2, 2025 19:49
Application selector and launcher that searches for applications in the .desktop files in ~/.local/share/applications and /usr/share/applications using a fuzzy finder. It is similar to rofi.
#!/bin/bash
# Script to list windows and switch to a window, list applications and be able to execute any desired one, which are found in ~/.local/share/applications and /usr/share/applications through dmenu.
# The first time it is executed or after installing or uninstalling an application, the script takes a moment x to list the applications each time it is executed.
terminal="xterm"
# Information is obtained about the last time the content of folders ~/.local/share/applications and /usr/share/applications were modified.
info_last_modified_local_apps=".local/share/applications $(stat ~/.local/share/applications | grep -Ei ".*^(Modify|Change)" | tr "\n" " ")"
@alvaro-jmp
alvaro-jmp / run-adb-as-root-with-termux.sh
Last active March 19, 2025 11:22
Run adb shell as root and load the termux environment with zsh
#!/usr/bin/env expect
spawn adb shell
expect ":/"
send "/sbin/su -c PREFIX=/data/data/com.termux/files/usr LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so HOME=/data/data/com.termux/files/home/.suroot TMPDIR=/data/data/com.termux/files/home/.suroot/.tmp ANDROID_DATA=/data TERM=xterm-256color ANDROID_ROOT=/system PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets:/system/bin:/system/xbin:/sbin:/sbin/bin TERMUX_FS=\"/data/data/com.termux/files\" TERMUX_PREFIX=\"\$TERMUX_FS/usr\" TERMUX_PATH=\"\$TERMUX_PREFIX/bin:\$TERMUX_PREFIX/bin/applets\" ROOT_HOME=\"\$TERMUX_FS/home/.suroot\" ANDROID_SYSPATHS=\"/system/bin:/system/xbin\" EXTRA_SYSPATHS=\"/sbin:/sbin/bin\" /data/data/com.termux/files/usr/bin/zsh"
send "\r"
expect "root@localhost"
send " cd"
send "\r"
send " clear"
@alvaro-jmp
alvaro-jmp / dmenu_launcher_wmctrl2.sh
Last active December 10, 2023 03:14
This is another simpler and similar script to dmenu_launcher_wmctrl.sh (https://gist.github.com/alvaro-jmp/3a0b1ae132780a56c6b0838e290471c2) using dmenu_path to get a list of the binaries or shell scripts, wmctrl to get the information about the windows.
#!/bin/bash
# This is another simpler and similar script to dmenu_launcher_wmctrl.sh (https://gist.github.com/alvaro-jmp/3a0b1ae132780a56c6b0838e290471c2) using compgen to get a list of the binaries or shell scripts, wmctrl to get the information about the windows.
# Print the list of binaries or shell scripts and windows in dmenu
result=$(printf "%s\n%s" "$(wmctrl -l | sort -nk2 | awk '{print "WIN ###", $0}')" "$(compgen -c | awk '{print "RUN >>>", $0}')" | dmenu -l 10)
# To switch between windows
if [[ "$result" =~ ^WIN ]]; then
@alvaro-jmp
alvaro-jmp / dmenu_launcher_wmctrl.sh
Last active May 12, 2025 03:11
Script to list windows and switch to a window, list applications and be able to execute any desired one, which are found in ~/.local/share/applications and /usr/share/applications through dmenu.
#!/bin/bash
# Script to list windows and switch to a window, list applications and be able to execute any desired one, which are found in ~/.local/share/applications and /usr/share/applications through dmenu.
# The first time it is executed or after installing or uninstalling an application, the script takes a moment x to list the applications each time it is executed.
terminal="xterm"
# Information is obtained about the last time the content of folders ~/.local/share/applications and /usr/share/applications were modified.
info_last_modified_local_apps=".local/share/applications $(stat ~/.local/share/applications | grep -Ei ".*^(Modify|Change)" | tr "\n" " ")"
@alvaro-jmp
alvaro-jmp / fix-virtual-cam2-android-sdk-emulator.md
Last active June 28, 2023 21:54
Solution if the android sdk emulator version 32.1.13 can't access the /dev/video2 file created with the v4l2loopback module to use it as a virtual web cam in case you are capturing the screen for x utility.

FIX: Can't access the /dev/video2 in android sdk emulator version 32.1.13

Solution if the android sdk emulator can't access the /dev/video2 file created with the v4l2loopback module to use it as a virtual web cam in case you are capturing the screen for x utility.

If for example your pc represents the video capture devices with /dev/video0 and /dev/video1, you need to give the user read and write permissions to those files because the emulator iterates through each file /dev/video* and when it finds that it doesn't have the necessary permissions it stops iterating and fails to get to /dev/video2.

So you have to give read and write permissions to all files referred to /dev/video* if you are using them.

In case you are not using it you can do the following:

@alvaro-jmp
alvaro-jmp / connect_bth_headset.sh
Last active January 26, 2026 04:58
Script related for connect a Bluetooth Headset/Speaker/Similar and posible fix to "Failed to connect: org.bluez.Error.Failed br-connection-aborted-by-local"
#!/bin/bash
# Script related for connect a Bluetooth Headset/Speaker/Similar and posible fix to "Failed to connect: org.bluez.Error.Failed br-connection-aborted-by-local", "Failed to connect: org.bluez.Error.Failed br-connection-timeout", "org.bluez.Error.Failed br-connection-profile-unavailable"
# Related to the error, I observed that if I disconnected and reconnected the usb bluetooth dongle and redo the connection steps, it was solved. To simulate disconnected and reconnected the usb, i used the file unbind and bind related to the usb port
# Currently work if the usb bluetooth device are not the same, i.e. that are not two or more exact usb bluetooth dongle model
# It is possible that two USB Bluetooth dongle devices have the same MAC address. This has already happened to me.
function end() {
printf "\n\nend... :)\n\n"
disconn_bth_device
Sub Main
dim document as object
dim dispatcher as object
dim selection as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
selection = ThisComponent.getCurrentSelection()
@alvaro-jmp
alvaro-jmp / FoodMe AJ Dashboard.jpg-1.jpg
Last active August 13, 2022 01:16
New Relic Challenge Platzi
FoodMe AJ Dashboard.jpg-1.jpg