-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
rick_roll.py
34 lines (26 loc) · 837 Bytes
/
rick_roll.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Programmed for Windows 10, but adjustable for every operating system
import time
import board
import usb_hid
from adafruit_hid.keyboard import Keyboard, Keycode
from keyboard_layout_win_de import KeyboardLayout
from neopixel import NeoPixel
led = NeoPixel(board.GP16, 1)
led.fill((0, 0, 255))
try:
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayout(keyboard)
time.sleep(2.5)
led.fill((0, 255, 255))
keyboard.send(Keycode.WINDOWS, Keycode.R)
time.sleep(0.3)
keyboard_layout.write('cmd.exe /k "start https://www.youtube.com/watch?v=dQw4w9WgXcQ" && exit')
keyboard.send(Keycode.ENTER)
time.sleep(1.5)
keyboard.send(Keycode.F11)
keyboard.release_all()
led.fill((0, 255, 0))
except Exception as ex:
led.fill((255, 0, 0))
keyboard.release_all()
raise ex