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
version: '3' | |
services: | |
loki: | |
image: grafana/loki:2.0.0 | |
ports: | |
- "3100:3100" | |
command: -config.file=/etc/loki/local-config.yaml | |
promtail: | |
image: grafana/promtail:2.0.0 | |
volumes: |
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
# ´a ´c ~a | |
setxkbmap -model abnt2 -layout us -variant intl | |
# á ç ã |
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 axios from 'axios'; | |
import cheerio from 'cheerio'; | |
import logger from './lib/logger'; | |
const BASE_URL = 'https://www.airbnb.com'; | |
const URL = `${BASE_URL}/s/Miami--FL--United-States/homes`; | |
const CSS_QUERY = '._fhph4u ._8ssblpx'; | |
const CSS_QUERY_PAGINATOR = 'nav[data-id="SearchResultsPagination"] > ul > li a[aria-label="Next"]'; | |
const content = { |
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
set -g terminal-overrides 'xterm:colors=88' | |
set -g default-terminal "screen-256color" |
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
const moveLineUp = (line) => { | |
// Internal function to recursive | |
const moveLineUpInner = (currentLine, results=[]) => { | |
if (currentLine.length === 0) return results; | |
if(currentLine[0] === currentLine[1]) { | |
const total = currentLine[0] + currentLine[1]; | |
return moveLineUpInner(currentLine.slice(2), [...results, total]); | |
} |
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
// Generate array with size | |
const generateArraySize = (size, defaultValue = 0) => Array.from({ length: size }, () => defaultValue); | |
// Function receive an array and the size | |
const arrayPad = (arr=[], size=4) => { | |
return [...arr, ...generateArraySize(size - arr.length)]; | |
}; | |
console.log(arrayPad([2,4,8], 4)); | |
console.log(arrayPad([2], 4)); |
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
/** | |
* @param line Array Old board array | |
*/ | |
const moveLineUp = (line) => { // One uniq parameter | |
// Internal function to recursive | |
const moveLineUpInner = (counter, lineWithoutZeros, results=[]) => { | |
// now we have only a counter | |
if(counter === 0) return results; // If 0, return | |
if (lineWithoutZeros.length === 0) { // If all numbers different of 0 are empty |
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
/** | |
* @param line Array Old board array | |
* @param result New array with new state. Start empty | |
* @param lineWithoutZerosMemoized array list of numbers in line without 0 | |
*/ | |
const moveLineUp = (line, results=[], lineWithoutZerosMemoized=null) => { | |
// line is used like a counter to add in results | |
if(line.length === 0) return results; // If line is empty, get out recursion | |
const lineWithoutZeros = lineWithoutZerosMemoized || line.filter((n)=>n > 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
/** | |
* @param line Array Old board array | |
* @param result New array with new state. Start empty | |
* @param lineWithoutZerosMemoized array list of numbers in line without 0 | |
*/ | |
const moveLineUpFirst = (line, result=[], lineWithoutZerosMemoized=null) => { | |
const currentIndex = result.length; // The size of result is equals the line index | |
if(line.length === currentIndex) return result; // if result are full, return | |
const lineWithoutZeros = lineWithoutZerosMemoized || line.filter((n)=>n > 0); // In first iterate, set, in next iterates keep the 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
// npm i --save benchmark | |
const Benchmark = require('benchmark'); | |
var suite = new Benchmark.Suite; | |
const addNumberFunc = (board, point, number=2)=>{ | |
const line = board[point[0]]; | |
return [ | |
...board.slice(0, point[0]), | |
[ | |
...line.slice(0, point[1]), |
NewerOlder