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
async subscribeOnAverageCollateralPrices(context): Promise<void> { | |
const { commit, state } = vaultActionContext(context); | |
const { collaterals, averageCollateralPriceSubscriptions } = state; | |
const newIds: string[] = []; | |
const idsToRemove: string[] = []; | |
// Check if there are new collateral assets or some of them were removed | |
// TODO Please, check - stablecoins may be different as well as collaterals | |
for (const collateralId in collaterals) { | |
if (!(collateralId in averageCollateralPriceSubscriptions)) { | |
newIds.push(collateralId); |
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
@Test | |
fun testQuorum() { | |
var keypair1 = ModelCrypto().generateKeypair() | |
var keypair2 = ModelCrypto().generateKeypair() | |
var txBuilder = ModelUtil.getModelTransactionBuilder() | |
var tx = txBuilder | |
.createdTime(ModelUtil.getCurrentTime()) | |
.creatorAccountId("test@notary") | |
.createAccount("multisig", "notary", keypair1.publicKey()) | |
.appendRole("multisig@notary", "tester") |
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
/** | |
* Inplace visitor for boost::variant. | |
* Usage: | |
* boost::variant<int, std::string> value = "1234"; | |
* ... | |
* visit_in_place(value, | |
* [](int v) { std::cout << "(int)" << v; }, | |
* [](std::string v) { std::cout << "(string)" << 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
import java.util.concurrent.Semaphore; | |
import java.util.concurrent.ThreadLocalRandom; | |
public class DiningPhilosophers { | |
static int philosophersNumber = 5; | |
static Philosopher philosophers[] = new Philosopher[philosophersNumber]; | |
static Fork forks[] = new Fork[philosophersNumber]; | |
static class Fork { |
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
#include <stdio.h> | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <sys/wait.h> | |
int 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
#include <stdio.h> | |
#include <stddef.h> | |
struct foo { | |
short a; | |
int b; | |
char c; | |
}; | |
int main(void) { |
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
/* | |
* To change this license header, choose License Headers in Project Properties. | |
* To change this template file, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package adjacencylistgraph; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.PrintWriter; |
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
//the third line for search | |
inStr = in.nextLine().trim().split(" "); | |
for (String str : inStr) { | |
if (!str.isEmpty()) { | |
AVLTree.Node node = tree.find(Integer.parseInt(str)).right; | |
out.print((node == null ? "null" : node.value) + " "); | |
System.out.print((node == null ? "null" : node.value) + " "); | |
} | |
} |
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
//the second line for search | |
inStr = in.nextLine().trim().split(" "); | |
for (String str : inStr) { | |
if (!str.isEmpty()) { | |
RBTree.Node node = tree.find(Integer.parseInt(str)); | |
node = node == null ? null : node.right; | |
out.print((node == null ? "null" : node.value) + " "); | |
System.out.print((node == null ? "null" : node.value) + " "); | |
} | |
} |
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
// Simple example of client. | |
// Client prints received messages to stdout and sends from stdin. | |
#include <errno.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <signal.h> | |
#include <unistd.h> | |
#include <sys/select.h> | |
#include <netinet/in.h> |
NewerOlder