Skip to content

Instantly share code, notes, and snippets.

@Thesola10
Last active January 31, 2022 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thesola10/e9c4cbff8c4b9020c474d2de2ba1a4f0 to your computer and use it in GitHub Desktop.
Save Thesola10/e9c4cbff8c4b9020c474d2de2ba1a4f0 to your computer and use it in GitHub Desktop.
(in)elegant weapons, for a more civilized age.
#!/usr/bin/env python3
# key-gnat by Karim Vergnes <me@thesola.io>
# License: WTFPL 1.0
# Requires evdev python to be installed
from evdev import UInput, ecodes as e
import random, time
ui = UInput(name="Unsuspicious keyboard™")
while True:
nxt = random.randint(16, 49)
ui.write(e.EV_KEY, nxt, 1)
ui.syn()
ui.write(e.EV_KEY, nxt, 0)
ui.syn()
tnxt = random.randint(20, 100)
print("Sleeping for %d seconds..." %tnxt)
time.sleep(tnxt)
@Thesola10
Copy link
Author

In a nutshell, key-gnat just creates a keyboard which will press one letter at random every 20 to 100 seconds. Just enough to annoy most people.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment