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
//
// OCXML.swift
// Created by Marco Arment on 9/23/24.
//
// Released into the public domain. Do whatever you'd like with this.
// No guarantees that it'll do anything, or do it correctly. Good luck!
//
import Foundation
@xbmcnut
xbmcnut / shelly_pir.yaml
Last active May 20, 2024 01:01
Making an outdoor motion sensor smart using a Shelly 1
/**
* I figured out you can fit a Shelly 1 inside the case of many outdoor motion sensors.
* Coupled with that fact that recently, Shelly added a feature to de-couple the switch from the relay
* so they act independently, makes this a great combo! Simply wire the output of the PIR motion sensor
* (the wire that normally goes to your outdoor light) to the switch input of the Shelly and wire
* the lightbulb to the L output of the Shelly. Then, in the Shelly app or directly via the devices webpage,
* select the button type as 'Detached Switch' and use the code below to make it work normally.
* Don't forget to adjust the daylight sensitivity to full daylight if you want the motion detection to work 24/7.
*/
@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
@christoph2
christoph2 / KNXSchema.xsd
Created September 15, 2016 14:19
KNX ETS4 XML Schema
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:knx="http://knx.org/xml/project/11" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://knx.org/xml/project/11" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
<!-- Simple types -->
<xs:simpleType name="IDREF">
<xs:restriction base="xs:NCName"/>
</xs:simpleType>
<xs:simpleType name="IDREFS">
<xs:list itemType="knx:IDREF"/>
</xs:simpleType>
<xs:simpleType name="Capabilities_t">
@zwaldowski
zwaldowski / Extra Logging for My Great App.mobileconfig
Last active March 28, 2025 03:47
Apple Configuration Profile for Logging in iOS 10 and macOS Sierra
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<!-- iOS 10, macOS Sierra, and friends bring a new logging subsystem that's
supposed to scale from the kernel, up to frameworks, and up to apps. It defaults
to a more regimented, privacy-focused approach that large apps and complex
systems need.
It, along with Activity Tracing introduced in iOS 8 and macOS Yosemite and the
Console app in macOS Sierra, hope to help you graduate from caveman debugging to

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@zwaldowski
zwaldowski / Activity.swift
Last active November 3, 2024 17:37
os_activity_t for Swift 3
//
// Activity.swift
//
// Created by Zachary Waldowski on 8/21/16.
// Copyright © 2016 Zachary Waldowski. Licensed under MIT.
//
import os.activity
private final class LegacyActivityContext {
@fardjad
fardjad / batch-m4a-to-mp3.md
Last active February 28, 2024 16:37
[How to Convert m4a Files to mp3, Preserving Bitrate and ID3 Tags Using ffmpeg] #ffmpeg #bash

How to convert m4a files to mp3, preserving bitrate and id3 tags using ffmpeg

Prerequisites

  1. ffmpeg
  2. cygwin (on windows)

Commands

cd /path/to/m4a/files
mkdir out
for f in *.m4a; do 
@vsouza
vsouza / .bashrc
Last active March 7, 2025 09:42
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@kristopherjohnson
kristopherjohnson / KDJKeychainItemWrapper.h
Created March 21, 2013 12:18
My version of the KeychainItemWrapper class from Apple's GenericKeychain sample, converted to ARC and modernized
// Based upon code from Apple's "GenericKeychain" sample application
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple