Skip to content

Instantly share code, notes, and snippets.

@phreeza
phreeza / export-pdf-comments.py
Created August 17, 2016 11:12
Extract comments from a pdf file and dump them into a markdown file for pretty formatting.
# adapted from http://stackoverflow.com/a/12502560/379300
# Output should be valid markdown, so it can be turned into a nice pdf with pandoc
import poppler
import sys
import urllib
import os
def main():
input_filename = sys.argv[1]
# http://blog.hartwork.org/?p=612
@phreeza
phreeza / jneurophysiol.bst
Last active May 1, 2019 13:58
A BibTeX style file for the Journal of Neurophysiology. Based on the J Neuroscience style by Matthias Hennig http://www.ctan.org/tex-archive/biblio/bibtex/contrib/jneurosci/ Makes use of the Journal Abbreviation Package http://www.compholio.com/latex/jabbrv/, use with the noperiod option.
% This is a slightly modified version of the jneuroscience style, which itself is based on the namedplus style.
% Last modified 2014 July 01 by Thomas McColgan
%
% version = 0.1 of jneurophysiol.bst 2014 July 01
%
% Currently only @article and @incollection entries have been checked to conform with the formatting.
%
% This style makes use of the Automatic Journal Title Abbreviation Package, which can be obtained at
% http://www.compholio.com/latex/jabbrv/
% Include it by adding \usepackage[noperiod]{jabbrv} to your preamble.
import tensorflow as tf
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0) # also tf.float32 implicitly
with tf.Session() as sess:
W = tf.Variable([.3], tf.float32, name='W')
b = tf.Variable([-.3], tf.float32, name='b')
x = tf.placeholder(tf.float32, name='x')
with tf.name_scope("LinearModel"):
{
"embeddings": [
{
"tensorName": "Arxiv Titles",
"tensorShape": [
10000,
256
],
"tensorPath": "https://gist.githubusercontent.com/phreeza/e6a8f136fcda76bb7820f788e87e8681/raw/967badf2f7794a32e862c4ee2a8a65b59b118fb8/embeddings.tsv",
"metadataPath": "https://gist.github.com/phreeza/e6a8f136fcda76bb7820f788e87e8681/raw/967badf2f7794a32e862c4ee2a8a65b59b118fb8/metadata.tsv"
@phreeza
phreeza / embeddings.tsv
Created January 27, 2017 11:47
arxiv embeddings
We can't make this file beautiful and searchable because it's too large.
0.871428 0.818533 0.616601 -0.896398 0.750342 -0.0670242 -0.985361 -0.901136 -0.799989 0.661025 0.896552 -0.999996 -0.815607 -0.999946 0.210674 -0.795743 -0.936592 0.984476 0.415128 -0.640509 0.934588 0.483844 0.399479 0.215688 -0.992214 0.324514 0.454484 -0.800055 -0.999993 0.788731 -0.28611 -0.0720174 0.0251022 0.588688 0.598253 0.857084 0.999794 -0.953029 -0.865772 -0.289119 0.999546 -0.709774 -0.415915 0.0922971 -0.997911 -0.108204 -0.999999 -0.414267 -0.799834 -0.0698598 0.572549 0.410644 -0.790586 0.293573 0.999865 -0.476083 -0.678337 -0.662886 -0.999999 -0.136961 0.70228 0.05713 -0.96455 -0.715666 0.996947 -0.777469 0.999629 0.887067 0.506511 -0.691616 0.676756 -0.918784 0.835962 0.451829 -0.801001 0.0379395 0.999999 -0.096177 -1.0 0.977844 -0.771265 0.999997 0.97939 0.19234 -0.641295 -0.0612696 0.916226 0.447681 -0.651528 -0.844617 -0.661612 0.413032 0.989486 -0.897041 -0.685231 -0.335238 0.302788 -0.710447 -0.42624 0.914872 -0.312054 0.156264 0.983085 0.925359 0.916282 0.283454 0.371099 0.0488607 0.3
import glob
entries = []
for n,fname in enumerate(glob.glob('/Users/tom/Downloads/data/*/*.txt')):
f = open(fname)
s = f.readlines()
x = [g.split('\t') for g in ' '.join(s).strip().split('\n ----------\n')][:-1]
if n%1000 == 0:
print n,fname
for raw_entry in x:
@phreeza
phreeza / wedding.py
Last active July 2, 2016 16:43
A small terminal based animation I made for a friend's wedding
# This script is released 'as is' into the public domain
from math import cos,sin
import os
from time import sleep
def y(p):
return (sin(p)**3)
def x(p):
return -(13*cos(p)-5*cos(2*p)-2*cos(3*p)-cos(4*t))/16
while True:
for r in range(14):
@phreeza
phreeza / ocv_median_example.cpp
Created July 19, 2012 09:50
OpenCV DynamicImager example
#include <iostream> // for standard I/O
#include <string> // for strings
#include <iomanip> // for controlling float print precision
#include <sstream> // string to number conversion
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
#include <mtip.h>
int ocvMedianBlurMDF(HMTIPMOD hMod)
@phreeza
phreeza / scalebars.py
Created March 6, 2016 18:31 — forked from dmeliza/scalebars.py
matplotlib: add scale bars to axes
# -*- coding: utf-8 -*-
# -*- mode: python -*-
# Adapted from mpl_toolkits.axes_grid2
# LICENSE: Python Software Foundation (http://docs.python.org/license.html)
from matplotlib.offsetbox import AnchoredOffsetbox
class AnchoredScaleBar(AnchoredOffsetbox):
def __init__(self, transform, sizex=0, sizey=0, labelx=None, labely=None, loc=4,
pad=0.1, borderpad=0.1, sep=2, prop=None, **kwargs):
"""

Keybase proof

I hereby claim:

  • I am phreeza on github.
  • I am tmco (https://keybase.io/tmco) on keybase.
  • I have a public key whose fingerprint is CD4C 0BFB 64C8 D681 4227 561E 5924 70A9 0C46 A0EE

To claim this, I am signing this object: