Slap your Linux laptop, it yells back.
Inspired by taigrr's spank for MacBooks, featured in this viral tweet. Switched from Go to C++, and for Linux laptops instead of MacBooks.
Uses the laptop's accelerometer via the Linux IIO (Industrial I/O) subsystem to detect physical hits on your laptop and plays audio responses using miniaudio.
- Laptop running Linux and with an accelerometer (typically featured in 2-in-1 laptops like the HP Spectre/Pavilion x360 series).
g++cmakeninjaormake
git clone https://github.com/dhanushka2001/spankcd spank
mkdir build
cd build
cmake .. -G Ninja
ninjaAnd run:
./slapPain mode: Randomly plays from 10 pain/protest audio clips when a slap is detected.
Sexy mode: Randomly plays NSFW moaning sounds (legacy feature, not my idea don't sue me).
Halo mode: Randomly plays from death sound effects from the Halo video game series when a slap is detected.
Anime mode: yamete-kudasai.mp3
Use this command to get list of IIO devices:
grep -R . /sys/bus/iio/devices/iio:device*/nameUse this command to watch the value of the accelerometer (replacing iio:device3/in_accel_x_raw if needed):
watch -n 0.05 cat /sys/bus/iio/devices/iio:device3/in_accel_x_rawThese settings can be tuned in main.cpp, in the future I may make these input parameters:
// tune these
double threshold = 500.0;
double upper_bound = 1000000.0;
std::chrono::milliseconds listening_time(700);
std::chrono::milliseconds sleep_time(200);