This is a simple log watcher written in python 3, works similar to swatch (perl).
DEPRECATION WARNING: maybe you would like more this one https://gist.github.com/iacchus/acbd0ca89c1bd4a1deb7a472dfee931b
#!/usr/bin/env python3
# follow.py| #!/usr/bin/env python3 | |
| # follow.py | |
| # | |
| # Follow a file like tail -f. | |
| import sys | |
| import time | |
| from iplib import check_ip as CHECKIP |
This is a simple log watcher written in python 3, works similar to swatch (perl).
DEPRECATION WARNING: maybe you would like more this one https://gist.github.com/iacchus/acbd0ca89c1bd4a1deb7a472dfee931b
#!/usr/bin/env python3
# follow.py| <script src="https://rawgit.com/paulrosen/abcjs/master/bin/abcjs_plugin_3.1.1-min.js"></script> | |
| <script> | |
| abcjs_plugin_autostart = false; | |
| window.ABCJS.plugin.auto_render = false; | |
| ABCJS.plugin.hide_abc = true; | |
| ABCJS.plugin.render_options = { | |
| scale: 1, | |
| staffwidth:700, | |
| paddingtop: 0, |
| import subprocess | |
| import time | |
| def wait(seconds): | |
| time.sleep(seconds) | |
| def play_note(note='C', duration=4, delay=0): | |
| # requires sox to be installed |
| #!env ruby | |
| # | |
| # brew install sox | |
| # | |
| def play(note, octave=1) | |
| "play -q -n synth sq #{note}#{octave} remix - fade 0 .6 .1 norm; " | |
| end | |
| song_notes = %w(B A G A B B B A A A G D D B A G A B B B B A A B A G) |
| if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then | |
| tmux attach-session -t "$USER" || tmux new-session -s "$USER" | |
| fi |
| #!/usr/bin/env python3 | |
| import sys, os | |
| linelist = list(sys.stdin) | |
| # gets the biggest line | |
| biggest_line_size = 0 | |
| for line in linelist: | |
| line_lenght = len(line.expandtabs()) |
| #!/usr/bin/env python3 | |
| # 1. Just fill 'app token' and 'user key' below, | |
| # 2. make the script executable: chmod +x simple-python-pushover.py | |
| # 3. run in command line. | |
| # Dependencias are python3 and `requests` lib | |
| APP_TOKEN = '' | |
| USER_KEY = '' | |
| import requests as r |
| #!/usr/bin/env python3 | |
| # usage | |
| # | |
| # 1. Make the above script executable: | |
| # chmod +x logwatcher.py | |
| # | |
| # 2. Add a cronjob to start it after reboot like: | |
| # @reboot /home/YOURUSERNAME/logwatcher.py "/var/log/auth.log" "session opened for user" "/sbin/myscript.sh" | |
| # | |
| # arguments are: |