Last active
June 13, 2018 22:00
-
-
Save tonyskapunk/ebf3cc3d09555a55b48ffd43b4ab255f to your computer and use it in GitHub Desktop.
roulette
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from random import choice | |
from signal import Signals | |
from os import listdir, kill | |
def main(): | |
while true: | |
# Get random a signal | |
lucky_signal = choice(list(Signals)) | |
# Get a random pid | |
proc = listdir('/proc') | |
index_one = proc.index('1') | |
pids = proc[60:] | |
lucky_pid = choice(pids) | |
if lucky_signal.value == lucky_pid: | |
break | |
print(f'Sending SIGNAL:{lucky_signal} to PID: {lucky_pid}') | |
kill(lucky_pid, lucky_signal) | |
if __name__ == "__main__": | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do | |
if [[ $(( ${RANDOM} % 9 + 1 )) -eq $(( ${RANDOM} % 9 + 1 )) ]]; then | |
break | |
fi | |
sudo kill -$(( ${RANDOM} % 9 + 1 )) $(( ${RANDOM} % 9 + 1 )) &>/dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment