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
from __future__ import (absolute_import, division, print_function) | |
__metaclass__ = type | |
import sys | |
from ansible import constants as C | |
from ansible.plugins.callback.default import CallbackModule as CallbackModule_default | |
from ansible.utils.color import colorize, hostcolor | |
def _color(play): |
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
import os | |
import fcntl | |
import signal | |
import time | |
import contextlib | |
class Genius(object): | |
''' | |
A genius is basically a roman daemon. It differs from python-daemon | |
in the following ways: |
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/env python2.7 | |
# -*- coding: UTF-8 -*- | |
# File: daemonlib.py | |
"""An example of a Linux daemon written in Python. | |
Based on http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ | |
The changes are: | |
1 - Uses file open context managers instead of calls to file(). | |
2 - Forces stdin to /dev/null. stdout and stderr go to log files. |
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/env python | |
# Mkxtemp - a temporary file context manager for use by external processes | |
# Placed in the Public Domain by Santtu Pajukanta <santtu@pajukanta.fi> 2012 | |
from contextlib import contextmanager | |
from tempfile import NamedTemporaryFile | |
import os | |
import unittest |
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
# -*- perl -*- | |
# This content should be added to a (new) file at ".../perllib/Devel/Trace.pm". | |
# Usage: perl -d:Trace <script.pl> | |
package Devel::Trace; | |
$VERSION = '0.12'; | |
$TRACE = 1; | |
# This is the important part. The rest is just fluff. |
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
import re | |
import sys | |
# note, currently doesn't handle: | |
# Jun 29 00:00:03 host tag: message repeated 3 times: [ 192.168.1.1 - - "POST /api/someendpoint/ | |
r = re.compile(r'(\w{3,}\s+\d{2,}\s+\d{2,}:\d{2,}:\d{2,})\s+([\w-]+)\s+([\w-]+):\s+((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3},?\s?)+)\s+-\s+-\s+\"(GET|POST|PUT|PATCH|HEAD|DELETE) ((\/[\w_]+)+)\/\??(.*) HTTP\/\d\.\d" (\d{3,}) (\d+|-)') | |
anonymizers = ( | |
(re.compile(r'(\d+,?)+'), 'id'), # one or more optionally csv separated ids |
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
#!/bin/sh | |
# | |
# 00-header - create the header of the MOTD | |
# Copyright (c) 2013 Nick Charlton | |
# Copyright (c) 2009-2010 Canonical Ltd. | |
# | |
# Authors: Nick Charlton <hello@nickcharlton.net> | |
# Dustin Kirkland <kirkland@canonical.com> | |
# | |
# This program is free software; you can redistribute it and/or modify |
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
#!/bin/python3 | |
# author: Jan Hybs | |
# example here: | |
# http://ciflow.nti.tul.cz/status/release/test/5 | |
import urllib.request | |
import pathlib | |
import json | |
import io | |
from flask import Blueprint, send_file, Response |
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
//: A Cocoa based Playground to present user interface | |
import AppKit | |
import PlaygroundSupport | |
import Foundation | |
import CoreImage | |
import ImageIO | |
let nibFile = NSNib.Name("MyView") | |
var topLevelObjects : NSArray? |
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
import Foundation | |
let json = """ | |
{ | |
"data": { | |
"items": [ | |
{ "name": "Alice" }, | |
{ "name": "Bob" }, | |
{ "name": "Claudia" } | |
] |
OlderNewer