Skip to content

Instantly share code, notes, and snippets.

from dataclasses import dataclass
from pprint import pprint
from typing import List, Dict
class DataBase:
""" useful base functions for dataclasses that can convert a dataclass to_dict recursively """
def _list_of_dc(self, data_classes: list or set) -> List[dict]:
""" Convert list of classes with to_dict() atter to list of dict"""
@nockstarr
nockstarr / queued_rateLimiter.py
Last active July 18, 2020 22:11
Queued rate limiter attempt
import time
from functools import wraps
import threading
import queue
from typing import List, Callable
import string
import random
import asyncio
import os
import subprocess
import platform
import socket
import uuid
import re
import shutil
from io import BufferedReader
from typing import Callable, List
@nockstarr
nockstarr / install_python_3.8x.sh
Created March 28, 2020 22:00
install python 3.7xx || 3.8xx
#!/bin/bash
set -e
python_version=3.8.2
read -p $'Type Python version ex 3.8.2 \n' python_version
[ -z $python_version ] && echo "missing verison" && exit
echo "You selected python version $python_version"
@nockstarr
nockstarr / Readme.MD
Created March 22, 2020 16:33
Install moloch
@nockstarr
nockstarr / testShit.py
Last active December 29, 2019 16:16
Which method
from dataclasses import dataclass
from typing import Callable, List
import re
class ListOfFilters(list):
""" Adds additional functionality to a List[Filter]"""
@staticmethod
def _validate_regex(pattern, filter_name: str):
#!/bin/bash
##########
## https://linuxhint.com/bash_loop_list_strings/
## https://linuxize.com/post/bash-functions/
##########
### This install script assumes it executed in project directory ###
set -e