Skip to content

Instantly share code, notes, and snippets.

View acwright's full-sized avatar

Aaron Wright acwright

View GitHub Profile
@acwright
acwright / on.sh
Created May 6, 2021 21:08
Matrix On Script
echo "ON"
echo "STATE" > ~/scripts/state.flag
sudo systemctl start matrix
@acwright
acwright / off.sh
Created May 6, 2021 21:07
Matrix Off Script
echo "OFF"
rm ~/scripts/state.flag
sudo systemctl stop matrix
@acwright
acwright / matrix.service
Created May 6, 2021 21:03
Matrix Service
[Unit]
Description=Matrix
After=multi-user.target
[Service]
Type=simple
ExecStart=/bin/sh -c '/usr/bin/sudo /home/pi/rpi-rgb-led-matrix/utils/led-image-viewer -f -s -w5 /home/pi/images/*.jpeg /home/pi/images/*.jpg /home /home/pi/images/*.png /home/pi/images/*.gif --led-gpio-mapping=adafruit-hat-pwm --led-cols=64 --led-rows=64'
User=pi
@acwright
acwright / afp.conf
Created May 6, 2021 20:54
Netatalk Config
;
; Netatalk 3.x configuration file
;
[Global]
; Global server settings
; [Homes]
; basedir regex = /xxxx
@acwright
acwright / homebridge-script2-config.json
Created May 6, 2021 20:40
Homebridge-script2 Config
{
"accessory": "Script2",
"name": "LED Matrix",
"on": "~/scripts/on.sh 1",
"off": "~/scripts/off.sh 1",
"fileState": "~/scripts/state.flag"
}
@acwright
acwright / fileImporter.swift
Last active October 23, 2021 01:21
fileImporter
.fileImporter(
isPresented: $isImporting,
allowedContentTypes: [.plainText],
allowsMultipleSelection: false
) { result in
do {
guard let selectedFile: URL = try result.get().first else { return }
guard let message = String(data: try Data(contentsOf: selectedFile), encoding: .utf8) else { return }
document.message = message
@acwright
acwright / fileExporter.swift
Created August 27, 2020 20:06
fileExporter
.fileExporter(
isPresented: $isExporting,
document: document,
contentType: .plainText,
defaultFilename: "Message"
) { result in
if case .success = result {
// Handle success.
} else {
// Handle failure.
@acwright
acwright / ContentView.swift
Created August 27, 2020 19:49
ContentView
struct ContentView: View {
@State private var document: MessageDocument = MessageDocument(message: "Hello, World!")
@State private var isImporting: Bool = false
@State private var isExporting: Bool = false
var body: some View {
VStack {
GroupBox(label: Text("Message:")) {
TextEditor(text: $document.message)
@acwright
acwright / MessageDocument.swift
Created August 27, 2020 19:38
MessageDocument
import SwiftUI
import UniformTypeIdentifiers
struct MessageDocument: FileDocument {
static var readableContentTypes: [UTType] { [.plainText] }
var message: String
init(message: String) {
@acwright
acwright / ContentView.swift
Created July 26, 2020 20:04
DocExample ContentView.swift
@ObservedObject var document: DocExampleDocument