Skip to content

Instantly share code, notes, and snippets.

View dudanogueira's full-sized avatar
🎯
Focusing

Duda Nogueira dudanogueira

🎯
Focusing
View GitHub Profile
<!-- Start of Rocket.Chat Livechat Script -->
<script type="text/javascript">
(function(w, d, s, u) {
w.RocketChat = function(c) { w.RocketChat._.push(c) }; w.RocketChat._ = []; w.RocketChat.url = u;
var h = d.getElementsByTagName(s)[0], j = d.createElement(s);
j.async = true; j.src = 'https://chatbot.caeddigital.net/livechat/rocketchat-livechat.min.js?_=201903270000';
h.parentNode.insertBefore(j, h);
})(window, document, 'script', 'https://chatbot.caeddigital.net/livechat');
</script>
@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)'
Loading
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
Last active June 25, 2024 16:27
Weaviate with https/SSL using Traefik
---
services:
weaviate:
command:
- --host
- 0.0.0.0
- --port
- '8080'
- --scheme
- http
Loading
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,