Skip to content

Instantly share code, notes, and snippets.

View dudanogueira's full-sized avatar
🎯
Focusing

Duda Nogueira dudanogueira

🎯
Focusing
View GitHub Profile
@dudanogueira
dudanogueira / Rocket.Connect.Management.Webhook.Script.Evolution.js
Last active March 16, 2024 19:39
Rocket.Connect.Management.Webhook.Script.Evolution.js
class Script {
/**
* @params {object} request
*/
prepare_outgoing_request({ request }) {
let match;
// match a allowed commands
match = '^'+ request.data.trigger_word + '\\s(status|start|close|livechat)'
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dudanogueira
dudanogueira / weaviate_dim_object_counter.py
Created January 23, 2024 19:34
Weaviate Dimension and Object Count
dim = 0
objects = 0
for c in client.schema.get()["classes"]:
# get class name
class_name = c["class"]
# get object count
count_query = client.query.aggregate(class_name).with_meta_count().do()
if not count_query.get("errors"):
object_count = count_query["data"]["Aggregate"][class_name][0]["meta"]["count"]
# get one object, to discover the dimensions length
@dudanogueira
dudanogueira / docker-compose.yaml
Created September 6, 2023 21:02
Weaviate with https/SSL using Traefik
---
version: '3.4'
services:
weaviate:
command:
- --host
- 0.0.0.0
- --port
- '8080'
- --scheme
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dudanogueira
dudanogueira / rocketchat-guest-deleter.py
Created May 30, 2023 13:42
Rocket.Chat Python script to delete visitors with the term guest
import requests
import json
# Set up the Rocket.Chat API endpoint and credentials
API_URL = 'http://localhost:3000'
USERNAME = 'adminrc'
PASSWORD = 'admin'
def get_auth_token():
volumes:
mongodb_data: { driver: local }
services:
rocketchat:
image: registry.rocket.chat/rocketchat/rocket.chat:${RELEASE:-latest}
restart: on-failure
labels:
traefik.enable: "true"
traefik.http.routers.rocketchat.rule: Host(`${DOMAIN}`)
@dudanogueira
dudanogueira / businesshours.js
Created February 28, 2023 20:42
Business Hours for Botpress
/**
* Simples Business Hour Verification Function
* @title Check for Business Hours
* @category Misc
* @author Duda Nogueira <duda.nogueira@gmail.com>
* @param {dict} business_hours - Business Hours Notation
* @param {string} time_zone - Business Hours Timezone
*/
function isInRange(value, range) {
@dudanogueira
dudanogueira / PetryPocApp.ts
Created December 13, 2022 20:12
Petry POC
import {
IAppAccessors,
IConfigurationExtend,
ILogger,
} from "@rocket.chat/apps-engine/definition/accessors";
import { App } from "@rocket.chat/apps-engine/definition/App";
import { IAppInfo } from "@rocket.chat/apps-engine/definition/metadata";
import {
IHttp,
@dudanogueira
dudanogueira / gist:b3f4f04b7ba2d2dc6b7debe5115e6ed6
Last active September 12, 2022 16:23
Clone Rocket.Chat settings
We couldn’t find that file to show.