Skip to content

Instantly share code, notes, and snippets.

View ceelsoin's full-sized avatar
🏠
Working from home

Celso Inácio ceelsoin

🏠
Working from home
View GitHub Profile
@ceelsoin
ceelsoin / DynamicControllerImport.util.ts
Created December 31, 2021 17:26
Dynamic controller import inversify-express-utils
const path = require('path');
const loadHandlers = () => {
return new Promise(async (resolve, reject) => {
const fs = require('fs');
const dir = path.join(process.cwd(), process.env.NODE_ENV != 'production' ? 'src' : '','/Presentation/Handlers')
log(LogLevelEnum.INFO, `Loading controllers from ${dir}`)
await fs.readdir(dir, async (err, files) => {
let reducers = files.filter(a => a.includes('.'));

Setup:

Add before end of body in your public/index.html

    <script type="text/javascript" src="https://js.iugu.com/v2"></script>

Using example:

@ceelsoin
ceelsoin / a-mongodb-replica-set-docker-compose-readme.md
Created July 29, 2022 16:58 — forked from harveyconnor/a-mongodb-replica-set-docker-compose-readme.md
MongoDB Replica Set / docker-compose / mongoose transaction with persistent volume

This will guide you through setting up a replica set in a docker environment using.

  • Docker Compose
  • MongoDB Replica Sets
  • Mongoose
  • Mongoose Transactions

Thanks to https://gist.github.com/asoorm for helping with their docker-compose file!

@ceelsoin
ceelsoin / iugu.service.ts
Created August 5, 2022 15:21
Iugu service
import { inject, injectable } from "inversify";
import { ICustomerModel } from "../../Infra/Models/Customer.model";
import log, { LogLevelEnum } from "../Utils/logger.util";
require("dotenv").config();
const axios = require("axios").default;
export interface IIuguService {
getCustomers(): Promise<any>
getCustomerById(id: any): Promise<any>
@ceelsoin
ceelsoin / README.md
Created May 15, 2023 19:49
Docker MailServer + Round Cube (easy install)

Setup Docker MailServer + Round Cube (easy install)

1. Create docker-compose.yml (content below) and up

$ docker-compose up -d

2. Download setup script

@ceelsoin
ceelsoin / Signature.ts
Created July 5, 2023 01:20
Bunny TUS Upload Signature Typescript
require("dotenv").config();
const crypto = require("crypto");
private getAPIKey(): string {
return process.env.BUNNY_STREAM_API_KEY
}
private getSignature(library_id, video_id, expiration_time = 86400) {
//https://docs.bunny.net/reference/tus-resumable-uploads
const expires = Math.floor(new Date() as any / 1000) + expiration_time;
@ceelsoin
ceelsoin / gist:b593b5277b0364971f49cddb9b39649e
Created September 15, 2024 20:59
Find php shell/virus/malware in linux server
grep -rF \
-e "eval(" \
-e "base64_decode(" \
-e "shell_exec(" \
-e "exec(" \
-e "passthru(" \
-e "popen(" \
-e "proc_open(" \
-e "system(" \
-e "assert(" \