Skip to content

Instantly share code, notes, and snippets.

View krisalexander200's full-sized avatar

Kristian Alexander krisalexander200

View GitHub Profile
@krisalexander200
krisalexander200 / spark-with-sql.py
Created January 13, 2016 18:36
Spark SQL with Python
from pyspark import SparkConf, SparkContext
from pyspark.sql import SQLContext, Row
import collections
conf = SparkConf().setMaster("local").setAppName("RatingsHistogram")
sc = SparkContext(conf = conf)
sqlContext = SQLContext(sc)
def mapper(line):
li = line.split(',')
@krisalexander200
krisalexander200 / adblock-detect.js
Created December 22, 2015 18:55
record adblock users in google analytics
<!-- source: http://www.labnol.org/internet/adblock-with-google-analytics/28819/ -->
<script>
window.onload = function() {
// Delay to allow the async Google Ads to load
setTimeout(function() {
// Get the first AdSense ad unit on the page
var ad = document.querySelector("ins.adsbygoogle");
@krisalexander200
krisalexander200 / Fiscal Year Ends
Created December 4, 2015 05:55
USA Corps Fiscal Year End Distribution
[
{
"_id" : "0417",
"count" : 1.0000000000000000
},
{
"_id" : "0218",
"count" : 1.0000000000000000
},
{
@krisalexander200
krisalexander200 / Frequency of SIC Codes of US Corporations
Created November 30, 2015 04:44
Frequency of SIC Codes of US Corporations
[
{
"_id" : "9721",
"count" : 2.0000000000000000
},
{
"_id" : "1044",
"count" : 1.0000000000000000
},
{
@krisalexander200
krisalexander200 / Locations Frequency
Created November 30, 2015 04:35
Frequency of Locations in US Corporations
[
{
"_id" : "Md",
"count" : 1.0000000000000000
},
{
"_id" : "Q5",
"count" : 1.0000000000000000
},
{
@krisalexander200
krisalexander200 / gist:0578272c437cc250443c
Created November 17, 2015 21:16
Einstein's Riddle with OWL
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY riddle "http://www.solulos.com/riddle#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>
@krisalexander200
krisalexander200 / SEC Location Codes
Created November 16, 2015 04:14
SEC Location Codes
[
{
"code":"AL",
"desc":"Alabama"
},
{
"code":"AK",
"desc":"Alaska"
},
{
{
"feed":{
"$":{
"xmlns":"http://www.w3.org/2005/Atom"
},
"author":[
{
"email":[
"webmaster@sec.gov"
],
{
"title":"Standard Industrial Classification (SIC) Code List",
"source":"http://www.sec.gov/info/edgar/siccodes.htm",
"codes":[
{
"SIC Code":100,
"Industry Title":"AGRICULTURAL PRODUCTION-CROPS"
},
{
"SIC Code":200,
@krisalexander200
krisalexander200 / http statuses
Created November 7, 2015 05:26
http statuses
{
100:"Client should continue with request",
101:"Server is switching protocols",
102:"Server has received and is processing the request",
103:"resume aborted PUT or POST requests",
122:"URI is longer than a maximum of 2083 characters",
200:"standard response for successful HTTP requests",
201:"request has been fulfilled; new resource created",
202:"request accepted, processing pending",
203:"request processed, information may be from another source",