- train your model in keras in python
- use serialize() to write the graph with parameters out to a file
- use load-graph to load that file using the tensorflow java api
This file contains 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 memory_info(): | |
res = {} | |
for row in open('/proc/meminfo', 'r'): | |
k, v = row.split(':') | |
k = k.strip() | |
v = v.split() | |
if len(v) == 1: | |
v = int(v[0]) | |
elif v[1] == 'kB': | |
v = int(v[0]) * 1024 |
This file contains 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
'figure': 2.7995377623971058, | |
'heading': 2.7494888513321079, | |
'list': 2.8587943944205776, | |
'paragraph': 2.9397276751874042, | |
'table': 4.1352922428576822 |
- You want people to like you / want to be in charge of people / think you're a "leader"
- You think you're smarter than everyone else
- You think you have some technical "secret sauce" that no one else has and that this has intrinsic value
- You think your PhD thesis is a product
- Mummy and Daddy are giving you a seed round because they want to get you out of the house
- You live in LA or New York and you're jealous of San Francisco
- You heard that $fad (Big Data/IoT/Adtech/Fintech/whatever) was big
Data structures:
Hash table mapping tokens -> <document-count, count-min-sketch(docuemnt id -> term count)>
Hash table mapping sketch indexes -> heap(<document id, term count dictionary> sorted by document id)
To search:
- sum sketches for all terms in the query
- find indexes of top k values in result sketch
- look up actual document ids and term counts for those indexes
This file contains 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
var truthiness = function(obj) { | |
/* ?P -> Boolean */ | |
switch(obj) { | |
case 0: | |
case false: | |
case null: | |
case undefined: | |
return false; | |
case true: | |
return true; |
This file contains 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
cgi-bin/php?-d+allow_url_include=on+-d+safe_mode=off+-d+suhosin.simulation=on+-d+disable_functions=""+-d+open_basedir=none+-d+auto_prepend_file=php://input+-d+cgi.force_redirect=0+-d+cgi.redirect_status_env=0+-d+auto_prepend_file=php://input+-n |
This file contains 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
static PyObject *__pyx_pf_4test_fib(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_n) { | |
PyObject *__pyx_v_SZ = NULL; | |
PyObject *__pyx_v_i = NULL; | |
PyObject *__pyx_v_a = NULL; | |
PyObject *__pyx_v_b = NULL; | |
PyObject *__pyx_v_t = NULL; | |
PyObject *__pyx_r = NULL; | |
__Pyx_RefNannyDeclarations | |
PyObject *__pyx_t_1 = NULL; |
This file contains 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
(defn parse-row | |
[^String row] | |
(let [[k v] (.split row \tab) | |
[k1 k2] (map (partial string/join " ") (json/read-str k))] | |
[k1 k2 (Long/parseLong (.trim v))])) | |
(defn co-occurrence | |
[dir] | |
(let [source (hfs-textline dir)] | |
(<- [?k1 ?k2 ?count] |
This file contains 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 contextlib import contextmanager | |
@contextmanager | |
def binding(**pairs): | |
g = globals() | |
prev = dict((k, g[k]) for k in pairs.iterkeys() if k in g) | |
g.update(pairs) | |
try: | |
yield | |
finally: |