Skip to content

dhanushka2001/spank-linux

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

DEPRECATED

Active at https://github.com/dhanushka2001/spank

spank-linux

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.

Requirements

  • Laptop running Linux and with an accelerometer (typically featured in 2-in-1 laptops like the HP Spectre/Pavilion x360 series).
  • g++
  • cmake
  • ninja or make

Install

git clone https://github.com/dhanushka2001/spank-linux
cd spank-linux
mkdir build
cd build
cmake .. -G Ninja
ninja

And run:

./slap

Modes

Pain mode: Randomly plays from 10 pain/protest audio clips when a slap is detected.

Sexy mode: Randomly plays NSFW moaning sounds (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

Debugging

Use this command to get list of IIO devices:

grep -R . /sys/bus/iio/devices/iio:device*/name

Use 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_raw

These 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);

About

Slap your Linux laptop, it yells back. Uses laptop accelerometer via Linux IIO (Industrial I/O) subsystem.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages

  • C++ 100.0%