Skip to content

Instantly share code, notes, and snippets.

View renatocassino's full-sized avatar

Renato Cassino renatocassino

View GitHub Profile
@royshouvik
royshouvik / console.ts
Last active October 4, 2022 00:12
Nestjs REPL
import 'dotenv/config';
import { NestFactory } from '@nestjs/core';
import * as repl from 'repl';
import * as Logger from 'purdy';
const LOGGER_OPTIONS = {
indent: 2,
depth: 1,
};
@wallyqs
wallyqs / Monitoring-channel.md
Last active July 28, 2020 20:50
NATS Streaming Grafana Dashboard

Monitoring a NATS Streaming channel with Grafana and Prometheus

Here you can find a few examples of monitoring NATS Streaming channels:

Pending Messages from Channel Foo

sum(nss_chan_subs_pending_count{channel="foo"}) by (client_id)
@alex-hall
alex-hall / promisify_and_jest_mocks.md
Last active December 29, 2022 17:07
How to mock a promisify'd method

Given an api that looks like this:

    this.client = redis.createClient()
    
    const asyncSet = promisify(this.client.set).bind(this.client)

    return asyncSet(key, value, "EX", expiry)
mkdir ~/docker
chmod 777 ~/docker
# Create network to all containers
docker network create dockernet
# Mongo
docker run -v ~/docker/mongo/data:/data/db -p 27017:27017 --name mongodb --network dockernet -d mongo
# CouchDB
@minhoryang
minhoryang / Dockerfile
Last active January 21, 2024 14:29
docker-ubuntu-build-essential
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y --no-install-recommends apt-utils build-essential sudo git
RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser docker sudo
USER docker
@dehamzah
dehamzah / generate.js
Last active April 14, 2024 16:47
Generate secret key in NodeJS
require('crypto').randomBytes(48, function(err, buffer) { var token = buffer.toString('hex'); console.log(token); });
@nerdyworm
nerdyworm / rename.sh
Created July 30, 2016 17:40
rename a phoenix project
#!/bin/bash
set -e
CURRENT_NAME="CurentName"
CURRENT_OTP="current_name"
NEW_NAME="NewName"
NEW_OTP="new_name"
@sid24rane
sid24rane / udp.js
Created July 25, 2016 08:39
Simple UDP Client and Server in Node.js ==> ( Echo Server )
var udp = require('dgram');
// --------------------creating a udp server --------------------
// creating a udp server
var server = udp.createSocket('udp4');
// emits when any error occurs
server.on('error',function(error){
console.log('Error: ' + error);
@gmalmquist
gmalmquist / maze.py
Created April 16, 2015 01:22
Simple ASCII-art maze generator with python, using basic un-optimized Prim's implementation.
#!/usr/bin/env python
from __future__ import print_function
import random
import sys
EMPTY = ' '
WALL = '#'
AGENT = 'o'
# Retorna dados sobre o pregão
http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoCarregarDados.asp?CodDado=IBOV,ticker&CA=undefined
# Retorna ações e seus últimos valores negociados
http://www.bmfbovespa.com.br/Pregao-OnLine/ExecutaAcaoCarregarDados.asp?CodDado=Ticker
# Retorna o histórico do dia de um papel
http://www.bmfbovespa.com.br/Pregao-Online/ExecutaAcaoCarregarDadosPapeis.asp?CodDado=petr4
# Retorna dados de um papel