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
""" | |
ipython_doctester module is outdated. I tried to replace its test function with the function below | |
Code is from https://stackoverflow.com/a/47590703/996379 | |
""" | |
import doctest | |
import copy | |
def test(func): | |
''' | |
Use test as a decorator to a function with doctests in Jupyter notebook. | |
Run the cell to see the results of the doctests. |
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 http.server | |
""" | |
Original at https://gist.github.com/enjalot/2904124 | |
""" | |
class CORSHTTPRequestHandler(http.server.SimpleHTTPRequestHandler): | |
def send_head(self): | |
"""Common code for GET and HEAD commands. | |
This sends the response code and MIME headers. |
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 numpy as np | |
from datetime import timedelta | |
from functools import update_wrapper, wraps | |
from math import sin | |
from random import random | |
from six import string_types | |
from bokeh.models.widgets import DataTable, TableColumn | |
from bokeh.plotting import figure, show, output_file | |
from bokeh.models.sources import AjaxDataSource |
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
''' Rewrite the basic sliders example as a standalone document with JavaScript callbacks. | |
Present an interactive function explorer with slider widgets. | |
Scrub the sliders to change the properties of the ``sin`` curve, or | |
type into the title text box to update the title of the plot. | |
Run example with python sliders-standalone-code.py | |
In this version, the callbacks are written as strings of JS code. | |
''' |
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 numpy as np | |
import pandas as pd | |
import requests | |
def didWeWin(team_name): | |
text = requests\ | |
.get('https://raw.githubusercontent.com/Lightricks/datahack/master/leaderboard.md')\ | |
.text\ | |
.split("\n") | |
def get_line(line): | |
return list(map(lambda x:x.strip(), line.split("|"))) |
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
module type Numeric = | |
sig | |
type t | |
val (+) : t -> t -> t | |
val (-) : t -> t -> t | |
val ( * ): t -> t -> t | |
val (/): t -> t -> t | |
val c: float -> t | |
val abs: t -> float | |
end |
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
#!/usr/bin/python3 | |
# (conversion to python 3 of https://gist.github.com/fnielsen/4183541) | |
# (originally entered at https://gist.github.com/1035399) | |
# | |
# License: GPLv3 | |
# | |
# To download the AFINN word list do: | |
# wget http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6010/zip/imm6010.zip | |
# unzip imm6010.zip | |
# |
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 ubuntu:18.04 | |
# copies https://raw.githubusercontent.com/pytorch/pytorch/master/docker/pytorch/Dockerfile | |
ARG PYTHON_VERSION=3.6.10 | |
ARG WITH_TORCHVISION=1 | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
cmake \ | |
git \ | |
curl \ | |
ca-certificates \ |
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
-module(first). | |
-export([double/1, treble/1, square/1,perimeter/3, area/3]). | |
mult(X, Y) -> | |
X * Y. | |
double(X) -> | |
mult(2,X). | |
treble(X) -> | |
mult(3, X). | |
square(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
-module(ex2). | |
-export([max_three/3, how_many_equal/3, how_many_equal_test/0, xor1/2, xor2/2, xor3/2]). | |
xor1(true, B) -> | |
not B; | |
xor1(_, B) -> | |
B. |
OlderNewer