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
from typing import Any, Dict, List, Mapping, Union | |
# Values for JSON that aren't nested | |
JSON_v = Union[str, int, float, bool, None] | |
# If MyPy ever permits recursive definitions, just uncomment this: | |
# JSON = Union[List['JSON'], Mapping[str, 'JSON'], JSON_v] | |
# Until then, here's a multi-layer way to represent any (reasonable) JSON we | |
# might send or receive. It terminates at JSON_4, so the maximum depth of |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style rel="stylesheet" type="text/less"> | |
* { | |
margin: 0; | |
padding: 0; |
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 base64 | |
import hmac | |
import hashlib | |
from urllib import parse | |
from django.contrib.auth.decorators import login_required | |
from django.http import HttpResponseBadRequest, HttpResponseRedirect | |
from django.conf import settings | |
@login_required |
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 | |
[ -z "$GITHUB_SSH_URL" ] && echo "You need to set GITHUB_SSH_URL - e.g. [email protected]:user/repository.git" && exit 1; | |
[ -z "$ANSIBLE_PLAYBOOK" ] && echo "You need to set ANSIBLE_PLAYBOOK - e.g. ANSIBLE_PLAYBOOK=deploy.yml" && exit 1; | |
[ -z "$ANSIBLE_HOSTS" ] && echo "You need to set ANSIBLE_HOSTS - e.g. ANSIBLE_HOSTS=host.ini" && exit 1; | |
[ -z "$ANSIBLE_ROLES_FOLDER" ] && echo "You need to set ANSIBLE_ROLES_FOLDER - e.g. ANSIBLE_ROLES_FOLDER=/var/tmp/user-repository/roles" && exit 1; | |
[ -z "$ANSIBLE_REQUIREMENTS_FILE" ] && echo "You need to set ANSIBLE_REQUIREMENTS_FILE - e.g. ANSIBLE_REQUIREMENTS_FILE=/var/tmp/user-repository/requirements.yml" && exit 1; | |
[ -z "$ANSIBLE_SSH_USER" ] && echo "You need to set ANSIBLE_SSH_USER - e.g. ANSIBLE_SSH_USER=user" && exit 1; | |
[ -z "$GIT_REPOSITORY" ] && echo "You need to set GIT_REPOSITORY - e.g. GIT_REPOSITORY=/var/tmp/user-repository" && exit 1; | |
[ -z "$GITHUB_BRANCH" ] && echo "You need to set GITHUB_BRANCH - e.g. GITHUB_BRANCH=master" && exit |
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 | |
import gzip | |
import os | |
import sys | |
import re | |
INPUT_DIR = "nginx-logs" | |
lineformat = re.compile(r"""(?P<ipaddress>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(?P<dateandtime>\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\] ((\"(GET|POST) )(?P<url>.+)(http\/1\.1")) (?P<statuscode>\d{3}) (?P<bytessent>\d+) (["](?P<refferer>(\-)|(.+))["]) (["](?P<useragent>.+)["])""", re.IGNORECASE) |
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 | |
import argparse | |
import sys | |
import jinja2 | |
import markdown | |
TEMPLATE = """<!DOCTYPE html> | |
<html> |