Skip to content

Instantly share code, notes, and snippets.

View gregschmit's full-sized avatar

Greg Schmit gregschmit

View GitHub Profile
@gregschmit
gregschmit / test.yml
Created November 13, 2020 22:06
Test rXg Config Template
mac_groups:
- name: Test
policy: Default
priority: 9
macs:
- 5c:b9:01:0e:26:a8
@gregschmit
gregschmit / echo.flask.py
Last active September 22, 2022 21:33
Echoing Flask App
import argparse
from flask import Flask, Response, request
from termcolor import colored
from werkzeug.serving import WSGIRequestHandler
app = Flask(__name__)
ALLOWED_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']
@app.route('/', defaults={'path': ''}, methods=ALLOWED_METHODS)
from django.contrib.auth.models import User
from django.core.urlresolvers import resolve
from django.test import RequestFactory
def profile_request(url='/', username='gschmit'):
# perform a GET for the profiler
u = User.objects.get(username=username)
rf = RequestFactory()
request = rf.get(url)
request.user = u
@gregschmit
gregschmit / version.py
Last active July 13, 2019 03:13
A `version.py` to include in Django apps that provides an interface for git versioning. In `setup.py` (in the parent directory) you can `from purge import version` and then use `version.get_version()` to get the version programmatically.
"""
This module provides versioning hooks for a Python package in a Git repository.
Verbiage: MAJOR.MINOR.PATCH
To start versioning at 0.1.x, just do ``git tag -a v0.1 -m 'version 0.1'``. Each
commit will increment the PATCH level by 1 according to this module's
``get_version()``. When you want to increment the MINOR, just do ``git tag -a
v0.2 -m 'version 0.2'``.