Skip to content

Instantly share code, notes, and snippets.

View Pindar's full-sized avatar

Simon Dittlmann Pindar

View GitHub Profile
@Pindar
Pindar / README.md
Last active March 30, 2019 18:22
Raspotify with HifiBerry

To use raspotify properly with HifiBerry on raspberry pi 2 (kernel 4.19.29-v7)

  1. Compile https://github.com/librespot-org/librespot
sudo apt-get install build-essential libasound2-dev
curl https://sh.rustup.rs -sSf | sh
cargo build --release --features alsa-backend
  1. Point /etc/systemd/system/raspotify.service to compiled binary from (1), e.g. /home/pi/librespot/target/release/librespot
@Pindar
Pindar / .A.README.md
Last active January 6, 2019 09:57
This script acts as Slack Bot to post one tip once a day to a defined channel.

Tip Of The Day Bot

This script acts as Slack Bot to post one tip once a day to a defined channel.

@Pindar
Pindar / .env
Last active July 17, 2018 21:09
automate-powerplug-stereoanlage
HUE_HOST=192.168.XX.XX
HUE_USER=iglksjflXXXXXXXXX
LIGHT_NUMBER=00
@Pindar
Pindar / pishutdown.py
Created July 7, 2018 07:14
pishutdown
#!/usr/bin/env python3
# shutdown/reboot(/power on) Raspberry Pi with pushbutton
import RPi.GPIO as GPIO
from subprocess import call
from datetime import datetime
import time
from signal import pause
# pushbutton connected to this GPIO pin, using pin 5 also has the benefit of
[Unit]
Description=Playing zeros
# https://raspberrypi.stackexchange.com/questions/74456/i2s-dac-device-support-kernel-drivers-and-noise-pop-crackle-on-playbac
After=alsa-restore.service
Requires=alsa-restore.service
[Service]
TimeoutSec=0
User=pi
ExecStart=/usr/bin/aplay -D default -c 2 -f S16 -r 48000 /dev/zero
#!/usr/bin/env python3
import os
from subprocess import check_output
from gpiozero import Button
from signal import pause
import time
def playPause():
os.system("mpc toggle")
@Pindar
Pindar / README.md
Last active August 8, 2024 14:38 — forked from mill1000/README.md
Headless A2DP Audio Streaming on Raspbian Stretch

About

This gist will show how to setup Raspbian Stretch as a headless Bluetooth A2DP audio sink. This will allow your phone, laptop or other Bluetooth device to play audio wirelessly through a Rasperry Pi.

Motivation

A quick search will turn up a plethora of tutorials on setting up A2DP on the Raspberry Pi. However, I felt this gist was necessary because this solution is:

  • Automatic & Headless - Once setup, the system is entirely automatic. No user iteration is required to pair, connect or start playback. Therefore the Raspberry Pi can be run headless.
  • Simple - This solution has few dependencies, readily available packages and minimal configuration.
  • Up to date

Prerequisites

@Pindar
Pindar / backup-folder.sh
Created January 9, 2016 16:51
Backup files through rsync
#!/bin/bash
rsync -arq --exclude='.DS_Store' --exclude='.wdmc' /DataVolume/shares/Public/Shared\ Pictures/ nas:/DataVolume/Backup/Pictures/
@Pindar
Pindar / git.sh
Created July 28, 2015 09:07
git commands
# restore file
git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"
# stage files with review
git add -p .
@Pindar
Pindar / gist:300d3424f05410ad7c04
Last active August 29, 2015 14:16
set-env.sh
#!/bin/bash
FILE=${1}
ENVIRONMENT=${2}
SERVICE_NAME=${3}
ETCD=${4:-"127.0.0.1:4001"}
if [[ $FILE == "" || $ENVIRONMENT == "" || SERVICE_NAME == "" ]]; then