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
"""usage | |
python fuvm.py <external canary URL> | |
""" | |
import time | |
import socket | |
import requests | |
import sys | |
import logging | |
class CustomFormatter(logging.Formatter): |
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
# Note: This file lives on the observium server inside /etc/cron.d/ | |
13 * * * * root host -t axfr anrg.liv.ac.uk | awk '$4 ~ "^A$" {print $1}' > /dev/shm/devices 2> /dev/null; /opt/observium/add_device.php /dev/shm/devices >> /dev/null 2>&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
def random_three_vector(): | |
""" | |
Generates a random 3D unit vector (direction) with a uniform spherical distribution | |
Algo from http://stackoverflow.com/questions/5408276/python-uniform-spherical-distribution | |
:return: | |
""" | |
phi = np.random.uniform(0,np.pi*2) | |
costheta = np.random.uniform(-1,1) | |
theta = np.arccos( costheta ) |
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 tqdm.auto import tqdm | |
from requests.exceptions import HTTPError | |
from getpass import getpass | |
import os | |
from atlassian import Confluence | |
def get(label): | |
if label not in os.environ: | |
os.environ[label]=getpass(f'Enter {label}') |
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 nltk | |
import random | |
from nltk.corpus import brown | |
# Ensure the necessary NLTK resources are downloaded | |
nltk.download('brown') | |
nltk.download('universal_tagset') | |
def get_common_words_by_pos(tag, num_words=100): | |
""" Return a list of the most common words for a given part of speech tag """ |
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 typing as t | |
import logging | |
import random | |
from fastapi import Depends, FastAPI, Header, HTTPException | |
from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBearer | |
from pydantic import BaseModel | |
from starlette import status | |
from os import environ |
OlderNewer