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
use std::iter::Iterator; | |
use rand; // requires the rand crate | |
use rand::Rng; | |
use std::f64; | |
// I came up with this little algorithm because it seems | |
// (as far as I could google) there are no simple methods | |
// for selecting a single value randomly _and_ fairly | |
// from a variable-size stream/iterator in a single pass. |
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 sys, os, base64, datetime, hashlib, hmac | |
import requests | |
import json | |
from typing import * | |
# based on the example python code found here: | |
# https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html | |
# call this method to query all items for a given primary hash key in a table | |
# endpoint: the DynamoDB endpoint to query (for AWS servers, this is "https://dynamodb.{region}.amazonaws.com/") |
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
mod linked_list { | |
use std::fmt::Display; | |
use std::default::Default; | |
type Next<V> = Option<Box<Node<V>>>; | |
struct Node<V> { | |
val: V, | |
next: Next<V>, | |
} |
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
mod sort { | |
fn insert_from_right<S>(vals: &mut [S], left: usize, right: usize) where S: Clone { | |
let mut i = right; | |
let mut temp; | |
while i > left { | |
temp = vals[i].clone(); | |
vals[i] = vals[i - 1].clone(); | |
vals[i - 1] = temp; | |
i -= 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
あっ#あっ#Ah!, Oh!#int | |
ああ#ああ#like that, that way#int | |
愛#あい#love#n,n-suf,vs | |
あいかわらず#あいかわらず#as ever, as usual, the same#adv,n | |
挨拶#あいさつ#greeting, salutation#n,vs | |
愛情#あいじょう#love, affection#n | |
合図#あいず#sign, signal#n,vs | |
アイスクリーム#アイスクリーム#ice cream#n | |
愛する#あいする#to love#vs-s | |
間#あいだ#space, room, time#n |
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
#!/bin/bash | |
# this script will run input/output tests for java programs | |
USAGE="Usage: | |
javatest.sh <progpath> <inputs_folder_path> <expected_outputs_folder_path> | |
The names of the input files is expected to be the same as the name of the corresponding expected output files." | |
if [[ $# != 3 ]]; then |