Skip to content

Instantly share code, notes, and snippets.

View brutella's full-sized avatar
🏠
Working from home

Matthias brutella

🏠
Working from home
View GitHub Profile
@brutella
brutella / install-go.md
Created April 3, 2019 08:43
Install Go on Raspberry Pi

Install Go

  1. Download the latest stable version from golang.org with wget -c <url> – use armv6 architecture for Rasbperry Pi 3 Model B.
  2. Extract with sudo tar -C /usr/local -xvzf <file>
  3. Setup the Go workspace
@brutella
brutella / cheat-sheet.md
Created February 13, 2019 17:01
TextMate cheat sheet
  • ^s Incremental search

  • ^w Select in scope

  • cmd t Open documents

@brutella
brutella / go-modules.md
Created December 7, 2018 12:57
Go modules

Go supports modules since v1.11+.

Go modules require that GOPATH is empty => unset GOTPATH

Define a module

Run go mod init {module name} to create a go.mod file for the current directory.

For example go mod init github.com/brutella/dnssd creates the following content.

@brutella
brutella / gist:f3e2e2b3d3658f01403cfe12dbaf66fa
Created November 26, 2018 10:58
Password-less ssh access
  1. Check if there is an existing ssh key available
$ ls ~/.ssh

If id_rsa (private key) and id_rsa.pub (public key) are available, go to step 3.

  1. Generate new keys
@brutella
brutella / runit.md
Created August 9, 2018 13:48
Get started with runit
@brutella
brutella / rpi-enable-camera-module.md
Last active February 9, 2024 09:48
How to enable the camera module on a Raspberry Pi

Enable camera module

Edit your /boot/config.txt file and make sure the following lines look like this:

start_x=1             # essential
gpu_mem=128           # at least, or maybe more if you wish
disable_camera_led=1  # optional, if you don't want the led to glow

Load bcm2835-v4l2 module

// Steps to get this running
// 1. Install Go: http://golang.org/doc/install
// 2. Setup Go workspace: http://golang.org/doc/code.html#Organization
// 3. Download dependencies in Terminal.app
// 3.1 Navigate to multiswitchtest.go
// 3.2 Execute `go get`
// 4. Run `go run multiswitchtest.go`
package main
import (
@brutella
brutella / server.go
Created September 28, 2017 13:26
HTTP server which turns a HomeKit switch on and off
package main
import (
"github.com/brutella/hc"
"github.com/brutella/hc/accessory"
"github.com/brutella/hc/log"
"net/http"
)
func main() {
@brutella
brutella / headless-rpi.md
Last active March 12, 2022 13:00
How to set up a Raspberry Pi

Install Rasbian

Most of the time I use a headless Raspberry Pi which I want to access via ssh. These are the steps to do that.

  1. Download Rasbian
  2. Install the downloaded file on a SD card
  • Find the disk number of the SD card with diskutil list
  • Unmount the disk with diskutil unmountDisk /dev/disk<number>
  • Copy data on the SD card with sudo dd bs=1m if=<img-file> of=/dev/rdisk<number> conv=sync
@brutella
brutella / reduce_fps
Last active April 18, 2016 12:42
Reduce frame rate of video to make screen recording from Quicktime compatible with App Store App Preview
# from http://stackoverflow.com/questions/11004137/re-sampling-h264-video-to-reduce-frame-rate-while-maintaining-high-image-quality
ffmpeg -y -i source.mov -r 30 -s 750x1334 -c:v libx264 -b:v 3M -strict -2 -movflags faststart destination.mov