Skip to content

Instantly share code, notes, and snippets.

function delayed(){
return new Promise((resolve, reject)=>{
setTimeout(()=>resolve("1 sec passed"), 1000)
})
}
//delayed().then(res=>console.log(res))
async function syncAwaits(){
var label = "delay";
@santicalvo
santicalvo / find_word_recursive.sh
Created April 11, 2018 05:58
Find number of ocurrences of string recursively in bash
#!/usr/bin/env bash
# We require two arguments: folder to search and word
ocurrences=$(find $1 -type f -exec grep -io $2 {} \; | wc -l)
if [ "$ocurrences" -gt 0 ];then
echo "more than 0: $ocurrences"
else
echo "No ocurrences: $ocurrences"
fi