Skip to content

Instantly share code, notes, and snippets.

Donny Viszneki hdon

Block or report user

Report or block hdon

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
@hdon
hdon / foo.py
Last active Mar 15, 2018
garbage technique for training word embedding+predictor
View foo.py
# 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
hdon / output
Created Feb 11, 2018
promise rejection simultaneously handled + not handled?
View output
hdon@behemoth:~/src/git/ML-Tests/text-processing$ node --version
v8.9.3
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
hdon / word2vec-extract-vocab.js
Last active Feb 11, 2018
better word2vec stream-parser using stream-promise-inverter
View word2vec-extract-vocab.js
/*
* Some examples of word2vec binary format:
* https://github.com/dav/word2vec/blob/master/src/word2vec.c#L560-L566
* https://github.com/jasonphillips/word2vec-stream/blob/master/index.js
*
* stream-promise-inverter:
* https://github.com/hdon/stream-promise-inverter
*
* compare to JUST word2vec format decode without stream-promise-inverter:
* https://github.com/jasonphillips/word2vec-stream/blob/8c76cf2df6a4dca14be9eb86ea784ccacfa7952d/index.js
View redux-shell.js
#!/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([
View utils.js
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);
View foo.js
var ll = new LazyLoad({
container: document.body
});
document.querySelector('#search').addEventListener('keypress', (ev) => {
var query = ev.target.value;
setTimeout(() => {
Array.prototype.forEach.call(document.querySelectorAll('body > a'), a => {
a.style.display =
( query.length == 0
@hdon
hdon / seth.py
Last active Apr 30, 2017
seth's thing
View seth.py
#import bleach # learn more: https://python.org/pypi/bleach
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 = 'http://www.premier-mountain-properties.net/houses-with-water-rights-almont-co/'
@hdon
hdon / knex-annoyance.md
Last active Apr 21, 2017
Anyone have a better solution in knex?
View knex-annoyance.md

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:

You can’t perform that action at this time.