Skip to content

Instantly share code, notes, and snippets.

View alexcochran's full-sized avatar
🦝

Alex Cochran alexcochran

🦝
View GitHub Profile
@tdcosta100
tdcosta100 / WSL2GUIWSLg-XWayland-en.md
Last active March 16, 2026 08:53
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

@Diaoul
Diaoul / monitors.sh
Last active March 17, 2026 07:26
Arrange workspace on multiple monitors (Hyprland)
#!/usr/bin/env bash
# IMPORTANT: this script is now part of my dotfiles and maintained there
# see https://github.com/Diaoul/dotfiles/blob/main/.config/hypr/scripts/workspaces.sh
set -e
declare -i last_called=0
declare -i throttle_by=4
@throttle() {
local -i now=$(date +%s)
#!python
# Tested with `SC-8110-2D-B` 1d & 2d barcode scanner
#
# Inspired by https://github.com/julzhk/usb_barcode_scanner
# which was inspired by https://www.piddlerintheroot.com/barcode-scanner/
# https://www.raspberrypi.org/forums/viewtopic.php?f=45&t=55100
# from 'brechmos' - thank-you!
#
# This implementation doesn't directly decode hidraw stream, but uses
@adashrod
adashrod / CamelCaseRant.md
Last active February 17, 2026 20:27
A rant about how to properly camel-case acronyms and abbreviations

Why using all-caps acronyms/abbreviations in camel case names is wrong

or, write MyUrlClass, not MyURLClass

Camel case

General Rules:

  • Each word is capitalized
  • no spaces
  • only alphanumeric characters

Upper Camel Case (aka Pascal case)

@claymcleod
claymcleod / pycurses.py
Last active October 30, 2025 14:50
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active November 12, 2025 14:52
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python (Updated for Python 3.7)
Usage:
./dummy-web-server.py -h
./dummy-web-server.py -l localhost -p 8000
Send a GET request: