This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# for *pert functons | |
library('mc2d') | |
# given the number of loss events, calculate the sum of losses for the number of events | |
sample_LM <- function(N, L, ML, H, CONF){ | |
# Calculate the aggregate loss | |
# | |
# ARGS: | |
# N - number of threat events to evaluate | |
# L - low boundary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> simpleKMeans() | |
[,1] [,2] | |
[1,] -0.0520000 -1.8500000 | |
[2,] -2.0040000 -0.8500000 | |
[3,] 0.1413699 0.1849315 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"size": 0, | |
"query": { }, | |
"aggregations": { | |
"ip_ranges": { | |
"ip_range":{ | |
"field": "srcip", | |
"ranges" : [ | |
{ "from" : "10.0.0.0" }, | |
{ "to" : "10.0.0.255" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inbound port movie maker | |
# Adopted nearly wholesale from @jayjacobs at DataDrivenSecurity.info | |
# mangled by @davidski | |
# which weeks should we look at? | |
#whichweek <- c(27, 28, 29, 30) | |
# how many countries to show? | |
numcountry <- 25 # 20 at first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#debian R upgrade | |
echo "deb http://streaming.stat.iastate.edu/CRAN/bin/linux/debian lenny-cran/" | sudo tee -a /etc/apt/sources.list | |
sudo apt-get update | |
sudo apt-get -t lenny-cran install --yes --force-yes r-base r-base-dev | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from elasticsearch import Elasticsearch, helpers | |
import csv | |
import logging | |
logging.basicConfig() | |
target_file = "traffic.csv" | |
es=Elasticsearch("your.es.host.example.tld", timeout=480) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*es_sample.pig | |
Silly little proof of concept query to pull ES data into Apache Pig | |
*/ | |
REGISTER s3://log-inbox.elk.sch/bin/elasticsearch-hadoop-2.1.0.Beta1.jar; | |
/* | |
Either use the full class name (ugh) or use a define will _all_ parameters | |
specified. You can't parameterize DEFINES in pig. (More ugh) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
library(magrittr) | |
library(dplyr) | |
library(ggplot2) | |
# data retrieval ---------------------------------------------------------- | |
pg <- GET("http://data.giss.nasa.gov/gistemp/tabledata_v3/GLB.Ts+dSST.txt", | |
user_agent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
# thanks to http://www.math-aids.com/ for the shape points | |
shape1 <- list(c(0,0), c(1,-1.5), c(1.5,-3), c(2,-5), c(2,-6), c(1.5,-7), c(3,-7.5), c(4,-7.5), c(5.5,-7), c(5,-6.5), | |
c(3,-6), c(3,-5), c(4,-2.5), c(5,-1), c(6,0), c(7,1), c(8.5,2), c(10,2.5), c(11,3), c(10,3.5), | |
c(9,4.5), c(9.5,6.5), c(8,5), c(6,5), c(5,5.5), c(4,7), c(3.5,4), c(2.5,3.5), c(4,2), c(3,1.5), | |
c(2,2.5), c(1.5,4), c(1,6), c(0,7), c(-2,7.5), c(-4,7), c(-5,6.5), c(-6,5), c(-7,4), c(-7.5,3.5), | |
c(-8.5,4), c(-8.5,9), c(-9.5,10), c(-11,10.5), c(-13,10), c(-14,9), c(-13.5,8), c(-13,7.5), c(-11.5,8), | |
c(-10,4.5), c(-9,2), c(-8,0), c(-7,-2.5), c(-6.5,-5), c(-5.5,-6), c(-4.5,-7.5), c(-1.5,-7.5), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(tidyr) | |
library(magrittr) | |
library(httr) | |
library(ggplot2) | |
library(ggvis) | |
#Inspired by original utility rate API post at | |
#http://www.numbrcrunch.com/blog/using-the-httr-package-to-retrieve-data-from-apis-in-r |
OlderNewer