This file contains hidden or 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
const spinner = [ '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' ]; | |
for(var count=0;count<100000;count++) process.stdout.write(" "+spinner[ (count+1)% spinner.length ]+"\033[0G" ); // \033[0G | \r | \x1B[0G |
This file contains hidden or 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
function deepClone(obj) { | |
var copy; | |
var i; | |
var len; | |
if (!obj || typeof obj !== 'object') { | |
return obj; | |
} | |
if (obj instanceof Array) { |
This file contains hidden or 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 tensorflow.python.client import device_lib | |
def get_available_gpus(): | |
local_device_protos = device_lib.list_local_devices() | |
return [x.name for x in local_device_protos if x.device_type == 'GPU'] | |
get_available_gpus() |
This file contains hidden or 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
function standardDeviation(values, avg) { | |
var squareDiffs = values.map(value => Math.pow(value - avg, 2)); | |
return Math.sqrt(average(squareDiffs)); | |
} | |
function average(data) { | |
return data.reduce((sum, value)=>sum + value) / data.length; | |
} | |
if (responseCode.code === 200 || responseCode.code === 201) { |
This file contains hidden or 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
/** | |
* Phantomjs example wait For Page Document condition | |
* @author Loreto Parisi (loretoparisi at gmail dot com ) | |
*/ | |
(function() { | |
/** | |
* Delayed wait on a condition | |
*/ | |
var Delay = function() { |
This file contains hidden or 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
#Generator | |
with tf.device(gpu): | |
x8 = tf.placeholder(tf.float32, shape=[None, FLAGS.ws, FLAGS.ws, 8]) # 8-band input | |
x3 = tf.placeholder(tf.float32, shape=[None, scale * FLAGS.ws, scale * FLAGS.ws, 3]) # 3-band ipnput | |
label_distance = tf.placeholder(tf.float32, shape=[None, FLAGS.ws, FLAGS.ws, 1]) # distance transform as a label | |
for i in range(layers): | |
alpha[i] = tf.Variable(0.9, name='alpha_' + str(i)) | |
beta[i] = tf.maximum( 0.0 , tf.minimum ( 1.0 , alpha[i] ), name='beta_'+str(i)) | |
bi[i] = tf.Variable(tf.constant(0.0,shape=[FLAGS.filters]), name='bi_'+str(i)) |
This file contains hidden or 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
/******************** | |
* Object modifiers | |
********************/ | |
/** | |
* Object.mapObject(value,key) | |
* Map Object properties | |
* @return object Copy of this object | |
*/ | |
if( typeof( Object.mapObject ) == 'undefined') { |
This file contains hidden or 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
def smart_procrustes_align_gensim(base_embed, other_embed, words=None): | |
"""Procrustes align two gensim word2vec models (to allow for comparison between same word across models). | |
Code ported from HistWords <https://github.com/williamleif/histwords> by William Hamilton <[email protected]>. | |
(With help from William. Thank you!) | |
First, intersect the vocabularies (see `intersection_align_gensim` documentation). | |
Then do the alignment on the other_embed model. | |
Replace the other_embed model's syn0 and syn0norm numpy matrices with the aligned version. | |
Return other_embed. |
This file contains hidden or 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
#!/bin/bash | |
netstat -atn | grep LISTEN | grep "127.0.0.1" |
This file contains hidden or 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
function(n, ps) { | |
const DUMMY = -1; | |
var rs = []; // rs = round array | |
if (!ps) { | |
ps = []; | |
for (var k = 1; k <= n; k += 1) { | |
ps.push(k); | |
} | |
} else { | |
ps = ps.slice(); |