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
var crypto = require('crypto'); | |
//varies from -1 t0 1 | |
var pow2_31 = Math.pow(2,31); | |
var randNum = function(t,seed) { | |
var shasum = crypto.createHash('sha1'); | |
return shasum.update(""+seed+t).digest().readUInt32LE(0)/pow2_31-1; | |
} | |
var randNumGenMaker = function(seed) { |
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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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 collections import defaultdict | |
import random | |
class MarkovModel(object): | |
""" | |
Takes iterator of tokens and makes a markov model of the tokens. n is the "order" of the model | |
None is a special token that serves as a sort of delimiter of phrases. | |
""" | |
@classmethod | |
def _tokenizer(cls,text,token_delim): |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
package main | |
import ( | |
"fmt" | |
"github.com/Shopify/sarama" //GIT hash = b3d9702dd2d2cfe6b85b9d11d6f25689e6ef24b0 | |
"time" | |
) | |
var groupName = "trash" | |
var topicName = "event" |
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
/* MarkovModel creates a Markov model of text (or tokens) and allow you to generate new | |
* text from the model. It takes two optional arguments: | |
* | |
* tokenizer - a function that takes a string and returns an array of tokens | |
* defaults to a tokenizer that breaks on whitespace and lowercases everything | |
* shingle_n - the number of tokens that make up a state in the markov model | |
* the higher the number the more realistic the generated data, but the more | |
* training data required | |
* defaults to 1 | |
* join_str - string used to join text together |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>appendNodeFace</title> | |
<script src="http://mbostock.github.com/d3/d3.v2.js" type="text/javascript"></script> | |
<!--<script src="d3.v2.js" type="text/javascript"></script>--> | |
<script src="https://raw.github.com/andyet/ICanHaz.js/master/ICanHaz.min.js" type="text/javascript"></script> | |
<!--<script src="ICanHaz.min.js" type="text/javascript"></script>--> | |
<style type="text/css"> | |
circle { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>appendNodeFace</title> | |
<script src="http://mbostock.github.com/d3/d3.v2.js" type="text/javascript"></script> | |
<!--<script src="d3.v2.js" type="text/javascript"></script>--> | |
<script src="https://raw.github.com/andyet/ICanHaz.js/master/ICanHaz.min.js" type="text/javascript"></script> | |
<!--<script src="ICanHaz.min.js" type="text/javascript"></script>--> | |
<style type="text/css"> | |
circle { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Asteroids</title> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script src="asteroids.js" charset="utf-8"></script> | |
<script type="text/javascript"> | |
Space = function(params /*{width, height}*/) { | |
this.width = params.width; |
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
#!/usr/bin/env bash | |
#this is how to create suggest as you type for finding a name (searching over last and first names) | |
#the search is only issued upon 3 characters or more because too many results will come back otherwise. This is a search for "tho" which could be Thomas (a first name) or Thompson (a last name). | |
curl "http://localhost:8983/solr/select?indent=on&qf=first_name%20last_name&defType=edismax&facet=truel&facet.field=first_name&facet.field=last_name&facet.mincount=1&fl=first_name%20last_name&q=tho*&facet.prefix=tho" | |
#as soon as a space is issued notice the change in the facet.prefix | |
curl "http://localhost:8983/solr/select?indent=on&qf=first_name%20last_name&defType=edismax&facet=truel&facet.field=first_name&facet.field=last_name&facet.mincount=1&fl=first_name%20last_name&q=thomas+&facet.prefix=" |
OlderNewer