Instantly share code, notes, and snippets.

View bench.go
type Blast struct {
requests uint64 // the number of successful requests
failures uint64 // the number of failed requests
started time.Time // the time the benchmark was started
duration time.Duration // the duration of the benchmark period
latencies []time.Duration // observed latencies in the number of requests
}
// Run N operations against the server at addr by putting a unique key with
// random values of size S. Returns a Benchmark object whose objects can be
View ols_plot.py
%matplotlib inline
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.datasets import make_regression
from sklearn.preprocessing import StandardScaler
from matplotlib.patches import Rectangle
View fdate.py
#!/usr/bin/env python3
import argparse
from datetime import datetime, timedelta
try:
from dateutil.relativedelta import relativedelta
except ImportError:
relativedelta = None
View writeat.go
package main
import (
"log"
"os"
)
func main() {
var (
fobj *os.File
View aggchan.go
package main
import (
"fmt"
"strings"
"time"
)
var (
count uint64
View reviewer_match.py
import csv
from tabulate import tabulate
from operator import itemgetter
from collections import Counter
def parse_inner_csv(val):
return list(
map(lambda s: s.strip(), val.lower().split(","))
View residuals.py
import time
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split as tts
from sklearn.linear_model import LinearRegression
from yellowbrick.regressor import ResidualsPlot
View slideshow.sh
#!/bin/bash
# Execute the reveal.js slides form of a Notebook
# Make sure the first argument to this script is a notebook
if [ "$#" -ne 1 ]; then
echo "Usage: ./slideshow.sh Notebook.ipynb"
exit 1
fi
# Make sure the notebook exists
View mahalanobis.py
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse, Circle
np.random.seed(42)
def draw_mahalanobis(path="atap_ch06_mahalanobis_distance.png"):
View distances.py
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
def draw_distances(path="atap_ch06_euclidean_manhattan_distance.png"):