Skip to content

Instantly share code, notes, and snippets.

@a-dma
a-dma / yubitouch.sh
Last active March 10, 2022 14:43
Bash script for setting or clearing touch requirements for cryptographic operations in the OpenPGP application on a YubiKey 4.
#!/bin/bash
# Bash script for setting or clearing touch requirements for
# cryptographic operations the OpenPGP application on a YubiKey 4.
#
# Author: Alessio Di Mauro <[email protected]>
GCA=$(which gpg-connect-agent)
DO=0
UIF=0
@dpneumo
dpneumo / diff-phone_home.py.txt
Last active February 18, 2022 08:18
Modify cloud-init phone_home module to return a created server's public key for insertion into known_hosts. Works with cloud-iniit version 0.7.9 and later.
# Diff of the original cc_phone_home and the slightly modified version that supports
# including the server pub_keys in the phone_home payload
# Original: https://github.com/number5/cloud-init/blob/master/cloudinit/config/cc_phone_home.py
# A couple of typos in comment lines in the original were elided to make the diff a bit clearer.
# The Centos7 distros I am using do not provide pub_key_dsa.
# I am talking to a Rails app with phone_home.
# A dummy X-CSRF-Token: 1234567890 in the headers simplifies the code on the Rails side.
# I authenticate the phone_home payload by including a token provided in the
@ryrun
ryrun / shadow_pc_sdl2.md
Created November 23, 2024 13:51
Changing Shadow PC App Gamepad Button Mapping with SDL2 on macOS using SDL_GAMECONTROLLERCONFIG

Changing Shadow PC App Gamepad Button Mapping with SDL2 on macOS

The Shadow PC app uses SDL2 for gamepad recognition. This has the advantage that you can change the button mapping of recognized controllers. You can add a custom configuration for each SDL2 application using the SDL_GAMECONTROLLERCONFIG environment variable. The format is relatively simple:

GUID,Name,Mapping

Currently, I am having issues with Xbox 360 controllers (a Xim Matrix which is using the PC XInput mode) on macOS 15, as they are recognized twice in the Shadow PC app with SDL version 2.24.2 (as of Nov 23, 2024). The problem is described here: GitHub Issue #11002. Since I do not want to wait too long for an update, I use the following mapping to "break" the 360 controller, so no duplicate inputs are sent to Shadow PC: