This file contains hidden or 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
| import argparse | |
| import time | |
| GB = 1024 * 1024 * 1024 | |
| def parse_cmd_args(): | |
| """ | |
| Parses command line args | |
| """ | |
| parser = argparse.ArgumentParser(description='Memory Eating utility for python') |
This file contains hidden or 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
| # kill all of the user processes | |
| ps -u amonagent | grep -v PID | awk '{print $1}' | xargs -i kill {} | |
| sleep 2 | |
| ps -u amonagent | grep -v PID | awk '{print $1}' | xargs -i kill {} | |
| # Systemd | |
| if which systemctl > /dev/null 2>&1 ; then | |
| systemctl stop amonagent | |
| # Sysv | |
| else |
This file contains hidden or 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
| daemon off; | |
| worker_processes 1; | |
| events { worker_connections 1024; } | |
| http{ | |
| sendfile on; |
This file contains hidden or 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
| def application(environ, start_response): | |
| from pyinfo import pyinfo | |
| output = pyinfo() | |
| # or pyinfo([('custom key', 'custom value'), ...]) | |
| start_response('200 OK', [('Content-type', 'text/html')]) | |
| return [output] |
This file contains hidden or 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/env python | |
| ######################################################################### | |
| # # | |
| # Script for finding neighbor web servers in local network # | |
| # # | |
| # Author: Hugo Duksis <duksis@gmail.com> # | |
| # Usage: python neighbor_search.py | |
| # TODO: move pinging in multiple treads to increase performance # | |
| # # |
This file contains hidden or 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
| """ | |
| Extract unique Python-Exceptions with their Traceback from a log/text file. | |
| Usage:: | |
| python extract_exceptions.py -f logfile.txt | |
| Furthermore it supports excluding exceptions you don't want to have:: | |
| python extract_exceptions.py -f logfile.txt -e ValueError,AttributeError |