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
private fun readChar(): Char = readString()[0] | |
private fun readChars(): CharArray = readString().toCharArray() | |
private fun readInt(): Int = readLine()!!.toInt() | |
private fun readInts(): List<Int> = readLine()!!.trim().split(" ").map(String::toInt) | |
private fun readLong(): Long = readLine()!!.toLong() | |
private fun readLongs(): List<Long> = readLine()!!.trim().split(" ").map(String::toLong) | |
private fun readString(): String = readLine()!!.trim() | |
private fun readStrings(): List<String> = readLine()!!.trim().split(" ") | |
fun roll(die: Int, dieSides: Int) = Pair(die + (die % dieSides) + (die + 1) % dieSides + 2, (die + 2) % dieSides + 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
private fun readChar(): Char = readString()[0] | |
private fun readChars(): CharArray = readString().toCharArray() | |
private fun readInt(): Int = readLine()!!.toInt() | |
private fun readInts(): List<Int> = readLine()!!.trim().split(" ").map(String::toInt) | |
private fun readLong(): Long = readLine()!!.toLong() | |
private fun readLongs(): List<Long> = readLine()!!.trim().split(" ").map(String::toLong) | |
private fun readString(): String = readLine()!!.trim() | |
private fun readStrings(): List<String> = readLine()!!.trim().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
import java.util.* | |
private fun readChar(): Char = readString()[0] | |
private fun readChars(): CharArray = readString().toCharArray() | |
private fun readInt(): Int = readLine()!!.toInt() | |
private fun readInts(): List<Int> = readLine()!!.trim().split(" ").map(String::toInt) | |
private fun readLong(): Long = readLine()!!.toLong() | |
private fun readLongs(): List<Long> = readLine()!!.trim().split(" ").map(String::toLong) | |
private fun readString(): String = readLine()!!.trim() | |
private fun readStrings(): List<String> = readLine()!!.trim().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
private fun readChar(): Char = readString()[0] | |
private fun readChars(): CharArray = readString().toCharArray() | |
private fun readInt(): Int = readLine()!!.toInt() | |
private fun readInts(): List<Int> = readLine()!!.trim().split(" ").map(String::toInt) | |
private fun readLong(): Long = readLine()!!.toLong() | |
private fun readLongs(): List<Long> = readLine()!!.trim().split(" ").map(String::toLong) | |
private fun readString(): String = readLine()!!.trim() | |
private fun readStrings(): List<String> = readLine()!!.trim().split(" ") | |
data class Header(val version: Long, val typeId: Long) |
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 java.util.* | |
private fun readChar(): Char = readString()[0] | |
private fun readChars(): CharArray = readString().toCharArray() | |
private fun readInt(): Int = readLine()!!.toInt() | |
private fun readInts(): List<Int> = readLine()!!.trim().split(" ").map(String::toInt) | |
private fun readLong(): Long = readLine()!!.toLong() | |
private fun readLongs(): List<Long> = readLine()!!.trim().split(" ").map(String::toLong) | |
private fun readString(): String = readLine()!!.trim() | |
private fun readStrings(): List<String> = readLine()!!.trim().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
use std::vec; | |
fn closure_with_captured_variables(target_bytes: &[u8], prefix: &[u8]) -> @fn(&[u8]) -> ~[u8] { | |
|bytes| { | |
vec::append(bytes.to_owned(), target_bytes) | |
} | |
} | |
fn main() { |
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::vec; | |
fn encrypt_decrypt_consistent_key() -> (@fn(&[u8]) -> ~[u8], @fn(&[u8]) -> ~[u8]) { | |
let key = "random key".as_bytes().to_owned(); | |
let key0 = copy key; | |
(|bytes: &[u8]| { | |
vec::append(bytes.to_owned(), key) | |
}, |bytes: &[u8]| { | |
vec::append(bytes.to_owned(), key) |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"os/exec" | |
) | |
type MyWriter struct{} |
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
// Arduino UNO system clock speed: 16 MHz | |
// max SPI clock frequency: 10 MHz | |
// shift order: MSB first | |
// SPC idle level: HIGH | |
// data samples capture edge: rising | |
#include <SPI.h> | |
#include <Servo.h> |
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 [success] = test_pca() | |
eps = 1E-4; | |
X = [ ... | |
0.8414710 -0.2879033 -0.4040376 0.9017883 -0.9661178 0.5661076 0.1059875 -0.7271425 0.9988152 -0.7904332 0.2021499; ... | |
0.9092974 -0.9613975 0.5514267 0.1235731 -0.7391807 0.9995202 -0.7794661 0.1847817 0.4987132 -0.9425145 0.9333205; ... | |
0.1411200 -0.7509872 0.9999119 -0.7682547 0.1673557 0.5139785 -0.9482821 0.9268185 -0.4599035 -0.2280523 0.8064006; ... | |
0.7568025 0.1498772 0.5290827 -0.9537527 0.9200260 -0.4441127 -0.2452520 0.8167426 -0.9956870 0.6960801 -0.0619203; ... | |
0.9589243 0.9129453 -0.4281827 -0.2623749 0.8268287 -0.9938887 0.6832617 -0.0442427 -0.6160405 0.9802397 -0.8733120; ... |
NewerOlder