Skip to content

Instantly share code, notes, and snippets.

def offensive_score(player):
score = 0
score += player['passing_yds']*0.04
score += player['passing_tds']*4
score += player['passing_int']*-1
score += player['rushing_yds']*0.1
score += player['rushing_tds']*6
score += player['receiving_rec']*0.5
score += player['receiving_yds']*0.1
score += player['receiving_tds']*6
macro_rules! caseless_tag (
($i:expr, $inp: expr) => (
{
#[inline(always)]
fn as_lower(b: &str) -> String {
let s = b.to_string();
s.to_lowercase()
}
let expected = $inp;
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
date,hosted_by,dl,ul,results_img
2016-02-08 11:03:14,"Hosted by Utah Education Network (Salt Lake City, UT) [8.73 km]: 25.578 ms",662.45,110.55,http://www.speedtest.net/result/5069169190.png
2016-02-08 11:03:14,"Hosted by Utah Education Network (Salt Lake City, UT) [8.73 km]: 25.578 ms",662.45,110.55,http://www.speedtest.net/result/5069169190.png
2016-02-07 08:03:21,"Hosted by Utah Education Network (Salt Lake City, UT) [8.26 km]: 26.077 ms",136.70,108.52,http://www.speedtest.net/result/5066107780.png
2016-01-27 05:03:10,"Hosted by Utah Education Network (Salt Lake City, UT) [9.41 km]: 29.196 ms",374.00,117.15,http://www.speedtest.net/result/5033314995.png
2016-01-27 02:03:17,"Hosted by Utah Education Network (Salt Lake City, UT) [9.41 km]: 25.664 ms",230.01,103.32,http://www.speedtest.net/result/5032918852.png
2016-01-26 23:03:22,"Hosted by Utah Education Network (Salt Lake City, UT) [9.41 km]: 25.882 ms",171.36,116.52,http://www.speedtest.net/result/5032590592.png
2016-01-26 20:03:15,"Hosted by Utah Educati
@paul-english
paul-english / ansible-playbook
Created January 29, 2016 17:07
ansible-playbook
#!/usr/bin/env bash
# Place this script in a directory that preceeds the location of
# the real ansible-playbook script in your PATH. When run, it
# will add passwords found in the .ansible-vars file, then call
# the real ansible-playbook script.
set -e
#set -x
@paul-english
paul-english / .tmux.conf
Created November 16, 2015 22:30
tmux config
unbind C-b
set -g prefix C-Space
set -g mode-keys vi
# Set XTerm key bindings
setw -g xterm-keys on
# Set XTerm overrides
set -g terminal-overrides "xterm*:XT:smcup@:rmcup@"
@paul-english
paul-english / pairwise-levenshtein.py
Last active October 28, 2015 18:46
Pairwise string distances
import Levenshtein as levenshtein
import numpy as np
def dist(coord):
i, j = coord
return levenshtein.distance(strings_list[i], strings_list[j])
coords = np.triu_indices(len(strings_list), 1)
zipped_coords = zip(*coords)
@paul-english
paul-english / clone
Last active August 29, 2015 14:21
Manage git repo organization a bit more like go does.
#!/bin/bash
# Clones a repo into an organized directory structure at your $CODEPATH.
# This organization is similar to how "go get" will organize your code into
# $GOPATH/<site>/../../<repo>
set -e
trap "echo ERRORS DETECTED" err
@paul-english
paul-english / migrate_repos.sh
Created May 14, 2015 15:31
Migrate GHE repos to https (based on eric's gist)
#!/bin/bash
# Finds and converts git repositories in or under the working directory to
# reference GitHub Enterprise (code.redbrainlabs.com).
set -e
trap "echo ERRORS DETECTED" ERR
IFS="`printf '\n\t'`"
@paul-english
paul-english / sims.jl
Last active August 29, 2015 14:17
some-julia
using Images
using Match
function sample_S(n, iters=1000)
S = zeros(Int32, n)
for step = 1:iters
i = rand(1:n)
@match (i,S[i]) begin
(1,0),if S[i+1]==0 end => S[i]=1
(1,0),if S[i+1]==1 end => continue
@paul-english
paul-english / econometrics-model.r
Last active August 29, 2015 14:14
econometrics thing
install.packages('car')
df <- read.csv("~/data.csv")
plot(df)
# Model 1
model1.y <- df$inf
model1.X <- df$unem