As configured in my dotfiles.
start new:
tmux
start new with session name:
| import numpy as np | |
| from scipy.spatial.distance import cdist | |
| from lapjv import lapjv | |
| def grid_embedding(h): | |
| assert int(np.sqrt(h.shape[0])) ** 2 == h.shape[0], 'Nb of examples must be a square number' | |
| size = np.sqrt(h.shape[0]) | |
| grid = np.dstack(np.meshgrid(np.linspace(0, 1, size), np.linspace(0, 1, size))).reshape(-1, 2) | |
| cost_matrix = cdist(grid, h, "sqeuclidean").astype('float32') | |
| cost_matrix = cost_matrix * (100000 / cost_matrix.max()) |
| import PIL.Image | |
| from cStringIO import StringIO | |
| import IPython.display | |
| import numpy as np | |
| def showarray(a, fmt='png'): | |
| a = np.uint8(a) | |
| f = StringIO() | |
| PIL.Image.fromarray(a).save(f, fmt) | |
| IPython.display.display(IPython.display.Image(data=f.getvalue())) |
| from subprocess import call | |
| import numpy as np | |
| import os | |
| import pandas as pd | |
| from skimage.io import imsave | |
| def download(url): | |
| fname = os.path.basename(url) | |
| if not os.path.exists(fname): |
| import pickle | |
| import sys | |
| import numpy as np | |
| import os | |
| from subprocess import call | |
| import pandas as pd | |
| from skimage.io import imsave | |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| id | start | end | |
|---|---|---|---|
| 0 | 2015-06-06 09:23:14.000000 | 2015-06-06 10:23:00.000000 | |
| 1 | 2015-06-06 10:28:05.000000 | 2015-06-06 11:28:00.000000 | |
| 2 | 2015-06-06 11:33:00.000000 | 2015-06-06 12:33:00.000000 | |
| 3 | 2015-06-06 12:38:00.000000 | 2015-06-06 13:38:00.000000 | |
| 4 | 2015-06-06 14:12:06.000000 | 2015-06-06 15:12:00.000000 | |
| 5 | 2015-06-06 15:20:10.000000 | 2015-06-06 16:20:00.000000 | |
| 6 | 2015-06-06 16:25:00.000000 | 2015-06-06 17:25:18.000000 | |
| 7 | 2015-06-08 09:38:39.000000 | 2015-06-08 10:39:00.000000 | |
| 8 | 2015-06-08 10:44:00.000000 | 2015-06-08 11:44:00.000000 |
| # remap prefix from 'C-b' to 'C-a' | |
| unbind C-b | |
| set-option -g prefix C-a | |
| bind-key C-a send-prefix | |
| # Start window numbering at 1 | |
| set -g base-index 1 | |
| set -g @plugin 'tmux-plugins/tpm' | |
| set -g @plugin 'tmux-plugins/tmux-sensible' | |
| set -g @plugin 'tmux-plugins/tmux-copycat' |
| # docker build -t ubuntu1604py36 | |
| FROM ubuntu:16.04 | |
| RUN apt-get update | |
| RUN apt-get install -y software-properties-common vim | |
| RUN add-apt-repository ppa:jonathonf/python-3.6 | |
| RUN apt-get update | |
| RUN apt-get install -y build-essential python3.6 python3.6-dev python3-pip python3.6-venv | |
| RUN apt-get install -y git |
Cython has two major benefits:
Cython gains most of it's benefit from statically typing arguments. However, statically typing is not required, in fact, regular python code is valid cython (but don't expect much of a speed up). By incrementally adding more type information, the code can speed up by several factors. This gist just provides a very basic usage of cython.
| # Copyright 2017 The TensorFlow Authors. All Rights Reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, |