Skip to content

Instantly share code, notes, and snippets.

View jonahharris's full-sized avatar

Jonah H. Harris jonahharris

View GitHub Profile
@jonahharris
jonahharris / wilson_interval.h
Last active December 8, 2022 06:40
Wilson Binomial Proportion Confidence Interval
#ifndef WILSON_INTERVAL_H /* Prevent Multiple Inclusion */
#define WILSON_INTERVAL_H
/* ========================================================================= **
** WILSON BINOMIAL PROPORTION CONFIDENCE INTERVAL **
** ========================================================================= **
** Copyright (C) Jonah H. Harris <jonah.harris@gmail.com> **
** All Rights Reserved. **
** **
** Permission is hereby granted, free of charge, to any person obtaining a **
** copy of this software and associated documentation files (the "Software") **
@jonahharris
jonahharris / TNSConnectParser.js
Last active September 29, 2022 08:04
Oracle TNS Connect String Parser in JavaScript
function parseConnectString(str) {
var strLen = str.length;
var isFound = false;
var sb = [];
var par = [];
for (var jj = 0; jj < strLen; ++jj) {
var c = str[jj];
if (' ' === c)
@jonahharris
jonahharris / log-likelihood-ratio-cte.sql
Last active September 12, 2021 18:59
A Portable Log Likelihood Ratio Implementation using SQL Common Table Expressions
BEGIN;
/*
* The following is a SQL common table expression (CTE) port of the Apache
* Mahout implementation for calculating the raw log-likelihood ratio of two
* events. I needed it for a project and couldn't seem to find anything out
* there in pure SQL. While a procedural implementation would be preferred,
* this is portable to both SQLite (>= 3.35) and Postgres, which I'm using.
*
* NOTE: While this gist contains a port of the Mahout unit test, YMMV.
*
---
--- Created Created by Swav Swiac on 23/07/2015.
---
--- Allows to run Redis Lua script in a debuggable environment resembling one provided by Redis
---
--- Usage:
---
--- local runner = require 'redis_runner'.connect(host, port)
---
--- local KEYS = {}
@jonahharris
jonahharris / epsilon-recommendation-dithering-in-javascript.js
Last active April 5, 2021 18:36
a JavaScript implementation of A Practical Guide to Building Recommender Systems Epsilon-based Dithering
/**
* The following is a JavaScript implementation of the Spark+Scala code
* snippets for performing recommendation dithering via an epsilon-based
* post-processing step using normally distributed random noise.
*
* Source:
* Hristakeva, M. (2015, November 12). Dithering.
* A Practical Guide to Building Recommender Systems.
* https://buildingrecommenders.wordpress.com/2015/11/11/dithering/
*/
@jonahharris
jonahharris / gist:7279605
Last active December 27, 2015 06:09
Nodejitsu issue deploying node-reverse-gecoder (https://github.com/jonahharris/node-reverse-geocoder)
info: Welcome to Nodejitsu jonah.harris
info: jitsu v0.13.2, node v0.10.13
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in node ./app.js
warn: Local package version appears to be old
warn: The package.json version will be incremented automatically
warn: About to write /Users/jharris/Projects/node-reverse-geocoder/package.json
warn: Using '*' as a version for dependencies may eventually cause issues
warn: Use specific versions for dependencies to avoid future problems