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 prop.g12.common; | |
import com.google.common.collect.Sets; | |
import java.util.*; | |
/** | |
* This class encapsulates the Clique Percolation algorithm, used to detect overlapped communities inside non-directed | |
* and not weighted graphs. |
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 prop.g12.common; | |
import java.util.*; | |
/** | |
* This class represents non-directed weighted graphs without edges connecting nodes with themselves. The weights must | |
* be in the [0,1] interval, since they represent affinities between nodes in a normalized scale. | |
* | |
* This class is optimized for read operations, rather than write operations. | |
* |
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.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.io.IOException; | |
import java.lang.Process; | |
import java.lang.Runtime; | |
import java.util.HashMap; | |
/** | |
* SystemStatusReader is a collection of methods to read system status (cpu and memory) | |
* |
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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
######################################################################################################################## | |
# The MIT License (MIT) | |
# | |
# Copyright (c) 2016 Andrés Correa Casablanca | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
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
<?php | |
declare(strict_types=1); | |
/** | |
* Requires the DS extension (see https://github.com/php-ds/extension). | |
* This script is a benchmark for many possible combinations to perform matrix multiplications: | |
* - Ds\Vector vs PHP array | |
* - Single array vs Nested arrays | |
* - iterations order: I,J,K vs I,K,J |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<?php | |
declare(strict_types=1); | |
/** | |
* Requires the DS extension (see https://github.com/php-ds/extension). | |
* This script is a benchmark for simple RW operations on Ds\Vector (without affecting its length) | |
*/ | |
/** | |
* RESULTS (the times are not divided by the number of iterations, only numbers in the same row can be compared): |
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
<?php | |
declare(strict_types=1); | |
function array_zip(array ...$arrays): array | |
{ | |
// Applied suggestion from reddit | |
// https://www.reddit.com/r/PHP/comments/76czco/php_equivalent_of_pythons_zip_function/doe5j86/ | |
return \array_map(null, ...$arrays); | |
} |
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
<?php | |
/** | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2015 Andrés Correa Casablanca <castarco@litipk.com> | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a copy of | |
* this software and associated documentation files (the "Software"), to deal in | |
* the Software without restriction, including without limitation the rights to |
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
/** | |
* This approach has many limitations: | |
* - it does not accept variable names with numbers or other symbols (relatively easy to fix) | |
* - it does not accept arbitrary expressions (quite difficult to fix) | |
*/ | |
function deferredTemplateLiteral(template: string, env: { [key: string]: string | undefined }): string { | |
const varsMatcher = /\${([a-zA-Z_]+)}/ | |
const globalVarsmatcher = /\${[a-zA-Z_]+}/g | |
const varMatches: string[] = template.match(globalVarsmatcher) ?? [] |
OlderNewer