Skip to content

Instantly share code, notes, and snippets.

View hdon's full-sized avatar

Donny Viszneki hdon

View GitHub Profile
hdon /
Last active March 15, 2018 07:43
garbage technique for training word embedding+predictor
# notable flaws:
# totally unorthodox method for training embedding (see lines 78, 81 and 82)
# extremely inefficient demo evaluation every 100,000 training steps (see lines 125-140)
# surprises:
# was actually extremely effective on small data sets
from __future__ import print_function
import tensorflow as tf
import numpy as np
import re, random, sys
hdon / output
Created February 11, 2018 03:14
promise rejection simultaneously handled + not handled?
hdon@behemoth:~/src/git/ML-Tests/text-processing$ node --version
hdon@behemoth:~/src/git/ML-Tests/text-processing$ node test-stream-promise-inverter.js
inverter caught transformer promise rejection:
Error: this is handled but also unhandled!
at fs.createReadStream.pipe.Inverter (/home/hdon/src/git/ML-Tests/text-processing/test-stream-promise-inverter.js:9:9)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:8082) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: this is handled but also unhandled!
(node:8082) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
hdon / word2vec-extract-vocab.js
Last active February 11, 2018 03:16
better word2vec stream-parser using stream-promise-inverter
* Some examples of word2vec binary format:
* stream-promise-inverter:
* compare to JUST word2vec format decode without stream-promise-inverter:
#!/usr/bin/env node
var util = require('../lib/util');
var fs = require('fs');
var path = require('path');
var opt;
var reducer;
var reducerFunction;
var transpiledModulePath;
opt = require('node-getopt').create([
hdon / utils.js
Created September 11, 2017 03:35
var fs = require('fs');
var path = require('path');
var mkdirp = require('mkdirp');
var resolve = require('resolve');
function compileModule(babel, modulePath) {
var visitedFiles = {};
return _compileModule(modulePath);
var ll = new LazyLoad({
container: document.body
document.querySelector('#search').addEventListener('keypress', (ev) => {
var query =;
setTimeout(() => {'body > a'), a => { =
( query.length == 0
hdon /
Last active April 30, 2017 04:31
seth's thing
#import bleach # learn more:
from bs4 import BeautifulSoup as bs
from bs4 import SoupStrainer as ss
import urllib as ul
import urllib.request
import re
#TODO: spider to crawl for urls
earl = ''
hdon /
Last active April 21, 2017 16:35
Anyone have a better solution in knex?

For the given schema:

create table foo (a int not null, b int not null, primary key (a, b));
create table bar (a int, b int, c int, foreign key foo_fk (a, b) references foo (a, b));

I want to join a and b, where there may be any number of bs for each a.

I can only come up with three solutions: