Skip to content

Instantly share code, notes, and snippets.

@aparrish
aparrish / spacy_intro.ipynb
Last active July 29, 2024 21:03
NLP Concepts with spaCy. Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aklap
aklap / fix-missing-libcrypto-osx.md
Created October 17, 2016 04:25
Resolving missing link to libcrypto/openssl on OSX
@zaz
zaz / dijkstra.py
Last active January 2, 2023 21:51
Dijkstra's algorithm — Python. Deprecated: Find the updated version at https://github.com/zaz/dijkstra
# Zaz Brown
# github.com/zaz/dijkstra
"""An efficient algorithm to find shortest paths between nodes in a graph."""
from collections import defaultdict
class Digraph(object):
def __init__(self, nodes=[]):
self.nodes = set()
self.neighbours = defaultdict(set)
self.dist = {}
@etienned
etienned / extractdocx.py
Last active November 21, 2022 13:56
Simple function to extract text from MS XML Word document (.docx) without any dependencies.
try:
from xml.etree.cElementTree import XML
except ImportError:
from xml.etree.ElementTree import XML
import zipfile
"""
Module that extract text from MS XML Word document (.docx).
(Inspired by python-docx <https://github.com/mikemaccana/python-docx>)
@only-entertainment
only-entertainment / gist:5432505
Last active December 16, 2015 12:09
Quick way to get a pdb breakpoint
def set_trace():
"""
Wrapper for ``pdb.set_trace``.
"""
from config import app
if not app.debug: return
import pdb
pdb.set_trace()
@only-entertainment
only-entertainment / vin_validation.py
Created March 24, 2012 00:42
Validate a VIN using Python
class VINLookupForm(Form):
"""
Lookup a VIN form
"""
vin = TextField(u'Enter VIN',
validators=[validators.Required(u'VIN is required for lookup.')])
def validate_vin(self, field):
"""
Validate a VIN against the 9th position checksum
@gnunicorn
gnunicorn / forms.html
Created October 13, 2011 16:02
Jinja2 WTForms macros for twitter bootstrap
{%- macro form_field_label(field) -%}
<label for="{{ field.id }}">{{ field.label.text }}
{%- if field.flags.required -%}
<abbr title="Diese Feld muss angegeben werden">*</abbr>
{%- endif %}</label>
{% endmacro %}
{%- macro form_field_description(field) -%}
{% if field.description %}
<span class="descr">{{ field.description }}</span>