Skip to content

Instantly share code, notes, and snippets.

View jchv's full-sized avatar

jchv

  • ::1
View GitHub Profile
@jchv
jchv / nix-code-wine.sh
Last active September 18, 2020 07:08
Script for getting a good IDE experience for programming Wine under NixOS. Assumes you are in the Wine folder, and have a ../wine-build.
#!/bin/sh
set -e
if [ "$1" = "inside-nix-shell" ]; then
echo "Clearing clangd cache."
rm -f "compile_commands.json"
rm -rf ".clangd"
LIBEAR32="$(nix-build "<nixpkgs>" -A bear --argstr system i686-linux)/lib/bear/libear.so"
LIBEAR64="$(nix-build "<nixpkgs>" -A bear --argstr system x86_64-linux)/lib/bear/libear.so"
@jchv
jchv / input-settings-fixes.diff
Created November 7, 2020 20:25
Fix for some bsnes input settings bugs (being tested.)
diff --git a/bsnes/target-bsnes/settings/input.cpp b/bsnes/target-bsnes/settings/input.cpp
index 13b04b7a..fd76ac78 100644
--- a/bsnes/target-bsnes/settings/input.cpp
+++ b/bsnes/target-bsnes/settings/input.cpp
@@ -68,12 +68,11 @@ auto InputSettings::updateControls() -> void {
assignMouse3.setVisible(false);
if(activeMapping) {
- auto& input = activeDevice().mappings[batched.left().offset()];
- if(input.isDigital()) {
@jchv
jchv / print-label
Created December 14, 2024 06:04
A script I use to print labels using my Brother QL-800 label printer. Not currently integrated into my NixOS configuration, for one reason or another.
#! /usr/bin/env nix
#! nix shell nixpkgs#imagemagick nixpkgs#python3Packages.brother-ql nixpkgs#swayimg --command bash
PREVIEW=0
TEXTSIZE=85
while [[ $# -gt 0 ]]; do
case "$1" in
-p|--preview)
PREVIEW=1
@jchv
jchv / xwayland-display.sh
Created August 28, 2025 22:30
Runs a secondary XWayland display as fullscreen confined to one specified output. Use `wayland-info` to find information about connected displays, including the display name. Usage: `./xwayland-display.sh eDP-1 1920x1080 <command>`
#!/bin/bash
set -euo pipefail
XWAYLAND_DISPLAY=:69
WAYLAND_OUTPUT="$1"
shift
GEOMETRY="$1"
shift
APP_COMMAND="$@"
echo "Starting XWayland on display '$XWAYLAND_DISPLAY' for output '$WAYLAND_OUTPUT' with geometry '$GEOMETRY'..."
Xwayland "$XWAYLAND_DISPLAY" -fullscreen -geometry "$GEOMETRY" -output "$WAYLAND_OUTPUT" &