Skip to content

Instantly share code, notes, and snippets.

John Berryman JnBrymn

Block or report user

Report or block JnBrymn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View process_tiddly_export.py
#!/usr/bin/env python3
"""
This processes TiddlyWiki dumps to stick them into a format that Bear can import.
Full steps:
* First in your TiddlyWiki under the Tools menu click "export all>Static HTML".
* Next, run this command `process_tiddly_export --tiddler_dump_file=somewhere/tiddlers.html --output_directory=/tmp/some_empty_folder/ --extra_tags=any,tags,you,want` it will
* process the static HTML file into one file per tiddler
* each file will start with <h1>your tiddler title</h1>
* next it will list any #tags on the original tiddler as well as and extra tags you supplied
View playing_with_channels.go
package main
import (
"fmt"
"math/rand"
"net/http"
"os"
"strconv"
"time"
)
View MarkovModel.js
/* 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
View sarama_example.go
package main
import (
"fmt"
"github.com/Shopify/sarama" //GIT hash = b3d9702dd2d2cfe6b85b9d11d6f25689e6ef24b0
"time"
)
var groupName = "trash"
var topicName = "event"
View biz-intel.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@JnBrymn
JnBrymn / MarkovModel.py
Last active Aug 29, 2015
Simple Markov Model
View MarkovModel.py
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):
@JnBrymn
JnBrymn / neo performance test
Created Mar 21, 2014
This tests 3 different algorithms for insert a user with their friends.
View neo performance test
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
View fakeData.js
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) {
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Slider - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
View DocumentClassifier.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.