Skip to content

Instantly share code, notes, and snippets.

View andrewm4894's full-sized avatar

Andrew Maguire andrewm4894

View GitHub Profile
#!/usr/bin/env bash
scope="production"
# stop on all errors
set -e
if [ $UID -ne 0 ]
then
echo >&2 "Hey! sudo me: sudo ${0}"
@andrewm4894
andrewm4894 / ml.conf
Last active June 7, 2023 10:59
example of some ml based alert configs for netdata using /health.d/ml.conf file.
# node ar 1min
template: ml_1min_node_ar
on: anomaly_detection.anomaly_rate
class: Anomaly
type: System
component: Node
lookup: average -1m foreach anomaly_rate
units: %
every: 30s
@andrewm4894
andrewm4894 / just-run-some-curl.ipynb
Created October 20, 2022 11:17
just run some curl.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrewm4894
andrewm4894 / huggingface_text_classification_quickstart.ipynb
Last active August 18, 2022 16:27
huggingface_text_classification_quickstart.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/python
"""
A python script to run many "airflow run dags trigger {dag} -e {execution_datetime}" commands via the airflow rest api.
Example usage:
python airflow_trigger_dags.py --dag 'dev_dag' --start '2021-10-01 00:00:01' --end '2021-10-31 00:00:01'
python airflow_trigger_dags.py -d 'dev_dag' -s '2022-05-20 00:00:01' -e '2022-05-24 00:00:01'
Example usage to just trigger dag for now:
import sqlite3
from sqlite3 import Error
def create_connection(db_file):
""" create a database connection to the SQLite database
specified by the db_file
:param db_file: database file
:return: Connection object or None
"""
@andrewm4894
andrewm4894 / install_netdata_from_branch.sh
Created October 20, 2020 09:35
Little script I am using when I want to install Netdata from a feature branch I am working on.
sudo apt-get update
# install python3
#sudo apt-get install python3.7
#sudo apt install python3
sudo apt-get install python3-pip
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
# update
sudo apt-get update
def plot_lines_multi(df,lw=2,pw=700,ph=400,t_str="hover,save,pan,box_zoom,reset,wheel_zoom",t_loc='above'):
'''...
'''
source = ColumnDataSource(df)
col_names = source.column_names
p = figure(x_axis_type="datetime",plot_width=pw, plot_height=ph,toolbar_location=t_loc, tools=t_str)
p_dict = dict()
for col, c, col_name in zip(df.columns,color,col_names):
p_dict[col_name] = p.line('index', col, source=source, color=c,line_width=lw)
p.add_tools(HoverTool(
def calc_batches(train_min: int, train_max: int, train_every: int, n: int) -> dict:
batches = dict()
batch = 0
for row in range(1,n+1):
if row < train_min:
pass
elif row == train_min:
batches[batch] = dict(start=0, end=row)
elif row % train_every == 0:
batch += 1