Skip to content

Instantly share code, notes, and snippets.

View h3ct0r's full-sized avatar
☢️
Quarantine

Héctor Azpúrua h3ct0r

☢️
Quarantine
View GitHub Profile
@h3ct0r
h3ct0r / outlier_mad.py
Last active July 28, 2017 16:00
Test if a number is an outlier from a 1D list python using Median Absolute Deviation (MAD)
import numpy as np
import math
def is_mad_based_outlier(points, compare_to, thresh=3.5):
if len(points.shape) == 1:
points = points[:,None]
median = np.median(points, axis=0)
diff = np.sum((points - median)**2, axis=-1)
@h3ct0r
h3ct0r / time_series_compare.py
Created July 27, 2017 17:05
Compare time series SSE (sum squared error)
import pandas as pd
data_1 = {
'date': [ '2014-05-01 18:47:05.069722',
'2014-05-01 18:47:05.119994',
'2014-05-02 18:47:05.178768',
'2014-05-02 18:47:05.230071',
'2014-05-02 18:47:05.230071',
'2014-05-02 18:47:05.280592',
'2014-05-03 18:47:05.332662',
@h3ct0r
h3ct0r / import_and_clone_vms.py
Last active February 10, 2022 16:41
Python script to automatically import an OVA file in VirtualBox and generate several clones
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""Import and generate clone of an OVA file in virtualbox
"""
import re
import sys
import uuid
import random
@h3ct0r
h3ct0r / gist:c46a148949f894741c6b
Created August 5, 2015 15:41
SMTP server for development on localhost written in python
#!/usr/bin/env python
# This a simple smtp server for testing on localhost
# The original version is on https://coderwall.com/p/ufjgwa/smtp-server-on-python-for-development-with-storing-emails
# This version is more verbose on what is doing, with more parameters and fail safe checks.
import argparse
import asyncore
import smtpd
import time