This file contains hidden or 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 requests | |
import unittest | |
from urllib.parse import urlencode | |
class CheckResponse : | |
def __call__(self,fn) : | |
def fn_wrapper(*args) : | |
try : | |
response = fn(*args) | |
if "status" not in response or \ |
This file contains hidden or 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
# ---------------------------------------------------------------------------------------------- | |
# HULK - HTTP Unbearable Load King | |
# | |
# this tool is a dos tool that is meant to put heavy load on HTTP servers in order to bring them | |
# to their knees by exhausting the resource pool, its is meant for research purposes only | |
# and any malicious usage of this tool is prohibited. | |
# | |
# author : Barry Shteiman , version 1.0 | |
# ---------------------------------------------------------------------------------------------- | |
import urllib2 |
This file contains hidden or 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 pandas as pd | |
from sklearn.preprocessing import StandardScaler | |
from statsmodels.tsa.stattools import pacf | |
def create_lag_features(y): | |
scaler = StandardScaler() | |
features = pd.DataFrame() | |
partial = pd.Series(data=pacf(y, nlags=48)) |
This file contains hidden or 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 recursive_forecast(y, model, lags, | |
n_steps=FCAST_STEPS, step="1H"): | |
""" | |
Parameters | |
---------- | |
y: pd.Series holding the input time-series to forecast | |
model: pre-trained machine learning model | |
lags: list of lags used for training the model | |
n_steps: number of time periods in the forecasting horizon |
This file contains hidden or 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 direct_forecast(y, model, lags, | |
n_steps=FCAST_STEPS, step="1H"): | |
""" | |
Parameters | |
---------- | |
y: pd.Series holding the input time-series to forecast | |
model: a ML model not trained | |
lags: list of lags used for training the model | |
n_steps: how many steps forecast into the future |
This file contains hidden or 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
app = dash.Dash(__name__) | |
app.layout = html.Div(children=[ | |
html.Div(dcc.Markdown(description)), | |
html.Hr(), | |
html.Div([ | |
html.Div(id="parameters-box-id", children=[ | |
dcc.Markdown(params_description), | |
dcc.Input( | |
id="tottime-input-id", |
This file contains hidden or 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": "Device", | |
"children": [ | |
{ | |
"name": "Networking", | |
"children": [ | |
{ "name": "Router", "children": [] }, | |
{ "name": "Switch" }, | |
{ "name": "Firewall", "children": [] } | |
] |
This file contains hidden or 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
{ | |
"L0": [ | |
{ "name": "device" } | |
], | |
"L1": [ | |
{ "name": "Networking", "parent": "Device" }, | |
{ "name": "Computer", "parent": "Device" } | |
], | |
"L2": [ | |
{ "name": "Router", "parent": "Networking" }, |
This file contains hidden or 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 json | |
from anytree import Node, RenderTree | |
from anytree.search import find | |
class TaxonomyParser: | |
""" | |
This class is a wrapper on a Tree class from the anytree library to hold | |
different data hierarchies read from a JSON representation | |
""" |
This file contains hidden or 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 anytree.exporter import DotExporter | |
COLOR_SCHEME = ["aliceblue", "antiquewhite", "azure", "coral", "palegreen"] | |
def export(self): | |
""" | |
Export tree into graphviz format in both *.dot file and image *.png file | |
""" | |
def nodeattr_fn(node): |
OlderNewer