Skip to content

Instantly share code, notes, and snippets.

View alexcochran's full-sized avatar
🐍

Alex Cochran alexcochran

🐍
View GitHub Profile
@Diaoul
Diaoul / monitors.sh
Last active June 19, 2025 19:53
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
@claymcleod
claymcleod / pycurses.py
Last active April 28, 2025 17:11
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 May 19, 2025 20:39
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: