Skip to content

Instantly share code, notes, and snippets.

View yoavram's full-sized avatar

Yoav Ram yoavram

View GitHub Profile
@yoavram
yoavram / pypdfx.py
Last active September 12, 2022 12:09
A python client to pdfx 1.0 a "Fully-automated PDF-to-XML conversion of scientific text" (http://pdfx.cs.man.ac.uk/). Written to be used in Markx, a scientific-oriented Markdown editor (https://github.com/yoavram/markx).
# pdfx usage: http://pdfx.cs.man.ac.uk/usage
# requests docs: http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file
import requests # get it from http://python-requests.org or do 'pip install requests'
url = "http://pdfx.cs.man.ac.uk"
def pypdfx(filename):
'''
Filename is a name of a pdf file WITHOUT the extension
The function will print messages, including the status code,
@yoavram
yoavram / docverter.py
Created December 21, 2012 23:25
Submit file for conversion with Docverter using python with the requests library. Docverter API: http://www.docverter.com/api.html (see the httpie example). requests: http://docs.python-requests.org/en/latest/user/quickstart/#more-complicated-post-requests. I'm not sure it's relevant but I think this only worked after I installed httpie (https:/…
import requests
url = 'http://c.docverter.com/convert'
filename = 'curriculum-vita.md'
print 'Sending request to Docverter for file', filename
r = requests.post(url, data={'to':'pdf','from':'markdown'},files={'input_files[]':open(filename,'rb')})
if r.ok:
outname = '.'.join(filename.split('.')[:-1])
fout = open(outname, 'wb')
fout.write(r.content)
fout.close()
@yoavram
yoavram / gist:4495940
Created January 9, 2013 19:11
Example of numbered equations with Pandoc's Markdown

Numbered equations

(@mean-fitness) $\bar{\omega} = p + (1-s)q$

Equation (@mean-fitness) is one of the most famous in population genetics.

Another famous equation is:

(@p-dif) $$ p' = p(1-\mu) $$

@yoavram
yoavram / tmp.txt
Created January 13, 2013 12:21
automaticaly created with github.js
Code here
@yoavram
yoavram / tmp.txt
Created January 13, 2013 12:21
automaticaly created with github.js
Code here
@yoavram
yoavram / tmp.txt
Created January 13, 2013 12:22
automaticaly created with github.js
Code here
@yoavram
yoavram / tmp.txt
Created January 13, 2013 12:22
automaticaly created with github.js
Code here
@yoavram
yoavram / tmp.txt
Created January 13, 2013 12:23
automaticaly created with github.js
Code here
@yoavram
yoavram / tmp.txt
Created January 13, 2013 12:23
automaticaly created with github.js
Code here
@yoavram
yoavram / tmp.txt
Created January 13, 2013 12:24
automaticaly created with github.js
Code here