Skip to content

Instantly share code, notes, and snippets.

View danielperezr88's full-sized avatar
🚀
Empowering world-changing ideas

Daniel Pérez Rubio danielperezr88

🚀
Empowering world-changing ideas
  • Madrid
View GitHub Profile
#!/usr/bin/env bash
# Throws error in case stdout keeps quiet for a certain time, specified by TIMEOUT
# origin: https://stackoverflow.com/questions/43665318/how-to-get-supervisord-to-restart-hung-workers
set -e
TIMEOUT=60
LAST_CHANGED="$(date +%s)"
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available
cmdname=$(basename $0)
echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
usage()
{
cat << USAGE >&2
diff --git a/nmf.py b/nmf.py
index dda116c..1cf6bd8 100644
--- a/nmf.py
+++ b/nmf.py
@@ -74,7 +74,7 @@ def _safe_compute_error(X, W, H):
norm_X = np.dot(X.data, X.data)
norm_WH = trace_dot(np.dot(np.dot(W.T, W), H), H)
cross_prod = trace_dot((X * H.T), W)
- error = sqrt(norm_X + norm_WH - 2. * cross_prod)
+ error = sqrt(np.max([0, norm_X + norm_WH - 2. * cross_prod]))
diff --git a/usr/local/bin/pip b/usr/local/bin/pip
index 02390f0..af1518c 100644
--- a/usr/local/bin/pip
+++ b/usr/local/bin/pip
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import re
diff --git a/tom_lib/nlp/topic_model.py b/tom_lib/nlp/topic_model.py
index 0abd98b..02f7088 100644
--- a/tom_lib/nlp/topic_model.py
+++ b/tom_lib/nlp/topic_model.py
@@ -6,7 +6,7 @@ import tom_lib.stats
from scipy import spatial, cluster
from scipy.sparse import coo_matrix
from sklearn.decomposition import NMF, LatentDirichletAllocation as LDA
-import lda
+from sklearn import lda
diff --git a/parser_trainer_test.sh b/parser_trainer_test.sh
index ba2a6e7..977c89c 100644
--- a/parser_trainer_test.sh
+++ b/parser_trainer_test.sh
@@ -22,7 +22,7 @@
set -eux
-BINDIR=$TEST_SRCDIR/syntaxnet
+BINDIR=$TEST_SRCDIR/$TEST_WORKSPACE/syntaxnet
diff --git a/workspace.bzl b/workspace.bzl
index 13f29c1..d0cb97a 100644
--- a/workspace.bzl
+++ b/workspace.bzl
@@ -76,7 +76,7 @@ def tf_workspace(path_prefix = "", tf_repo_name = ""):
native.new_http_archive(
name = "gmock_archive",
- url = "https://archive.openswitch.net/gmock-1.7.0.zip",
+ url = "http://pkgs.fedoraproject.org/repo/pkgs/gmock/gmock-1.7.0.zip/073b984d8798ea1594f5e44d85b20d66/gmock-1.7.0.zip",
# call "rabbitmqctl stop" when exiting
trap "{ echo Stopping rabbitmq; rabbitmqctl stop; exit 0; }" TERM
echo Starting rabbitmq
rabbitmq-server &
# from docs: When Bash receives a signal for which a
# trap has been set while waiting for a command to
# complete, the trap will not be executed until the
# command completes.
# Creado para solucionar una serie de errores de tweepy
# mover a "/usr/local/lib/python3.4/site-packages/tweepy/streaming.py" después de instalar tweepy
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
# Appengine users: https://developers.google.com/appengine/docs/python/sockets/#making_httplib_use_sockets
from __future__ import absolute_import, print_function
@danielperezr88
danielperezr88 / mod-resources.py
Last active August 26, 2016 13:08
Modified bokeh submodule. It adds external javascript/css model summoning capabilities with "__javascript__" and "__css__" attributes
''' Remember changing this file name before running bokeh
The resources module provides the Resources class for easily configuring
how BokehJS code and CSS resources should be located, loaded, and embedded in
Bokeh documents.
Also provides some pre-configured Resources objects.
Attributes:
CDN : load minified BokehJS from CDN