Skip to content

Instantly share code, notes, and snippets.

View chmeliuk's full-sized avatar

Denys Chmeliuk chmeliuk

View GitHub Profile
@chmeliuk
chmeliuk / server.py
Created October 4, 2024 12:10 — forked from AutumnSun1996/server.py
prefect server with apikey and basic auth
"""A simple wrapper for prefect server, with apikey and basic auth check.
usage:
```bash
# Allow prefect cli to access the server with same PREFECT_API_KEY.
PREFECT_API_KEY=XX
# base64 encoded `username:password`. Allow users to access the server with user:password.
PREFECT_BASIC_AUTH=XX
# start server
uvicorn --host $PREFECT_SERVER_API_HOST --port $PREFECT_SERVER_API_PORT --factory server:create_auth_app

generate random password nix

/dev/urandom

cat /dev/urandom | env LC_CTYPE=C tr -dc [:alnum:] | fold -w12 | head -n5

[:alnum:] means digits, upper- and lowercase letters. ouput example:

wdchq6n3IKCD
9O83fOXlFK2C
@chmeliuk
chmeliuk / phalcon-events.list
Created January 6, 2016 13:02 — forked from xboston/phalcon-events.list
Phalcon events:list
dispatch:beforeDispatchLoop
dispatch:beforeDispatch
dispatch:beforeNotFoundAction
dispatch:beforeExecuteRoute
dispatch:afterInitialize
dispatch:afterExecuteRoute
dispatch:afterDispatch
dispatch:afterDispatchLoop
dispatch:beforeException
@chmeliuk
chmeliuk / freeipa_json_metadata.json
Last active August 29, 2015 13:57
freeipa json metadata
This file has been truncated, but you can view the full file.
{
"error": null,
"id": 0,
"principal": "admin@host",
"result": {
"commands": {
"aci_add": {
"name": "aci_add",
"takes_args": [],
"takes_options": [
@chmeliuk
chmeliuk / freeipa.py
Created March 20, 2014 10:27
FreeIPA web call from Python
import kerberos
import sys
import os
from requests.auth import AuthBase
import requests
import json
class IPAAuth(AuthBase):
def __init__(self, hostname, keytab):
self.hostname = hostname