Skip to content

Instantly share code, notes, and snippets.

View ScottJWalter's full-sized avatar
🔮
Particle. Wave. It's all data.

Scott J. Walter ScottJWalter

🔮
Particle. Wave. It's all data.
View GitHub Profile
@ScottJWalter
ScottJWalter / obsidian-debug-mobile.js
Created December 22, 2024 22:10 — forked from liamcain/obsidian-debug-mobile.js
Save console messages to logfile for mobile debugging
declare module "obsidian" {
interface App {
isMobile: boolean;
}
}
// Call this method inside your plugin's `onLoad` function
function monkeyPatchConsole(plugin: Plugin) {
if (!plugin.app.isMobile) {
return;
@ScottJWalter
ScottJWalter / WSL2GUIWSLg-XWayland-en.md
Created December 21, 2024 15:44 — forked from tdcosta100/WSL2GUIWSLg-XWayland-en.md
A tutorial to use GUI in WSL2/WSLg replacing original Xorg by Xwayland, allowing WSL to work like native Linux, including login screen

Full desktop shell in WSL2 using WSLg (XWayland)

Note

If you want to use Wayland in WSLg in a simpler setup, you can try the WSLg (Wayland) tutorial.

In this tutorial, we will setup GUI in WSL2. No additional software outside WSL (like VcXsrv or GWSL) is required. You will find this tutorial very similar to the one that replaces Xorg with Xvnc. Indeed, it's pretty much the same tutorial, with some few changes.

The key component we need to install is the desktop metapackage you want (GNOME, KDE, Xfce, Budgie, etc), and after that, replace the default Xorg by a script that calls Xwayland instead.

For this setup, I will use Ubuntu 24.04, and install GNOME Desktop. Unfortunately older versions of Ubuntu lack some fundamental things, so we cannot reproduce it in older versions (at least not fully). Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the [Sample screenshot

@ScottJWalter
ScottJWalter / recent_requests.adb.sh
Last active December 20, 2024 21:49
Use ADB to get recent vibration requests
#!/bin/sh
# Run from an ADB debugging connection
#
# Reference:
# https://android.stackexchange.com/questions/215638/how-to-determine-which-app-is-causing-vibration
package_name=$1 # VIBRATE
for pkg in $(pm list packages | sed 's/package://')
do
@ScottJWalter
ScottJWalter / multipass-launcher.sh
Last active December 18, 2024 15:11
Generate a temporary cloud-init.yml file that is fed directly to multipass to launch a VM
#!/bin/sh
# WIP experiment
VM_NAME="$1"
$SSH_PUBLIC_KEY="Your Public SSH Key"
# The following method for handling temp files is adapted from
#
# https://unix.stackexchange.com/a/181938/458942
#
@ScottJWalter
ScottJWalter / inotify-watcher.sh
Last active December 21, 2024 15:04
Bash wrapper for inotify
#!/bin/sh
#
# inotify-watcher.sh -- Monitor a folder for file changes
#
# This is a wrapper around inotify, intended to make it easier to quickly
# spin up directory watchers. To activate watching for a particular event,
# comment and fill out the appropriate `inotify_XXXX` function.
#
inotify_close_write() {
# File closed after writing ("saved") and ready to be processed.
@ScottJWalter
ScottJWalter / inotifyexec.py
Created December 17, 2024 19:33 — forked from wernight/inotifyexec.py
inotifywait helper that executes a command on file change (for Linux, put it in ~/bin/)
#!/usr/bin/env python
"""Use inotify to watch a directory and execute a command on file change.
Watch for any file change below current directory (using inotify via pyinotify)
and execute the given command on file change.
Just using inotify-tools `while inotifywait -r -e close_write .; do something; done`
has many issues which are fixed by this tools:
* If your editor creates a backup before writing the file, it'll trigger multiple times.
* If your directory structure is deep, it'll have to reinitialize inotify after each change.
@ScottJWalter
ScottJWalter / WhisperCPP-Transcribe.bat
Created December 16, 2024 09:01 — forked from ThioJoe/WhisperCPP-Transcribe.bat
WhisperCPP Batch File Script
:: ---- Lines beginning with :: are comments ----
:: This script is meant to make it easy to transcribe a video file using WhisperCPP.
:: You can simply drag a video file into the cmd window, then it will use ffmpeg to extract the audio, then transcribe using WhisperCPP and output to a text file.
::
@echo off
set /p videopath="Enter the full path to the video file to transcribe: "
:: Remove quotes from the input path
set videopath=%videopath:"=%
@ScottJWalter
ScottJWalter / install-celery.sh
Last active December 15, 2024 05:05
Install celery as a system service
# install celery as a system service
sudo apt install -y python3-celery
# service file
sudo cat >/etc/systemd/system/celery.service <<EOL
[Unit]
Description=Celery Service
After=network.target,rabbitmq-server.service
Requires=rabbitmq-server.service
@ScottJWalter
ScottJWalter / install-rabbitmq.sh
Created December 15, 2024 04:18
Install RabbitMQ on Ubuntu via Cloudsmith mirrors
#!/bin/sh
sudo apt-get install curl gnupg apt-transport-https -y
## Team RabbitMQ's main signing key
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null
## Community mirror of Cloudsmith: modern Erlang repository
curl -1sLf https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rabbitmq.E495BB49CC4BBE5B.gpg > /dev/null
## Community mirror of Cloudsmith: RabbitMQ repository
curl -1sLf https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/rabbitmq.9F4587F226208342.gpg > /dev/null
@ScottJWalter
ScottJWalter / _README.md
Created December 15, 2024 04:10 — forked from mob-sakai/_README.md
Run shell script on gist

Run shell script on gist

Shells that support process substitution such as bash and zsh allow to run shell script on gist as follows.

# With curl:
bash <(curl -sL ${GIST_URL}) args...

# With wget: