Skip to content

Instantly share code, notes, and snippets.

View micalevisk's full-sized avatar
🇧🇷
HTTP 499 ~ Adding bugs to programs.‏‏‎

Micael Levi L. Cavalcante micalevisk

🇧🇷
HTTP 499 ~ Adding bugs to programs.‏‏‎
View GitHub Profile
@micalevisk
micalevisk / tex-manifest.jsonc
Last active November 27, 2023 16:50
Tarken Extension manifest file samples
{
// Nome único para esta extensão dentre todas as extensões cadastradas na plataforma
"name": "dashboards-para-a-proposta",
// Nome amigável para usuários
"displayName": "dashboards para a proposta",
// Visibilidade da extensão, ie., se estará disponível ou não para outras organizações
"private": true,
// Versão da extensão
"version": "1.2.0",
// Versão da Tarken Extensions API usada pela extensão. Ditará funcionalidades disponíveis para este manifesto
@micalevisk
micalevisk / _nodejs web frameworks.md
Last active March 18, 2024 21:47
Comparing the popularity of few Node.js web frameworks.
@micalevisk
micalevisk / Dockerfile
Last active December 14, 2023 15:04
Production Dockerfile example for NestJS projects.
## ===========================================================> The common stage
FROM node:16.14 AS base
ENV NODE_ENV=production
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
## Remove unnecessary files from `node_modules` directory
@micalevisk
micalevisk / make-autocannon-command.mjs
Created March 20, 2022 19:29
Generates `autocannon` (https://github.com/mcollina/autocannon) command from user's answers
#!/usr/bin/env -S npx zx
$.shell = '/usr/bin/bash'
$.verbose = process.env.NODE_ENV === 'development'
// ========================================================================== //
function quitWitError(errorMsg) {
console.error( chalk.bold.red(errorMsg) )
process.exit(1)
}
function assertNotEmpty(val, errorMsg) {
/* version: 03-14-2022 */
.swagger-ui .info .title, .swagger-ui a.nostyle, .swagger-ui .parameter__name, .swagger-ui .parameter__type, .swagger-ui .parameter__deprecated, .swagger-ui .parameter__in, .swagger-ui table thead tr th, .swagger-ui .response-col_status, .swagger-ui table thead tr td, .swagger-ui .opblock .opblock-section-header h4, .swagger-ui label, .swagger-ui .tab li, .swagger-ui .opblock .opblock-section-header label, .swagger-ui .btn {
color: #CCCCCC;
}
body, .swagger-ui .info .title, .swagger-ui .scheme-container, .swagger-ui select {
background-color: #222;
color: #CCC;
}
.swagger-ui .opblock .opblock-section-header {
@micalevisk
micalevisk / show_last_modified_dates.sh
Last active July 23, 2023 23:12
Display the last modified date of every package on package.json dependencies list using npm-view (https://docs.npmjs.com/cli/v7/commands/npm-view)
#!/bin/bash
## (c) 2022 Micael Levi L. C.
## This script requires:
## - npm (https://nodejs.org)
## - jq (https://stedolan.github.io/jq)
file="${1:-./package.json}"
[ -r "$file" ] || { echo "The file $file is not readable" ; exit 1 ; }
@micalevisk
micalevisk / redis-raw-generator.js
Last active January 17, 2022 01:26
NodeJS slim function to generate a string that follows the Redis protocol (RESP) from a command name and its args. Inspired by https://redis.io/topics/mass-insert
// https://redis.io/topics/protocol
/**
* @param {string} str
* @returns {number}
* (c) https://stackoverflow.com/a/27377098/5290447
*/
function getBinarySize(str) {
return Buffer.byteLength(str, 'utf8');
}
@micalevisk
micalevisk / _README_.md
Last active August 11, 2023 21:14
A non-exhaustive list of patterns to help hidding all RC (run commands) and configuration files of Node.js projects on VSCode!
@micalevisk
micalevisk / __README.md
Last active December 25, 2023 18:18
My general purposes GitHub CLI (gh https://cli.github.com) aliases and extensions stuff
chmod +x *.sh

./set-aliases.sh
./install-exts.sh

mkdir -p ~/.config/prs/ && mv gh-prs--config.yml ~/.config/prs/config.yml
@micalevisk
micalevisk / algorithms_good_to_know.md
Last active December 31, 2021 03:00
General purporses algorithms implemented in JavaScript.

maximum subarray sum

Kadane's algorithm

code
/**
 * @param {number[]} arr - Array com valores arbitrários.