Skip to content

Instantly share code, notes, and snippets.

View brennanMKE's full-sized avatar

Brennan Stehling brennanMKE

View GitHub Profile

The Flaschen Tachen is a great way to give members of Noisebridge a system which is hackable. What are other systems that Hackspaces have made which were hackable?

Hackspaces and makerspaces around the world often create unique, hackable systems that embody the spirit of innovation and open-source technology. Here are some notable examples:

  1. Interactive LED Walls: Similar to the Flaschen Taschen at Noisebridge, other spaces have created large-scale LED displays that can be programmed and controlled by members.

  2. Hackable Door Access Systems: Many hackspaces develop their own electronic access systems, allowing members to experiment with RFID, NFC, or even biometric access controls.

  3. DIY 3D Printers and CNC Machines: Custom-built or modified 3D printers and CNC machines are common. These not only serve a practical purpose but also provide a platform for learning and experimentation in hardware and software.

@brennanMKE
brennanMKE / AutomaticNetworking.cpp
Created January 15, 2024 07:58
ESP32 controller for lights
#include "AutomaticNetworking.h"
#define ATTEMPT_MAX 10
#define ATTEMPT_DELAY 500
AutomaticNetworking::AutomaticNetworking() {
// Constructor - You can initialize variables here if needed
}
bool AutomaticNetworking::connect() {
@brennanMKE
brennanMKE / NoDelay.ino
Last active December 27, 2023 04:48
LED light control without delays
/**
LED lights control with no delays.
The Blink example Sketch for Arduino uses delays to control the built-in LED to turn
it on and off repeatedly. Since the next loop is delayed nothing else can be done
while until the delay expires. This Sketch controls the built-in LED and a strip of
10 LED lights without delays. It sets timeouts so that once the current clock passes
the timeout it can trigger an action. There is an interval for the blink and color
change which cycles through the list of colors and blinks a number of times for the
current color position.
@brennanMKE
brennanMKE / QRCode.swift
Created November 27, 2023 18:58
Create QR code
import CoreImage
struct QRCode {
static func generateQRCode(from url: String,
width: Double = 512.0,
heigth: Double = 512.0,
foregroundColor: CIColor = .black,
backgroundColor: CIColor = .white) -> CGImage? {
let data = url.data(using: String.Encoding.ascii)
@brennanMKE
brennanMKE / OpenWeatherMapKey.cpp
Created November 26, 2023 07:09
Networking with ESP32 Microcontroller
#include "OpenWeatherMapKey.h"
const char* OpenWeatherMapKey::key() {
return "INSERT_HERE";
}
@brennanMKE
brennanMKE / DataProvider.swift
Last active December 14, 2023 19:51
DataProvider using AsyncStream
import Foundation
struct DataProvider<Element: Sendable> {
let stream: AsyncStream<Element>
private let continuation: AsyncStream<Element>.Continuation
init(bufferingPolicy: AsyncStream<Element>.Continuation.BufferingPolicy = .unbounded) {
(stream, continuation) = AsyncStream.makeStream(bufferingPolicy: bufferingPolicy)
}
@brennanMKE
brennanMKE / README.md
Created October 28, 2023 01:56
ChatGPT and Swift Concurrency

ChatGPT and Swift Concurrency

Prompt:

What can you tell me about Swift Concurrency, Tasks, Actors and AsyncSequence?

Response:

Certainly! Swift introduced a native concurrency model starting from Swift 5.5, which brings a structured way to handle concurrent and asynchronous programming. Here's an overview of the main components:

@brennanMKE
brennanMKE / JoystickArrowKeys.ino
Created October 17, 2023 05:34
Pro Micro project that uses an arcade joystick as arrow keys.
// Joystick Keyboard
// This project is for a digital joystick (SANWA JLF-TP-8YT)
// connected to a Pro Micro board.
#include "Keyboard.h"
const int pinUp = 2; // Orange
const int pinDown = 3; // Red
const int pinLeft = 4; // Yellow
const int pinRight = 5; // Green
@brennanMKE
brennanMKE / BlockerPlayground.swift
Created October 10, 2023 20:31
Blocking code to integrate Swift Concurrency with legacy code which cannot be async
/// Sometimes it is necessary to integrate straight-line code with async code
/// and this can be done using a semaphore. Keep in mind that doing this breaks
/// the Forward Progress policy that is required by Swift Concurrency.
///
/// Warning: This code is not recommended for a production environment.
import Foundation
struct Blocker<Success, Failure: Error> {
private class ResultStore {
@brennanMKE
brennanMKE / README.md
Created October 2, 2023 22:37
Groups with ActivityPub

Groups with ActivityPub

Prompt:

I'd like to create a groups implementation using ActivityPub which allows members to join groups to share posts only members of the group can see and reply to. I also want to support photo albums and events with RSVP lists. Can this be implemented within the ActivityPub protocol using Activity Streams and Actors?

Response:

Yes, you can implement this functionality using the ActivityPub protocol with Activity Streams and Actors. The protocol is highly flexible and supports a wide variety of use cases, including the ones you've mentioned. Let's break down the process for each of the features you've listed: