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/python3 | |
| """ Demonstration of logging feature for a Flask App. """ | |
| from logging.handlers import RotatingFileHandler | |
| from flask import Flask, request, jsonify | |
| from time import strftime | |
| __author__ = "@ivanleoncz" | |
| import logging |
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/python | |
| import re | |
| import time | |
| import logging | |
| from os import stat | |
| from stat import ST_SIZE | |
| from flumelogger.handler import FlumeHandler | |
| FILE_INPUT = "/var/log/jenkins/jenkins.log" | |
| MULTILINE_PATTERN_RE = r"^\w+ \d+, \d+ (\d+?:){1,2}\d\d \w\w " |
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
| # 1. Make sure you have nginx sub module compiled in | |
| # nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module' | |
| # 2. add two directives below at HTTP level | |
| # nginx.conf | |
| http { | |
| # ...... | |
| sub_filter '</head>' '<style type="text/css">html{ filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */ |
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
| # -*- coding: utf-8 -*- | |
| # Modified lightsocket import script, based on Lightsocket | |
| # example script by James Thornton (http://jamesthornton.com) | |
| # mundane modification stuff | |
| import os | |
| import commands | |
| import sys | |
| import datetime | |
| import re # regexp |
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
| #!/bin/bash | |
| function usage() { | |
| cat <<USAGE | |
| usage: $0 options | |
| Dump all beans (and values) from a JMX server. | |
| OPTIONS: | |
| -h Show this message |
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
| <?php | |
| // quick and dirty argument parsing | |
| foreach ($argv as $arg) { | |
| if ($arg == '-f') { | |
| define('FOLLOW', true); | |
| } | |
| if ($arg == '-h') { | |
| define('HISTOGRAM', true); | |
| } |
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 | |
| """Proxy""" | |
| import urllib | |
| import json | |
| import tornado.httpserver | |
| import tornado.ioloop | |
| import tornado.web | |
| import tornado.wsgi | |
| import tornado.httpclient |
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
| """ | |
| This is a simple example of WebSocket + Tornado + Redis Pub/Sub usage. | |
| Do not forget to replace YOURSERVER by the correct value. | |
| Keep in mind that you need the *very latest* version of your web browser. | |
| You also need to add Jacob Kristhammar's websocket implementation to Tornado: | |
| Grab it here: | |
| http://gist.github.com/526746 | |
| Or clone my fork of Tornado with websocket included: | |
| http://github.com/pelletier/tornado | |
| Oh and the Pub/Sub protocol is only available in Redis 2.0.0: |