Skip to content

Instantly share code, notes, and snippets.

View garyritchie's full-sized avatar

Gary Ritchie garyritchie

View GitHub Profile
@tool
extends EditorScenePostImport
class MeshInstanceList:
var mesh: Mesh
var aabb: AABB
var transforms: Array
# Converts geometry node instances into MultiMeshInstances
func gn_instances_to_mm(parent: Node, scene: Node):
@williamchange
williamchange / themegen.py
Created March 10, 2023 11:06
Simple Theme Generator (Add-on)
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

@tin2tin
tin2tin / strips_to_asset_browser.py
Last active November 1, 2022 05:02
Convert selected strips to assets via sound, image or clip IDs.
# Convert selected strips to assets via sound, image or clip IDs.
# By tintwotin & batFINGER
import bpy, os
strips = bpy.context.selected_editable_sequences
strips = sorted(strips, key=lambda strip: strip.frame_final_start)
for sq in strips:
if sq.type == "SOUND":
@p2or
p2or / blender-automatic-file-output-node-connections.py
Created November 29, 2020 09:56
Auto file output node connection #Blender
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@andrebrait
andrebrait / keychron_linux.md
Last active March 25, 2025 11:50
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

@ChriRas
ChriRas / readme.md
Last active February 25, 2025 18:59
Set up default audio device on Ubuntu 20.04 LTS

Problem

I have a notebook connected to a port replicator. I want to use the build-in speakers and microfone and not the external ones. If I boot my notebook in my port replicator Ubuntu changes the devices to external.

Solution

  1. Find your internal speaker
pactl list short sinks
@aggregate1166877
aggregate1166877 / GodotCleanFisheyeBarrelDistortion.shader
Last active November 27, 2024 21:32
Godot fisheye / barrel distortion shader with minimal pixelation
/**
* This shader creates fisheye or barrel distortion by sliding values in the
* desired direction. It aims to have a minimal amount of pixelation, and was
* originally conceived of to procedurally generate cartoon planets and bodies
* from easily generatable flat textures.
*
* Thanks to user Dan (6145) on Stack Overflow for providing the math. I also
* stole some code from here for the texture placement:
* https://gist.github.com/quiglemj/971f4cec1b128c58b4864c5200bfc579
* This shader differs from the above gist in that it does not stretch the
@p2or
p2or / io_fusion_tracking_scene.py
Last active January 19, 2024 09:37
Export Camera to BMD Fusion [Blender 2.8x] from https://blenderartists.org/t/addon-export-camera-to-bmd-fusion #BlenderArtists
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the