Skip to content

Instantly share code, notes, and snippets.

View blackfist's full-sized avatar

Kevin Thompson blackfist

View GitHub Profile
@blackfist
blackfist / create.json
Last active July 21, 2018 04:55
Creating VERIS incidents using python
{
"metadata": {
"name": "",
"signature": "sha256:be8501a2940fce195e5db05103c87f13e2dac07ac27e35cf5895ccad9045aace"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
library(verisr)
library(RColorBrewer)
library(ggplot2)
vcdb <- json2veris('~/Documents/development/python/vcdb/data/json')
origin <- getenum(vcdb, "actor")
colors <- brewer.pal(3, "Set2")
gg <- ggplot(origin, aes(x=enum, y=freq)) + geom_bar(stat="identity", fill=colors[1])
@blackfist
blackfist / hierarchy.md
Created July 22, 2014 18:10
Hierarchy of Cereal

Hierarchy of cereal

Some cereal is just better than other kinds of cereal and this needs to be recognized. However, some times two cereals are really close to each other and so it's hard to say that one is better than another. So this hierarchy has been developed. You can prefer one cereal over another within a tier and everyone will agree that you are not a drooling idiot. However, if you prefer a lower-tier cereal over a higher tier cereal then you have no taste nobody should give any weight to your cereal opinions.

In every category generic knock-offs of the name brand cereal count as the same. So if you buy some generic bag of Cinnamon flavor squares you would still be eating tier one cereal

If a cereal meets the definition of more than one tier then the lowest tier applies. If you find some heretic selling Golden Grahams with marshmallows that is a fourth tier cereal and should not be preferred over Golden Grahams without marshmallows.

Tier One Cereals

  • Golden Grahams
> source('~/.active-rstudio-document')
[1] Dimensions of the verisr object
[1] 3544 1841
[1] Number of NAs in the victim.industry field:
[1] 0
[1] Number of NAs in the victim.industry2 field:
[1] 3432
@blackfist
blackfist / unordered_bar_chart.R
Created July 13, 2014 13:47
I'd like to know why this bar chart isn't sorted even though the data frame that I sent to it is.
library(ggplot2)
library(plyr)
library(verisr)
load("~/Documents/vzdata/verisr_object/verisr2.dat")
patterns <- as.data.frame(table(vz$pattern))
names(patterns) <- c("Pattern", "Count")
patterns <- arrange(patterns, desc(Count))
print(patterns)
@blackfist
blackfist / swat.md
Last active August 29, 2015 14:03
A letter that I wrote to my elected officials about the excessive use of SWAT teams

I used the electronic forms to reach out to my representatives, but I recorded their address here because I use that in the letter

Senator Amy Klobuchar
302 HART SENATE OFFICE BUILDING
WASHINGTION DC 20510

Senator Al Franken
302 HART SENATE OFFICE BUILDING
WASHINGTION DC 20510

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am blackfist on github.
  • I am kev (https://keybase.io/kev) on keybase.
  • I have a public key whose fingerprint is A1F2 5046 F79D B2C3 61F6 A9FB 1BF2 F63F BB73 1AFA

To claim this, I am signing this object:

import simplejson as sj
import os
from jsonschema import validate, ValidationError
sk = sj.loads(open('verisc.json').read())
enum = sj.loads(open('verisc-enum.json').read())
os.chdir('/Documents/development/python/vcdb/data/json')
# All of the action enumerations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.