https://github.com/taigrr/spank
Slap your MacBook, it yells back. Uses Apple Silicon accelerometer via IOKit HID.
https://github.com/taigrr/spank
accelerometer apple-silicon fun go iokit macos
Last synced: 28 days ago
JSON representation
Slap your MacBook, it yells back. Uses Apple Silicon accelerometer via IOKit HID.
- Host: GitHub
- URL: https://github.com/taigrr/spank
- Owner: taigrr
- License: mit
- Created: 2026-02-23T00:43:05.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2026-02-28T02:32:11.000Z (about 1 month ago)
- Last Synced: 2026-02-28T14:58:32.334Z (about 1 month ago)
- Topics: accelerometer, apple-silicon, fun, go, iokit, macos
- Language: Go
- Size: 938 KB
- Stars: 634
- Watchers: 1
- Forks: 28
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- stars - taigrr/spank
- awesome-ccamel - taigrr/spank - Slap your MacBook, it yells back. Uses Apple Silicon accelerometer via IOKit HID. (Go)
README
# spank
Slap your MacBook, it yells back.
> "this is the most amazing thing i've ever seen" — [@kenwheeler](https://x.com/kenwheeler)
> "I just ran sexy mode with my wife sitting next to me...We died laughing" — [@duncanthedev](https://x.com/duncanthedev)
> "peak engineering" — [@tylertaewook](https://x.com/tylertaewook)
Uses the Apple Silicon accelerometer (Bosch BMI286 IMU via IOKit HID) to detect physical hits on your laptop and plays audio responses. Single binary, no dependencies.
## Requirements
- macOS on Apple Silicon (M2+)
- `sudo` (for IOKit HID accelerometer access)
## Install
Download from the [latest release](https://github.com/taigrr/spank/releases/latest).
Or build from source:
```bash
go install github.com/taigrr/spank@latest
```
## Usage
```bash
# Normal mode — says "ow!" when slapped
sudo spank
# Sexy mode — escalating responses based on slap frequency
sudo spank --sexy
# Halo mode — plays Halo death sounds when slapped
sudo spank --halo
```
### Modes
**Pain mode** (default): Randomly plays from 10 pain/protest audio clips when a slap is detected.
**Sexy mode** (`--sexy`): Tracks slaps within a rolling 5-minute window. The more you slap, the more intense the audio response. 60 levels of escalation.
**Halo mode** (`--halo`): Randomly plays from death sound effects from the Halo video game series when a slap is detected.
## How it works
1. Reads raw accelerometer data directly via IOKit HID (Apple SPU sensor)
2. Runs vibration detection (STA/LTA, CUSUM, kurtosis, peak/MAD)
3. When a significant impact is detected, plays an embedded MP3 response
4. 500ms cooldown between responses to prevent rapid-fire
## Credits
Sensor reading and vibration detection ported from [olvvier/apple-silicon-accelerometer](https://github.com/olvvier/apple-silicon-accelerometer).
## License
MIT