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
# https://github.com/brechtm/citeproc-py | |
# https://github.com/citation-style-language/styles | |
from citeproc.py2compat import * | |
from citeproc import formatter, Citation, CitationItem, CitationStylesStyle, CitationStylesBibliography | |
from citeproc.source.json import CiteProcJSON | |
def get_citation(data, style): | |
bib_source = CiteProcJSON(data) |
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
# The lines below go into: /usr/share/X11/xorg.conf.d/40-libinput.conf | |
# Last tested on Ubuntu 18.04 on 13.08.2018 | |
# | |
# Enable scroll wheel emulation for the Logitech Trackman Marble mouse. Holding | |
# the small right button will allow you to scroll both vertically and | |
# horizontally using the ball; for using the left small button use 8 for | |
# ScrollButton. | |
# Source: https://wiki.archlinux.org/index.php/Logitech_Marble_Mouse#Using_libinput | |
# This config also disables the browser back/forward functionality of the small buttons | |
# and is intended for left-hand users. |
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
This work-in-progress summarizes the way-too-many BigData(tm) technologies. | |
This is by no means an in-depth description, but a very short summary so that | |
I know where to look. | |
1. Databases: | |
* DynamoDB - aws.amazon.com/dynamodb/ - Amazon AWS integration, MapReduce | |
* MongoDB - mongodb.org/ - JSON-style document database, SQL-like queries + MapReduce | |
* Riak - basho.com/riak/ - Key-Value storage, MapReduce | |
* CouchDB - couchdb.apache.org/ - JSON document storage, JavaScript Queries + MapReduce |
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
For compiling LaTeX documents (with BibTex support) we basically have two options: | |
LaTeX - will produce a DVI file: | |
latex -interaction=nonstopmode -shell-escape %.tex|bibtex %.aux|latex -interaction=nonstopmode -shell-escape %.tex|latex -interaction=nonstopmode -shell-escape %.tex|"C:/Program Files (x86)/MiKTeX 2.9/miktex/bin/yap.exe" %.dvi | |
PdfLaTeX: | |
pdflatex --shell-escape --enable-write18 -synctex=1 -interaction=nonstopmode %.tex|bibtex %.aux|pdflatex --shell-escape --enable-write18 -synctex=1 -interaction=nonstopmode %.tex|pdflatex --shell-escape --enable-write18 -synctex=1 -interaction=nonstopmode %.tex|"C:/Program Files (x86)/Adobe/Reader 11.0/Reader/AcroRd32.exe" %.pdf | |
These commands are tailored for Texmaker (Win) and will open the approiate preview application after compiling the documents. | |
Also, (E)PS file support is included; to make sure such images will be correctly displayed, add the following to your LaTeX source preamble: |
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
""" | |
This brief script demonstrates a frequent mistake in Python related | |
to the different ways of copying objects. | |
References: | |
1. Personal experience | |
2. http://stackoverflow.com/questions/2196956/add-an-object-to-an-array-python | |
""" | |
import copy # http://docs.python.org/library/copy.html |
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
# A funny thing about Python: http://hatepaste.com/paste/6c7e1a3c | |
True = False | |
if True: | |
print "ORLY?" | |
else: | |
print "YARLY!" | |
# BUT, this will work only in Python 2.x; in Python 3.x you will get | |
# "SyntaxError: assignment to keyword" at line 2 |
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
"""Some Python code to illustrate the 'issue' noticed in JavaScript here: | |
http://stackoverflow.com/questions/9381321/a-function-is-larger-than-an-array | |
This will work on Python 2.x; in Python 3.x you would get: | |
TypeError: unorderable types: list() > function() | |
""" | |
l1 = [] | |
def f(): |
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
"""These are my answers for the Embedly Challenge""" | |
from xml.etree import ElementTree | |
from numpy import std # you'll need numpy for Question 2 | |
def question1(): | |
def digitSum(x): | |
# pretty ugly, eh? | |
return sum(map(int, list(str(x)))) | |
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
"""To run this: $ python3 parse.py test.xml | |
The script will pase a XML file and print its node tags. | |
Compatible with Python 3; changing the print statements should make this | |
compatible with Python 2. | |
""" | |
import sys |
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
class MyClass: | |
def __init__(self, a_number, **kwargs): | |
self.a_number = a_number | |
for key, value in kwargs.items(): # adding new attributes | |
setattr(self, key, value) | |
if __name__ == "__main__": | |
MY_OBJECT = MyClass(1, a_string = "Hello world!") | |
print MY_OBJECT.a_number, MY_OBJECT.a_string |
NewerOlder