Skip to content

Instantly share code, notes, and snippets.

View diogocera's full-sized avatar
📐

Diogo Cera diogocera

📐
View GitHub Profile
@diogocera
diogocera / gist:19ec909ab2ccc87610096e4dbd7838f2
Last active May 13, 2026 12:42
Raspberry Pi as a Bluetooth speaker (headless, persistent)
# Raspberry Pi as a Bluetooth speaker (headless, persistent)
A guide to turning a headless Raspberry Pi into a persistent Bluetooth audio sink — so any paired device can connect and play audio without you needing to SSH in first.
## Prerequisites
- Raspberry Pi running Raspberry Pi OS (Bullseye or later)
- BlueZ and PulseAudio installed (included by default on most Pi OS images)
- An audio output — onboard audio, HDMI, or a USB DAC
- A Bluetooth device to connect from (Mac, iPhone, Android, etc.)
@diogocera
diogocera / o_auth1.rb
Last active February 28, 2023 14:58
Create OAuth1.0 authentication header string
class OAuth1
class << self
def oauth_header(uri:, method:, access_token:, access_secret:, consumer_key:, consumer_secret:)
header = {
'oauth_consumer_key' => consumer_key,
'oauth_token' => access_token,
'oauth_nonce' => generate_nonce,
'oauth_signature_method' => 'HMAC-SHA256',
'oauth_timestamp' => Time.now.to_i,
'oauth_version' => '1.0'