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 util.ext | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.count | |
import kotlinx.coroutines.flow.first | |
suspend fun <T> Flow<T>.all(predicate: suspend (T) -> Boolean): Boolean { | |
return this.count { !predicate(it) } == 0 | |
} |
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
#Author: Jorge Fernández Sánchez <jfsanchez.email@gmail.com> | |
#This function clone a git project and makes (in the working directory) a zip file with the project content. | |
#project packing from git | |
function git_pack { | |
_PWD=$PWD | |
GIT_PATH=$1 | |
GIT_PROJECT=`/usr/bin/basename $GIT_PATH` | |
OUTPUT_ZIP="$_PWD/$GIT_PROJECT.zip" | |
TMP_PATH="/var/tmp/" |
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 datetime import datetime, timedelta | |
import functools | |
def timed_cache(**timedelta_kwargs): | |
def _wrapper(f): | |
update_delta = timedelta(**timedelta_kwargs) | |
next_update = datetime.utcnow() + update_delta | |
# Apply @lru_cache to f with no cache size limit |