Skip to content

Instantly share code, notes, and snippets.

import functools
import itertools
import matplotlib.pyplot as plot
from matplotlib.colors import ListedColormap
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
from numpy import array
from numpy.random import normal
from sklearn import svm
import sys
import re
import logging
logging.basicConfig(level=logging.INFO)
terms = ["application", "breach notice law", "breach response costs", "business interruption loss", "claim", "claim expenses", "computer systems", "continuity date", "crisis management costs", "cyber extortion", "cyber extortion expenses", "cyber terrorism", "damages", "data breach", "denial of service attack", "digital asset", "employee", "extra expenses", "funds transfer fraud", "funds transfer loss", "incident", "indemnity period", "you", "your", "loss", "malicious code", "media content", "merchant service agreement", "multimedia wrongful act", "named insured", "pci fines and assessments", "personally identifiable information", "policy period", "pollutants", "privacy liability", "privacy policy", "public relations event", "ransomware", "regulatory penalties", "regulatory proceeding", "restoration costs", "retroactive date", "security failure", "senior executive", "service provider", "subsidiary", "systems failure", "third party
@zackmdavis
zackmdavis / power.md
Last active May 11, 2019 19:10
power ponies siege code

Power Ponies siege code zaYk3hKfpxv1N0WeZxgpcvU3RZ5nGCly5r+YVxyNxPv1N0WeZxgpcvU3RZ5nGCly9TdFnmcYKXLmv5hXHI3E+/U3RZ5nGCly9TdFnmcYKXL1N0WeZxgpcua/mFccjcT7kAIMhvHUIvMo+vz/0H+jaWjMZJmJJJdCS+gXGtWFwOMDc07AAAkoiZIyY5MUj991ikbJKirP1vlAfvSDor9b6V7bg/EyaWsLFDW5zKqYMkCnb1pW2VPEhGfPqLOnGxZy/vWpSOjM81nHUZikE9djdA==

@zackmdavis
zackmdavis / possibilities.py
Created August 12, 2018 04:36
generate structs to exercise the explicit-outlives-requirements lint
import itertools
test = ""
signatures = set()
specs = []
def bound_type(bound):
if bound.startswith("'"):
return "lifetime"
@zackmdavis
zackmdavis / rustc_build_failure_redux.txt
Created June 20, 2018 04:50
rustc fails to build, again
zmd@ReflectiveCoherence:~/Code/rust$ RUST_BACKTRACE=full ./x.py test --stage 1
Updating only changed submodules
Submodules updated in 0.03 seconds
Finished dev [unoptimized] target(s) in 0.20s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.18s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 tool tidy (x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.17s
tidy check
@zackmdavis
zackmdavis / rustc_build_failure.txt
Created June 20, 2018 04:46
rustc fails to build
zmd@ReflectiveCoherence:~/Code/rust$ RUST_BACKTRACE=full ./x.py test src/test/ui --bless --stage 1 --jobs 10
Updating only changed submodules
Submodules updated in 0.03 seconds
Finished dev [unoptimized] target(s) in 0.22s
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.18s
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Finished release [optimized] target(s) in 0.17s
Copying stage0 test from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
def outer():
def inner():
print(p)
p = 1
inner()
outer()
from typing import Optional, TypeVar
T = TypeVar('T')
U = TypeVar('U')
def option_map(arg: Optional[T], fn: Callable[[T], U]) -> Optional[U]:
if arg is not None:
return fn(arg)
else:
return None
# Alison asks—
#
# once i have a dictionary mapping one thing to a list of things
# how do i generate tuples of the one thing to each of the things in the list
# of the things it is mapped to
# e.g. { a : [ (1, 2), (2, 4) ], b : [ (3, 5), (7, 9) ] }
# to [(a, 1, 2), (a, 2, 4), (b, 3, 5), (b, 7, 9)]
# My reply—