Skip to content

Instantly share code, notes, and snippets.

View mmerickel's full-sized avatar

Michael Merickel mmerickel

View GitHub Profile
@mmerickel
mmerickel / readme.md
Created September 1, 2019 14:12 — forked from frostbtn/readme.md
rocket.chat web-hook to post messages silently

This is a Rocket.Chat incoming web hook. Hook gets an array of "messages" and silently creates chat messages directly in the Rocket's database without disturbing users with notifications or alerts - messages just appear in the channels. Messages appear silently even if the user has the channel openned: no refresh or re-enter is required (this is not this script's feature, it's how Rocket works).

This script can post messages to channels and groups by name (if message destination set to #name), or by api roomId (no prefixes in destination). And it can post DM to a user (if destination is set to @username). Please note, in this case DM between message author and destination user must already be created.

This hook expects request.content: ISilentMessage[];

ISilentMessage {
  // Message body.
  text: string;
@mmerickel
mmerickel / root.py
Created January 27, 2011 00:20 — forked from wwitzel3/root.py
class DayZeroContainer(ModelContainer):
def __init__(self, request, cls):
self.cls = cls
self.request = request
@property
def __acl__(self):
return [
(Allow, 'owner:{0}'.format(cls.ownerid), ('add', 'edit)),
# ... some other acls for this particular resource?
def commit_veto(environ, status, headers):
for good in ('1', '2', '3'):
if status.startswith(good):
break
else:
return True
for header_name, header_value in headers:
if header_name.lower() == 'x-tm-abort':
return True