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.Chat.Graylog.Incoming.Webhook.Script.js
Last active July 8, 2022 20:56
A Webhook Script to parse Graylog alert payload.
/* exported Script */
/* globals console, _, s */
/** Global Helpers
*
* console - A normal console instance
* _ - An underscore instance
* s - An underscore string instance
*/
@dudanogueira
dudanogueira / rocketchat.user.remove.deactivate.py
Last active May 24, 2022 19:55
Simple script to remove a user and recreated it inactive for Rocket.Chat
# LICENSE: MIT
# Author: duda.nogueira@rocket.chat
#
# Required permissions:
# - delete-user
# - create-user
#
# Description: This script will:
# - Get provided users from a Rocket.Chat Server
# - Remove those users
@dudanogueira
dudanogueira / rocketchat.user.deactivator.py
Last active May 24, 2022 17:25
Simples Script to deactivate a user and prune it's messages from a Rocket.Chat Server
# LICENSE: MIT
# Author: duda.nogueira@rocket.chat
#
# Required permissions:
# - manage-users
# - view-other-user-channels
# - remove messages
#
# Description: This script will:
# - Get provided users from a Rocket.Chat Server
@dudanogueira
dudanogueira / Rocket.Chat.Twillio.SMS.Outgoing.Webhook.Script.js
Last active February 25, 2022 18:51
Rocket.Chat Twillio integration for outgoing sms
/* exported Script */
/* globals console, _, s, HTTP */
// Author: duda.nogueira@rocket.chat
/** Global Helpers
*
* console - A normal console instance
* _ - An underscore instance
* s - An underscore string instance
* HTTP - The Meteor HTTP object to do sync http calls
*/
@dudanogueira
dudanogueira / Rocket.Connect.Management.Webhook.Script.js
Last active August 19, 2022 12:08
An Outgoing webhook script to integrate with Rocket.Connect from within Rocket.Chat
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)'
@dudanogueira
dudanogueira / business_day.js
Last active January 25, 2022 22:50
Simple business day checker
function isInRange(value, range) {
match = value >= range[0] && value <= range[1];
return match
}
function isInRanges(value, range) {
matches = []
range.split(",").forEach(function(timeframe) {
times = timeframe.split("-");
match = isInRange(value, times)
import requests, urllib, datetime, os
from github import Github
g = Github(os.environ.get("GH_TOKEN"))
repo_rc = g.get_repo("RocketChat/Rocket.Chat")
repo_fq = g.get_repo("RocketChat/feature-requests")
@dudanogueira
dudanogueira / validador_cns.py
Last active March 5, 2024 18:50
Validar CNS Cartão Nacional de Saúde em Python
#
# Autoria:
# Amaury Gonçalves <amaury@unimedtv.coop.br>
# Duda Nogueira <eduardo@unimedtv.coop.br>
#
def validaCNS(numero):
numero = str(numero)
if numero.isdigit():
if re.match(r'[1-2]\d{10}00[0-1]\d$',numero) or re.match(r'[7-9]\d{14}$',numero):