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
def filter_in_box(ps, l, u): | |
"""Fiter in points that lie inside rectangle.""" | |
res = ps[(ps[:, 0] >= l[0]) & (ps[:, 0] < u[0]) & (ps[:, 1] >= l[1]) & (ps[:, 1] < u[1])] | |
return res | |
def discrepancy(ps, l, u, method): | |
disc = scipy.stats.qmc.discrepancy( | |
scipy.stats.qmc.scale(filter_in_box(ps, l, u), l, u, reverse=True), | |
method=method) | |
return disc |
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
{{ define "head" }} | |
<link rel="stylesheet" href="{{ "css/anki.css" | relURL }}"> | |
<script> | |
function toggleCard() { | |
btn = document.getElementById("toggle-card-btn") | |
if(btn.textContent == "Show Answer") { | |
document.getElementsByClassName("anki-front")[0].style.display = "none"; | |
document.getElementsByClassName("anki-back")[0].style.display = "block"; | |
btn.textContent = "Hide Answer"; | |
} else { |
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 anki | |
import anki.collection | |
import anki.exporting | |
import datetime | |
import os | |
import re | |
import cssutils | |
import shutil | |
import logging |
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
public Dragon(double wingSpan, double name, SpeedCalculator speedCalculator) { | |
// There are no input checks this time! | |
this.wingSpan = wingSpan; | |
this.name = name; | |
this.speedCalculator = speedCalculator; // This is new! | |
} |
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
public class Dragon implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private double wingSpan; | |
private String name; | |
public Dragon(double wingSpan, String name) { | |
// Input checks. For example, insuring wing size is greater than zero. | |
this.wingSpan = wingSpan; | |
this.name = name; |
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
public class Dragon implements Serializable { | |
private static final long serialVersionUID = 1L; | |
private double wingSpan; | |
private String name; | |
private SpeedCalculator speedCalculator = new SpeedCalculator(); | |
public Dragon(double wingSpan, String name) { | |
// Input checks. For example, insuring wing size is greater than zero. | |
this.wingSpan = wingSpan; |
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
""" | |
A simple Python script to send messages to a sever over Bluetooth | |
using PyBluez (with Python 2). | |
""" | |
import bluetooth | |
serverMACAddress = '00:1f:e1:dd:08:3d' | |
port = 3 | |
s = bluetooth.BluetoothSocket(bluetooth.RFCOMM) |
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
""" | |
A simple Python script to receive messages from a client over | |
Bluetooth using PyBluez (with Python 2). | |
""" | |
import bluetooth | |
hostMACAddress = '00:1f:e1:dd:08:3d' # The MAC address of a Bluetooth adapter on the server. The server might have multiple Bluetooth adapters. | |
port = 3 | |
backlog = 1 |
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
# For the Server | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.bind(("192.168.1.17",50001)) # The Bluetooth MAC Address and RFCOMM port is replaced with an IP Address and a TCP port. | |
# For the Client | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect(("192.168.1.17",50001)) |
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
""" | |
A simple Python script to receive messages from a client over | |
Bluetooth using Python sockets (with Python 3.3 or above). | |
""" | |
import socket | |
hostMACAddress = '00:1f:e1:dd:08:3d' # The MAC address of a Bluetooth adapter on the server. The server might have multiple Bluetooth adapters. | |
port = 3 # 3 is an arbitrary choice. However, it must match the port used by the client. | |
backlog = 1 |
NewerOlder