Skip to content

Instantly share code, notes, and snippets.

View mu88's full-sized avatar
πŸŒ‹
On very long vacation

Mirko πŸ‡ͺπŸ‡Ί πŸ‡ΊπŸ‡¦ mu88

πŸŒ‹
On very long vacation
View GitHub Profile
@mu88
mu88 / Raspi.md
Created February 2, 2024 10:50
Raspi IoT with GPIO in Docker

Control GPIO pins within rootless Docker container on Raspberry Pi

When it comes to controlling the GPIO pins of a Raspberry Pi, the existing tutorials will get you started in a couple of minutes. But most of the code assumes that it runs on bare metal and has sufficient privileges, e. g. to access the GPIO pins.
But what if you want to run this code in a Docker container, or even rootless? This page will explain how to set up all the necessary pieces.

Containerizing the app

Let's use the following sample code to blink an LED ([taken from the official documentation][2]) and save it under BlinkLedSample\Program.cs:

using System;
using System.Device.Gpio;
using System.Threading;
@mu88
mu88 / Bitbucket_AddTaskForFixups.ps1
Created June 25, 2024 12:53
Bitbucket - Add tasks for fixup commits
Clear-Host
# Unlock PowerShell SecretStore with dedicated secret
$password = Import-CliXml -Path "C:\secretStore.xml"
Unlock-SecretStore -Password $password
$baseUrl = "https://bitbucket.company.com/rest/api/latest"
$username = Get-Secret -Name Bitbucket_FixupTasks_Username -AsPlainText
$password = Get-Secret -Name Bitbucket_FixupTasks_Token -AsPlainText
$commitPrefix = "fixup!"