Skip to content

Instantly share code, notes, and snippets.

View MattMcMurray's full-sized avatar

Matt McMurray MattMcMurray

View GitHub Profile
@MattMcMurray
MattMcMurray / git-recent
Created August 10, 2023 20:07 — forked from jordan-brough/git-recent
Git: Display a list of recently checked out branches/tags/commits
#!/usr/bin/env bash
# Source: https://gist.github.com/jordan-brough/48e2803c0ffa6dc2e0bd
# See also: https://stackoverflow.com/a/25095062/58876
# Download this script as "git-recent" (no extension), chmod it to be executable and put it in your
# path somewhere (e.g. /usr/bin). You can then use it via `git recent` from inside any git repo.
# Examples:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from sklearn.model_selection import StratifiedShuffleSplit
# Let's create an age category
age_cat = np.ceil(appt_data['Age'] / 10)
# Let's group anybody >100yrs old into the 100 year old category, as they are outliers
age_cat.where(age_cat < 100, 100, inplace=True)
appt_data['AgeCategory'] = age_cat
appt_data['AppointmentDay'] = pd.to_datetime(appt_data['AppointmentDay'])
appt_data['AppointmentDotW'] = appt_data['AppointmentDay'].dt.dayofweek
appt_data['AppointmentDotW'].head()
time_deltas = appt_data['AppointmentDay'] - appt_data['ScheduledDay']
appt_data['WaitingTime'] = time_deltas.copy()
appt_data['WaitingTime'] = appt_data['WaitingTime'].dt.days
# Interestingly, about 1/3 of appointments were booked AFTER they happened...
appt_data['WaitingTime'].where(
appt_data['WaitingTime'] < pd.Timedelta(0)).count() / appt_data['WaitingTime'].count()
# 0.34894641128412063
appt_data['No-show'] = pd.Series(np.where(appt_data['No-show'].values == 'Yes', 1, 0),
appt_data.index)
#!/bin/bash
# https://www.digitalocean.com/community/tutorials/how-to-list-and-delete-iptables-firewall-rules
# First, set the default policies for each of the built-in chains to ACCEPT.
# The main reason to do this is to ensure that you won't be locked out from your server via SSH:
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -P OUTPUT ACCEPT
@MattMcMurray
MattMcMurray / keybase.md
Created April 12, 2017 16:48
keybase.md

Keybase proof

I hereby claim:

  • I am mattmcmurray on github.
  • I am norimamathieu (https://keybase.io/norimamathieu) on keybase.
  • I have a public key ASCQNN8aQuZztW-gkXJ1VUF7TsCJPXO1DizREm93jlz5NAo

To claim this, I am signing this object: