Skip to content

Instantly share code, notes, and snippets.


Geoff Ruddock asdfgeoff

View GitHub Profile
asdfgeoff /
Last active Jan 17, 2021
Bulk compress phone videos using H.265 HEVC encoding 🔥 More info:
import click
from pathlib import Path
from subprocess import call, check_output
from tqdm import tqdm
@click.argument('directory', type=click.Path(exists=True))
@click.option('--recursive', is_flag=True, help='Recursive')
@click.option('--file-ext', help='File format to process')
def main(directory, file_ext='mp4', recursive=False):
asdfgeoff /
Last active Nov 9, 2020
A DIY implementation of Multinomial Naive Bayes using NumPy | Details →
from typing import Callable, Union
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.utils.validation import check_X_y, check_array
from IPython.display import display
array_like = Union[list, np.ndarray]
matrix_like = Union[np.ndarray, pd.DataFrame]
from typing import Optional, Union
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.base import BaseEstimator
from sklearn.utils.estimator_checks import check_estimator
from sklearn.utils.validation import check_X_y, check_array, check_is_fitted
from lightgbm import LGBMClassifier, LGBMRegressor
asdfgeoff / toggle.tpl
Created Dec 9, 2019
A slightly modified version of the nbconvert template originally found here:
View toggle.tpl
{%- extends 'full.tpl' -%}
// Source:
{% block input_group -%}/Users/geoffruddock/Library/Jupyter/nbconvert/templates
<div class="input_hidden">
{{ super() }}
{% endblock input_group %}
{%- block header -%}
import datetime as dt
from typing import List, Tuple
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
from scipy.stats import norm
plt.rcParams['figure.facecolor'] = 'white'
asdfgeoff / 3.4_alarm_example.ipynb
Created Aug 22, 2018
A python version of the earthquake example given in ISYE 6420 Unit 3.4
View 3.4_alarm_example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from airflow.operators.python_operator import PythonOperator
class SQLTemplatedPythonOperator(PythonOperator):
""" Extend PythonOperator to receive a templated SQL query and also to display it in the "Rendered Template" tab in Airflow's UI.
This is very helpful for troubleshooting specific task instances, since you can copy a propertly formatted query directly from
the web UI rather than copying the contents of "templates_dict" and parsing it manually.
asdfgeoff /
Last active Aug 29, 2015 — forked from jookyboi/
Python-related modules and guides.


  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.