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 winston from 'winston' | |
const createWinstonLogger = () => winston.createLogger({ | |
levels: winston.config.syslog.levels, | |
transports: [ | |
new winston.transports.Console({ | |
level: 'info', | |
format: winston.format.combine( | |
winston.format.colorize({ all: true }), |
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
// ------------------------------- lib | |
import amqp from 'amqplib' | |
import { v4 as uuidv4 } from 'uuid' | |
import { | |
Broker, | |
BrokerBinding, | |
BrokerConfig, |
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
interface FileEntry { | |
path: string | |
buffer?: Buffer | |
contents?: FileEntry[] | |
} | |
async function zipFiles (files: FileEntry[]): Promise<Buffer> { | |
const archive = archiver('zip', { zlib: { level: 9 } }) | |
const output: Buffer[] = [] |
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 fs from 'node:fs' | |
import path from 'node:path' | |
import os from 'node:os' | |
import archiver from 'archiver' | |
interface FileNode { | |
name: string | |
content?: Buffer | |
children?: FileNode[] |
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 bash | |
# | |
# Author: @andersonbosa | |
# Description: This script generates a changelog based on Git commit history. | |
# It identifies the last release commit, parses the commit messages, and | |
# categorizes them into different sections based on semantic keys. The resulting | |
# changelog is formatted and saved to a specified file location. | |
# | |
ABSOLUTE_SCRIPT_FILE_PATH="${BASH_SOURCE:-$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
interface AuthenticationService { | |
authenticate<I, O> (body: I): Promise<O> | |
} | |
class BasicAuthenticationService implements AuthenticationService { | |
async authenticate<I, O> (body: I): Promise<O> { | |
const r = { content: "authenticated" } | |
return r as O | |
} |
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
/* | |
In this article, we reviewed a few ways to iterate over the keys and values of enum types | |
in TypeScript. First, we used the inbuilt methods of any TypeScript object, noting that | |
they are fairly “low-level”. | |
Second, we moved to a higher-level approach, with for loops. We verified that we can teach | |
TypeScript to preserve the typing given by enums, without relying on the string or numeric | |
representation. | |
*/ | |
enum TrafficLight { |
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 alpine:edge | |
WORKDIR /bin/app | |
RUN wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz \ | |
&& tar -xzvf node_exporter-1.7.0.linux-amd64.tar.gz --directory . \ | |
&& mv -v ./node_exporter-1.7.0.linux-amd64/node_exporter /bin/node_exporter \ | |
&& chmod 777 /bin/node_exporter |
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
'use client' | |
import { HTMLAttributes, useEffect, useState } from 'react' | |
import { Table } from '../atoms/Table' | |
import { fetchGithubRepositoriesByUsername } from '@/app/lib/fetch' | |
import { GithubRepo } from '@/lib/types/global' | |
export type GithubRepo = { | |
name: any |
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
/** | |
* Allow only one call within the time limit | |
* @param { Function } func function to limited | |
* @param { Number } limit time limite in miliseconds | |
*/ | |
export function throttle (func: Function, limit: number) { | |
let inThrottle: boolean | |
return function (this: any) { | |
const args = arguments | |
const context = this |
NewerOlder