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
#lang racket | |
(define-syntax define-html-tag | |
(syntax-rules () | |
[(_ element) | |
(define element | |
(let ([es (symbol->string 'element)]) | |
(make-keyword-procedure | |
(lambda [keys vals . contents] | |
(let ([properties (string-join |
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
-----BEGIN PGP SIGNED MESSAGE----- | |
Hash: SHA512 | |
I am transitioning to using a new pgp key with fingerprint 272B9BDD29CFE9509A3DC60629A105A586DEB641. | |
You can get it from keyservers or keybase.io/jboy now. | |
This message is signed with my current key (74A7A4B33DE1D395), which expires in a few days. | |
-----BEGIN PGP SIGNATURE----- | |
iQIzBAEBCgAdFiEEsQFdpc0ErrdEdt31mR24sJ2K5NgFAlqEujsACgkQmR24sJ2K |
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
import requests | |
def pdf_to_text(pdf_file): | |
''' | |
See http://givemetext.okfnlabs.org/#api for a description of the API. | |
''' | |
r = requests.put('http://beta.offenedaten.de:9998/tika', open(pdf_file, 'rb')) | |
r.raise_for_status() | |
r.encoding = 'utf-8' |
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
import subprocess | |
from collections import defaultdict | |
from tempfile import NamedTemporaryFile | |
import igraph as ig | |
ROLX_BIN = 'Snap-3.0/examples/rolx/testrolx' | |
def extract_roles(input_graph, min_roles=2, max_roles=3): |
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
set -e | |
snap_env=snap_env | |
snap_pkg=snap-3.0.2-3.0-centos6.5-x64-py2.6 | |
virtualenv -p python2.7 ${snap_env} | |
source snap_env/bin/activate | |
if [-d $snap_pkg ] | |
then wget http://snap.stanford.edu/snappy/release/${snap_pkg}.tar.gz && tar xzf ${snap_pkg}.tar.gz | |
fi |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
(use srfi-1) ; provides filter | |
(define (quicksort elems) | |
(if (null? elems) (list) | |
(let [[middle (car elems)] | |
[others (cdr elems)]] | |
(let [[left (filter (lambda (x) (<= x middle)) others)] | |
[right (filter (lambda (x) (> x middle)) others)]] | |
(append (quicksort left) (cons middle (quicksort right))))))) |
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
# coding=utf-8 | |
import requests | |
from yaml import load as yaml_load | |
from functools import partialmethod | |
from urllib.parse import urlencode, quote | |
class Mapillary(object): | |
def __init__(self, token='token.yaml'): | |
self._base_url = 'https://a.mapillary.com/v2' |
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
MULTIPOLYGON (((4.7567178999999999 52.3778378000000020, 4.7564339000000002 52.3777635000000000, 4.7569860000000004 52.3770463000000030, 4.7575304999999997 52.3761888000000010, 4.7580470000000004 52.3750653000000030, 4.7583805000000003 52.3740153000000030, 4.7585170000000003 52.3732593000000010, 4.7585676000000001 52.3727554000000030, 4.7585964000000001 52.3722175999999990, 4.7585747999999999 52.3715943999999990, 4.7585107999999998 52.3712412000000000, 4.7584413999999997 52.3709575999999970, 4.7579834999999999 52.3692393999999980, 4.7578265000000002 52.3687134999999980, 4.7567178999999999 52.3778378000000020)), ((4.7590846000000004 52.3807575000000010, 4.7590851000000001 52.3807377999999990, 4.7590902000000002 52.3805027000000010, 4.7590915000000003 52.3804415999999970, 4.7590922000000004 52.3804074000000030, 4.7590925999999998 52.3803957000000010, 4.7591020999999998 52.3800388000000010, 4.7591023999999997 52.3800254000000010, 4.7591028000000000 52.3800136999999990, 4.7591124999999996 52.3797112000000030, 4.75 |
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 bs4 import BeautifulSoup as bs | |
r = !curl -s 'https://example.net' | |
s = bs(''.join(r)) | |
for link in s.findAll('a', {'href': lambda x: x.endswith('pdf')}): | |
loc = link['href'] | |
!curl -O $loc |