Add clicker and log_cleaner scripts
This commit is contained in:
parent
61f032ee2b
commit
c47fb53c10
42
clicker.py
Normal file
42
clicker.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
import mouse
|
||||||
|
import keyboard
|
||||||
|
import threading
|
||||||
|
import time
|
||||||
|
|
||||||
|
event = threading.Event()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
mouse.hook(mouse_cb)
|
||||||
|
keyboard.hook(keyboard_cb)
|
||||||
|
|
||||||
|
toggle = True
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if False == event.wait(timeout=300.0):
|
||||||
|
if toggle:
|
||||||
|
mouse.move("950", "1060")
|
||||||
|
toggle = False
|
||||||
|
else:
|
||||||
|
mouse.move("970", "1060")
|
||||||
|
toggle = True
|
||||||
|
mouse.click()
|
||||||
|
|
||||||
|
event.clear()
|
||||||
|
time.sleep(1) #no need to poll like crazy
|
||||||
|
|
||||||
|
mouse.unhook()
|
||||||
|
keyboard.unhook()
|
||||||
|
|
||||||
|
|
||||||
|
def keyboard_cb(keyboard_event):
|
||||||
|
event.set()
|
||||||
|
|
||||||
|
def mouse_cb(mouse_event):
|
||||||
|
event.set()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
||||||
33
log_cleaner.py
Normal file
33
log_cleaner.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# log_cleaner
|
||||||
|
# 22/03/2022
|
||||||
|
# tool script used to remove unwanted lines from log files
|
||||||
|
#
|
||||||
|
# usage ex: python log_cleaner.py file pattern
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
import io
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
input_file = io.open(sys.argv[1], "r", encoding="utf-8")
|
||||||
|
output_file = io.open("new_" + sys.argv[1], "w", encoding="utf-8")
|
||||||
|
|
||||||
|
pattern = sys.argv[2]
|
||||||
|
p = re.compile(r".*" + pattern + r".*")
|
||||||
|
|
||||||
|
for line in input_file:
|
||||||
|
val = re.search(p, line)
|
||||||
|
if val:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
output_file.write(line)
|
||||||
|
|
||||||
|
output_file.close()
|
||||||
|
input_file.close()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user