Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Writing code for free

Lukasz Lenart lukaszlenart

😎
Writing code for free
View GitHub Profile
@lukaszlenart
lukaszlenart / init.sql
Last active Dec 31, 2019
Hubot's mysql init script
View init.sql
CREATE DATABASE IF NOT EXISTS bob DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
USE bob;
CREATE TABLE IF NOT EXISTS brain (id INT,data TEXT, PRIMARY KEY (id));
@lukaszlenart
lukaszlenart / docker-compose.yaml
Created Dec 31, 2019
Hubot's docker-compose.yaml
View docker-compose.yaml
version: '3'
services:
bob-the-bot:
build: .
container_name: "bob-the-bot"
image: "bob-the-bot"
ports:
- 80:8080
environment:
@lukaszlenart
lukaszlenart / Dockerfile
Created Dec 31, 2019
Hubot's Dockerfile
View Dockerfile
FROM node:8.12.0-alpine
RUN apk add python \
&& apk add make \
&& apk add g++ \
&& apk add tzdata
RUN cp /usr/share/zoneinfo/Europe/Warsaw /etc/localtime
RUN echo "Europe/Warsaw" > /etc/timezone
View old-rabbitmq-dockerfile
FROM rabbitmq:3.7
WORKDIR /
RUN rabbitmq-plugins enable rabbitmq_management
RUN rabbitmq-plugins enable rabbitmq_federation
RUN rabbitmq-plugins enable rabbitmq_federation_management
RUN apt-get -qq update &&\
apt-get -qq install curl python &&\
View rabbitmq-dockerfile
FROM rabbitmq:3.7
WORKDIR /
RUN rabbitmq-plugins enable rabbitmq_management
RUN rabbitmq-plugins enable rabbitmq_federation
RUN rabbitmq-plugins enable rabbitmq_federation_management
RUN chmod +x /docker-entrypoint.sh
View rabbitmq-run.sh
#!/bin/bash
set -m
docker-entrypoint.sh rabbitmq-server &
# This is a temporary solution, please see https://www.rabbitmq.com/configure.html
echo "Waiting on RabbitMQ to start"
sleep 20
View aliases.coffee
module.exports = (robot) ->
robot.hear /^(halina)? (.+)/i, (msg) ->
msg.finish()
robot.logger.info "Catching: #{msg.match[2]}"
message = msg.message
message.done = false
message.text = message.text.replace(msg.match[1], robot.name)
View showsurveys.coffee
robot.respond /show survey$/i, (msg) ->
msg.finish()
loadSurveys()
.then (surveys) ->
attachments = []
attachments.push
title: survey.fullName
title_link: survey.linkToResult()
attachments
View ping.coffee
module.exports = (robot) ->
robot.respond /ping$/i, (msg) ->
msg.finish()
msg.send "pong!\nDo you want to play again?"
robot.respond /echo (.*)$/i, (msg) ->
msg.finish()
msg.send msg.match[1]
View gist:fd1961d10d487b0e6e6f115c20836aba
robot.listen(
(msg) ->
# catch all text messages and unhandled
if msg.text and msg.done == false
# remove bot's name
if msg.text.toLowerCase().indexOf(robot.name) == 0
regex = new RegExp "^#{robot.name}", 'ig'
msg.text.replace(regex, '').trim()
else if msg.text.toLowerCase().indexOf("@#{robot.name}") == 0
regex = new RegExp "^@#{robot.name}", 'ig'