Skip to content

Instantly share code, notes, and snippets.

@Tobiaqs
Tobiaqs / gist:0ef7bd2e56160650264f9b77de2db50f
Last active January 21, 2021 11:38
Turning your Raspberry Pi into a Bluetooth audio receiver (Nov 2020)

Turning your Raspberry Pi system into a Bluetooth audio receiver

with the "latest" versions of pulseaudio 12.2 and bluez/bluetoothd 5.50 in Nov 2020 in Raspbian repos

guide updated on Nov 23, 2020

There are tons of guides online that show you how to use your Raspberry Pi as a Bluetooth audio receiver. Unfortunately, at time of writing, none of them seem to work, and contain unnecessary (unexplained) steps or settings that don't really add anything useful.

If you haven't followed any guides yet, skip to the TRUTHS part. If you have, the LIES part may clarify some things for you.

LIES

@Tobiaqs
Tobiaqs / 0001-Fix-recovery-data-finding-for-Ryan-Myers-NKit.patch
Created March 6, 2021 09:01
Patch that fixes discovery of recovery partition data in Ryan-Myers/NKit
From ec683a95700d922d0f574abaefaaf5773c4d8425 Mon Sep 17 00:00:00 2001
From: Tobias Sytsma <tobias@tobiass.nl>
Date: Sat, 6 Mar 2021 09:59:09 +0100
Subject: [PATCH] Fix recovery data finding for Ryan-Myers/NKit
---
NKit/Settings/RecoveryData.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NKit/Settings/RecoveryData.cs b/NKit/Settings/RecoveryData.cs
From 8dbd31f10fdab5aee76ee81171da3855d5f0bfaa Mon Sep 17 00:00:00 2001
From: Tobias Sytsma <tobias@tobiass.nl>
Date: Sat, 6 Mar 2021 10:07:43 +0100
Subject: [PATCH] Remove Windows apps from the solution
---
NKit.sln | 4 ----
1 file changed, 4 deletions(-)
diff --git a/NKit.sln b/NKit.sln
@Tobiaqs
Tobiaqs / create_gif.sh
Last active July 19, 2021 15:30
Script for creating GIFs from files created by Pop_OS!'s screen recording functionality
#!/bin/bash
# Requirements:
# - ffmpeg
# - xdotool
MAX_W=720
read -p "Press a key to select top left corner of region"
topleft_x=$(xdotool getmouselocation | awk '{print $1}' | cut -d':' -f 2)
@Tobiaqs
Tobiaqs / circular_serializers.py
Last active March 9, 2022 12:23
Solution for circular Serializer imports in larger Django projects
"""
DRF circular serializer import helper
"""
from rest_framework.serializers import ModelSerializer
from rest_framework.fields import Field
# Add more serializers here
RequestSerializer: ModelSerializer = None
OrderSerializer: ModelSerializer = None
@Tobiaqs
Tobiaqs / consumer.py
Last active March 17, 2022 11:19
Django-channels, deal with accept-language
def connect(self):
class dummy_request:
COOKIES = {}
META = {'HTTP_ACCEPT_LANGUAGE': dict(self.scope['headers']).get('accept-language'.encode('utf-8'), bytes()).decode('utf-8')}
translation.activate(translation.get_language_from_request(dummy_request))
@Tobiaqs
Tobiaqs / install_woolbird.sh
Last active May 19, 2022 10:37
Script that can transform a mint raspbian installation into a media center with external I2S DAC that runs Kodi and can play audio over the network and bluetooth via pulseaudio
#!/bin/bash
# this script sets up a mint raspbian installation as follows:
# - all packages updated
# - my public ssh key is authorized
# - onboard bluetooth disabled
# - onboard analog audio disabled
# - PCM5102a DAC as audio output
# - network audio relay through pulseaudio with zeroconf support
# - bluetooth audio relay through pulseaudio
@Tobiaqs
Tobiaqs / gamma
Created May 27, 2022 08:26
Manual screen dimmer for xrandr with color temperature setting
#!/bin/bash
r=255
g=255
b=255
function apply () {
echo -n "Enter brightness [0, 1]: "
read brightness
while read display; do
@Tobiaqs
Tobiaqs / store.ts
Last active September 22, 2023 08:49
Vuex 4 store with fully typed mapState (supports modules and actions)
/// store.ts
import { InjectionKey } from 'vue'
import { createStore, mapState as baseMapState, Store, useStore as baseUseStore } from 'vuex'
const modules = {
appDataModule,
}
const state = {
settings: <Settings | null>null,
@Tobiaqs
Tobiaqs / build_nkit_linux.sh
Created March 6, 2021 09:24
Script that builds a working NKit on Linux-based systems using Docker
#!/bin/bash
# use @Ryan-Myers .NET Core 3.1 version of the project
git clone https://github.com/Ryan-Myers/NKit.git
# patch for fixing the recovery data finding issue
wget -O - https://gist.githubusercontent.com/Tobiaqs/b7c25136a713fe68de47f4ad76376c89/raw/fd33482226818fd99b84a0f2302895a898c2aab4/0001-Fix-recovery-data-finding-for-Ryan-Myers-NKit.patch 2>/dev/null | git -C NKit apply
# patch to remove windows apps from the solution
wget -O - https://gist.githubusercontent.com/Tobiaqs/d25daf70ac7455dc7c3cf01071002c03/raw/8d983568f5137ab39d4cab759f8ea519e8bcd33c/0002-Remove-Windows-apps-from-the-solution.patch 2>/dev/null | git -C NKit apply
# build using dotnet sdk 3.1 docker image
docker run --rm -v $PWD/NKit:/NKit -it mcr.microsoft.com/dotnet/sdk:3.1 bash -c 'cd /NKit; dotnet build'