Skip to content

Instantly share code, notes, and snippets.

View metasyn's full-sized avatar

Xander Johnson metasyn

View GitHub Profile
@metasyn
metasyn / splunk_app_info_scraper.py
Created October 6, 2014 00:21
splunk_app_scraper.py
# Splunk App Information Scraper
# Note, it also scapes TAs
# Alexander Johnson
# xander@splunk.com
# @metasyn
# requires lxml
import re
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Linguistic Diversity Index](http://en.wikipedia.org/wiki/Linguistic_diversity_index)\n",
"\n",
">Greenberg's Diversity Index (LDI) is the probability that two people selected from the population at random will have different mother tongues; it therefore ranges from 0 (everyone has the same mother tongue) to 1 (no two people have the same mother tongue).\n",
"\n",
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# [Linguistic Diversity Index](http://en.wikipedia.org/wiki/Linguistic_diversity_index)\n",
"\n",
">Greenberg's Diversity Index (LDI) is the probability that two people selected from the population at random will have different mother tongues; it therefore ranges from 0 (everyone has the same mother tongue) to 1 (no two people have the same mother tongue).\n",
"\n",
# SPL General Practices
1.) Filter by time first.
>“. . . time is the most efficient filter”
2.) Use host, source, sourcetype
>“After time, the most powerful keywords are host, source, sourcetype”
@metasyn
metasyn / visualization.js
Last active October 21, 2021 08:50
This is a template for making a custom visualization in Splunk, by extending a backbone.js view.
define(function(require, exports, module) {
// STEP 1.) Initalization of your setup
// Add your dependenciences here,
// Note, no .js extension when using require
// e.g.
var d3 = require("../d3/d3");
var d3 = require("../d3plus/d3plus");
var underscore = require("../underscore");
define(function(require, exports, module) {
// We have a few dependencies; namely, d3, and d3plus
// In order for d3plus to get loaded, we need to load it into
// the name var, d3
var d3 = require("../d3/d3");
var d3 = require("../d3plus/d3plus");
var _ = require("underscore");
var SimpleSplunkView = require("splunkjs/mvc/simplesplunkview");
var TreeMap= SimpleSplunkView.extend({
// prism languages for splunk searches.
Prism.languages.mcurve = {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'saf' : /\|?\s*(search|where)[^\|]*/,
'munge' : /\|\s*(eval|eventstats|streamstats)[^\|]*/,
'report' : /\|\s*(stats|timechart|chart)[^\|]*/,
City / Urban area Country Population Land area Density
Tokyo/Yokohama Japan 33,200,000 6,993 4,750
New York Metro USA 17,800,000 8,683 2,050
Sao Paulo Brazil 17,700,000 1,968 9,000
Seoul/Incheon South Korea 17,500,000 1,049 16,700
Mexico City Mexico 17,400,000 2,072 8,400
Osaka/Kobe/Kyoto Japan 16,425,000 2,564 6,400
Manila Philippines 14,750,000 1,399 10,550
Mumbai India 14,350,000 484 29,650
Delhi India 14,300,000 1,295 11,050
@metasyn
metasyn / index.html
Created July 22, 2015 06:21
fatal police shootings in 2015 (as of July)
<!doctype html>
<meta charset="utf-8">
<!--
fatal police shootings
This data came from the Washington Post's repo
https://github.com/washingtonpost/data-police-shootings
It is a database of every fatal shooting in the United States
by a police officer in the line of duty in 2015.