Skip to content

Instantly share code, notes, and snippets.

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

Scott Walter ScottJWalter

🔮
Particle. Wave. It's all data.
View GitHub Profile
@ScottJWalter
ScottJWalter / cmatrix.c
Created April 16, 2025 16:55 — forked from gvanem/cmatrix.c
Matrix clone in C
/*
* "Bleh" -- a "potato-friendly" cmatrix clone.
*
* Screenshot: https://i.imgur.com/dt6RmU7.png
*
* Adapted to Windows from:
* https://www.reddit.com/r/commandline/comments/1jcnyht/bleh_a_potatofriendly_cmatrix_clone/
*/
#include <stdio.h>
#include <stdlib.h>
@ScottJWalter
ScottJWalter / boot.sh
Created April 15, 2025 22:03 — forked from ThePlenkov/boot.sh
Resolve WSL DNS automatically
#!/bin/bash
# Remove existing "nameserver" lines from /etc/resolv.conf
sed -i '/nameserver/d' /etc/resolv.conf
# Run the PowerShell command to generate "nameserver" lines and append to /etc/resolv.conf
# we use full path here to support boot command with root user
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -Command '(Get-DnsClientServerAddress -AddressFamily IPv4).ServerAddresses | ForEach-Object { "nameserver $_" }' | tr -d '\r'| tee -a /etc/resolv.conf > /dev/null
@ScottJWalter
ScottJWalter / WSL2-Net-Fix.ps1
Created April 11, 2025 17:11 — forked from danvy/WSL2-Net-Fix.ps1
Reset your WSL network connection trying to fix WSL2 media disconnected error
# Check these threads before proceeding:
# https://github.com/microsoft/WSL/discussions/5857
# https://github.com/microsoft/WSL/issues/5821
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
$CmdLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CmdLine
Exit
}
# Restart the Host Network Service
Restart-Service -Force -Name hns
#!/data/data/com.termux/files/usr/bin/bash
am start -a android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS -d package:com.termux
echo -ne "\n Checking if Termux has storage permission..."
rm -r ~/storage >/dev/null 2>&1
if ! touch /storage/emulated/0/.tmp_check_termux >/dev/null 2>&1
then
echo -e "\nGrant Termux storage permission and run the script again\n"
termux-setup-storage
#!/data/data/com.termux/files/usr/bin/bash
if [ -z "$1" ]
then
echo "No input file specified"
exit 1
fi
echo -ne "\n Checking if Termux has storage permission..."
rm -r ~/storage &>/dev/null
@ScottJWalter
ScottJWalter / hackeyMotionWaitVibrate.sh
Created January 18, 2025 17:15 — forked from cgarz/hackeyMotionWaitVibrate.sh
A hacky Termux bash script that uses the accelerometer to make an alarm that fires when the phone changes orientation.
#!/data/data/com.termux/files/usr/bin/bash
echo "getting wake lock state"
termux-notification-list | jq -r '.[] | select(.id == 1337).content' | grep -qF 'wake lock held' && locked="true" || locked="false"
if [ "$locked" = "false" ]; then
echo "wake lock not set, setting for duration of script"
termux-wake-lock
else
echo "wake lock set, Will not alter wake lock state."
fi
@ScottJWalter
ScottJWalter / obsidian-pagebreaks.css
Created December 25, 2024 01:01 — forked from liamcain/obsidian-pagebreaks.css
Obsidian Pagebreaks
/**
Create pagebreaks in exported Obsidian PDFs.
Example:
# Heading 1
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type
@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