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
# syntax=docker/dockerfile:1-labs | |
# Aptos CLI git metadata. | |
ARG GIT_REPO=https://github.com/aptos-labs/aptos-core.git | |
ARG GIT_TAG=aptos-cli-v2.0.3 | |
# Relative to Econia repository root. | |
ARG MOVE_ROOT=src/move | |
ARG ECONIA_ROOT=$MOVE_ROOT/econia | |
ARG FAUCET_ROOT=$MOVE_ROOT/faucet |
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
// how to use this: | |
// 0. install node.js (https://nodejs.org/en/download/) | |
// 1. create a `.js` file with this code | |
// 2. put your songs or whatever in the input | |
// 3. run `node filename.js` | |
// 4. answer questions until you have a result | |
async function merge(A, temp, cmp, frm, mid, to) { | |
let k = frm; | |
let i = frm; |
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
pragma solidity ^0.7.0; | |
pragma experimental ABIEncoderV2; | |
// CHI: | |
// https://etherscan.io/address/0x0000000000004946c0e9F43F4Dee607b0eF1fA1c#code | |
// OneSplit: | |
// https://etherscan.io/address/0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e#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
from collections import Counter | |
from itertools import chain | |
# assumes a null terminating character | |
def n_grams(s, n): | |
last_idx = len(s) - n | |
return (s[i: i + n] for i in range(0, last_idx + 1)) | |
def k_n_grams(s, n): | |
return (gram for i in range(1, n + 1) for gram in n_grams(s, i)) |
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 String sortConcat(String[] arr) { | |
return Arrays.stream(arr) | |
.sorted() | |
.collect(Collectors.joining("")); | |
} |
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
// Sort the words and join them | |
public String sortConcat(String[] arr) { | |
String[] temp = Arrays.copyOf(arr, arr.length); | |
StringBuilder result = new StringBuilder(""); | |
Arrays.sort(temp); | |
for(int i = 0; i < temp.length; i++) { | |
result.append(temp[i]) | |
} | |
return result.toString(); | |
} |
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 String paramString(List<Map.Entry<String, String>> params){ | |
return params.stream() | |
.map(this::escapeEntry) | |
.sorted(comparingByKeyAndValue()) | |
.map(e -> e.getKey().concat("=").concat(e.getValue())) | |
.collect(Collectors.joining("&")); | |
} |