This file contains hidden or 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 (get-in h . path) | |
(foldl (λ (p h) (hash-ref h p)) h path)) | |
(define nested-dict #hash((foo . | |
#hash((bar . | |
#hash((spam . | |
#hash((eggs . 1))))))))) |
This file contains hidden or 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
one_obvious = 'more than one' | |
print(f'There should be {one_obvious} way to do it.') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 | |
(require rsound) | |
(define *midi-notes* (range 38 85)) | |
(define (choice lst) | |
(list-ref lst (random (length lst)))) | |
(define (sublist lst midpoint width) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.