Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mtdefelice on github.
  • I am mtdefelice (https://keybase.io/mtdefelice) on keybase.
  • I have a public key ASBs7pY5Wf8z_e0ddCytY8xvjxLaXYMGJCp_UbVs43u5dAo

To claim this, I am signing this object:

@mtdefelice
mtdefelice / get-email_provider.py
Created March 19, 2018 23:46
From STDIN, get an email provider from a list of domains or email addresses.
import sys
import subprocess
import re
_map = {
'.gmail.com.': 'Gmail',
'.aspmx.l.google.com.': 'G Suite',
'.mail.protection.outlook.com.': 'Office 365',
'.mail.eo.outlook.com.': 'Office 365',
'.emailsrvr.com.': 'RSE/HEX',
@mtdefelice
mtdefelice / saas_company-data_generator.py
Last active November 28, 2018 06:50
Random Walks - Acme Widget Co. SaaS Data Generator. Supports multiple subscription types.
import numpy as np, pandas as pd
import matplotlib.pyplot as plt
plt.style.use ('ggplot')
# Note the first at 0 is a free trial ... As upgrades are considered advancing through this array, please ensure the pricing increases throughout the list
subscription_prices = [0, 5, 10, 15, 20 ]
# These need to sum to 1
subscription_pvals = [0.80, 0.10, 0.06, 0.02, 0.02]
sub_n = len (subscription_pvals)
@mtdefelice
mtdefelice / mote_carlo_forecast.py
Last active November 30, 2018 15:00
Random Walks - A Monte Carlo simulation to forecast (poorly) a stock's performance (seriously, *do not* take financial advice from this script or it's output!)
import numpy as np, pandas as pd
import quandl
from matplotlib.ticker import FuncFormatter, MultipleLocator
import matplotlib.pyplot as plt
plt.style.use ('ggplot')
# For better feeds, create an account on quandl.com and include your API key in the call
df = quandl.get ('WIKI/AAPL', start_date = '2017-01-01', rows = 250)
'''
The 'students.csv' and 'startups.csv' files represent the Typeform exports for each and are saved to this script's directory. All student resumes have been downloaded and stored in the 'student_resumes/' folder.
'startups_x.csv' is a parsed version of 'startups.csv' that has been extended with the job descriptions & content from the supplied *.pdf
'''
import glob
import textract
import re
#! /bin/bash
# Get credentials for cluster <cluster> (which must exist in your working project)
# gcloud container clusters list
# gcloud container clusters get-credentials <cluster>
# Poke around ...
# kubectl get deployments
# kubectl get services
# kubectl get ingress
#!/bin/bash
_LOCALPORT=8080
_SUBDOMAIN=weatherclub
# Wait for network connectivity. 8.8.8.8 is one of Google's DNS servers.
ping -c3 8.8.8.8
while [ $? -ne 0 ]; do
echo Waiting for network connectivity ...
sleep 30
ping -c3 8.8.8.8
[Unit]
Description=Serveo Tunnel
After=network-online.target
[Service]
User=pi
Type=simple
ExecStart=/usr/bin/ssh \
-vv \
-o ExitOnForwardFailure=yes \