parser = RawParser('example.py -x Xparam1 -y Yparam1-0,Yparam1-1 -y "Yparam 2" -z Zparam1 --zet=Zparam2 --zet="Zparam 3"')
parser.add_arg('-x')
parser.add_arg('-y', splitter=",")
parser.add_arg('-z', 'zet')
parser.parse_args()
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
#ifndef _GNU_SOURCE | |
#define _GNU_SOURCE | |
#endif | |
#include <stdio.h> | |
#include <sys/mman.h> | |
#include <elf.h> | |
#include <assert.h> | |
/** |
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 argparse | |
import os | |
import sys | |
import re | |
import geoip2.database | |
from geoip2.errors import AddressNotFoundError | |
# pip install geoip2 |
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 kubernetes import client | |
from kubernetes.stream import stream | |
import os | |
import sys | |
if len(sys.argv) < 4: | |
print(f"Usage: {sys.argv[0]} <pod_name> <container_name> <command>") | |
sys.exit(1); |
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
""" | |
Name Generator with Python. | |
Ref; https://github.com/moby/moby/blob/c90254c7464cac5c56e7ab9e6b1857c119d5d263/pkg/namesgenerator/names-generator.go | |
""" | |
import random | |
left = ["admiring", "adoring", "affectionate", "agitated", "amazing", "angry", "awesome", "beautiful", "blissful", | |
"bold", "boring", "brave", "busy", "charming", "clever", "cool", "compassionate", "competent", "condescending", |
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
# Standard Library | |
import logging | |
# Third Party | |
from celery import Celery | |
from celery.app.amqp import AMQP | |
from celery.app.task import Task | |
from django_tenants.utils import schema_context | |
# Django Stuff |
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
# Standard Library | |
from typing import Dict | |
# Django Stuff | |
from django.apps import apps | |
def find_deleted_string(model_name: str, **kwargs) -> Dict[str, str]: | |
parameters = {key: f"{value}<d>" if isinstance(value, str) else value for key, value in kwargs.items()} | |
model_class = apps.get_model(model_name) |
We aim to develop a composite application utilizing Docker and docker-compose, which comprises minimum five services: your Django REST Framework endpoint, query converter service(django, flask, fastapi etc.), logger service(celery or implement your handler if possible), a message queue service and an Elasticsearch service. The Django REST Framework endpoint should include minimum two features:
- Authentication Mechanism: We are looking for an authentication method similar to JWT. For instance, if there is a user with the username "octoAdmin," we would add an Authorization header as "Octoxlabs base64(octoAdmin)". This token should uniquely identify the user "octoAdmin".
- Endpoint: Consider having data structured as an array like [{"Hostname": "octoxlabs01", "Ip": ["0.0.0.0"]}] stored in the Elasticsearch service. We expect to query your endpoint with "Hostname = octoxlabs*" and have this query translated into the JSON format for Elasticsearch
We aim to develop a composite application utilizing Docker and docker-compose, which comprises two services: your Django REST Framework endpoint and an Elasticsearch service. The Django REST Framework endpoint should include minimum two features:
- Authentication Mechanism: We are looking for an authentication method similar to JWT. For instance, if there is a user with the username "octoAdmin," we would add an Authorization header as "Octoxlabs base64(octoAdmin)". This token should uniquely identify the user "octoAdmin".
- Endpoint: Consider having data structured as an array like [{"Hostname": "octoxlabs01", "Ip": ["0.0.0.0"]}] stored in the Elasticsearch service. We expect to query your endpoint with "Hostname = octoxlabs*" and have this query translated into the JSON format for Elasticsearch. Please avoid using query_string in Elasticsearch, if possible. The scenario involves the endpoint converting the "Hostname = octoxlabs*" query into an Elas