Skip to content

Instantly share code, notes, and snippets.

View cohan's full-sized avatar
💭
Tinkering

Cohan cohan

💭
Tinkering
View GitHub Profile
@matthewjohnston4
matthewjohnston4 / README.md
Last active May 26, 2021 10:36
Nightbot shoutout command with customised per-user messages

This two-piece code will allow you to setup a Nightbot shoutout command which can be customised to allow per-user shoutout messages, with a fallback default message.

Because Nightbot commands have a character limit, you won't get far with including the custom messages directly in your command string.

The solution is to use Nightbots urlfetch variable to fetch a JSON object filled with custom messages from somewhere on the web — here I'm placing it in a Github Gist (which works fine, but a bit slowly). You could put it somewhere on a plain old HTTP page served anywhere on the internet.

How to use

  1. Clone this JSON: https://gist.github.com/matthewjohnston4/ef62107655e471384fe027e0738a5c05 and store it where you want.
  2. Customise the JSON object to add or remove any "username": "shoutout message" combinations you want (don't forget those trailing commas).
@cohan
cohan / gist:4131121
Created November 22, 2012 13:14
Zabbix (1.8) - MySQL query to select hosts NOT IN a specific group
# Not in a single group:
SELECT host FROM hosts h
WHERE NOT EXISTS
(SELECT groupid FROM hosts_groups hg
WHERE h.hostid = hg.hostid
AND hg.groupid = 100100000000001);
# Not in multiple groups: