Skip to content

Instantly share code, notes, and snippets.

View gist:7f7035edf40a679ff9c4
# ==[ printSlack ]=============================================================
# Function to send output from the commandline to Slack.
# (wants SLACK_TOKEN to be defined in .bashrc or other ENV method, or you can set it here.)
#
# @parameter string $LEVEL INFO/ERROR/WARNING message. Changes emoji
# @parameter string $MESSAGE Message to send to slack.
printSlack()
{
SLACK_HOSTNAME=${SLACK_HOSTNAME-'mycompany.slack.com'};
SLACK_TOKEN=${SLACK_TOKEN-'oops'};
View gist:0c5f4fa9baa0f3a45a76
# Docker file to create a CentOS StatsD host.
# This uses Elasticsearch as a backend rather than Graphite/Carbon.
# Depends on having an Elasticsearch container.
FROM centos:centos6
MAINTAINER Gary Rogers <gary-rogers@uiowa.edu>
# Install things as root
USER root
RUN \
@GaryRogers
GaryRogers / gist:ad17907ddad83769b1ac
Last active Aug 22, 2018
CentOS/Elasticsearch Dockerfile
View gist:ad17907ddad83769b1ac
# Docker file to create a CentOS Elasticsearch host.
FROM centos:centos6
MAINTAINER Gary Rogers <gary-rogers@uiowa.edu>
# Install things as roo
USER root
RUN \
yum update -y --quiet && \
yum install -y --quiet wget && \
@GaryRogers
GaryRogers / bootstrap.sh
Created Aug 16, 2014
Vagrant/CentOS Node Install with Oracle Libraries
View bootstrap.sh
#!/usr/bin/env bash
if [ $(yum repolist | grep -c ^epel) -eq 0 ]; then
printf "[bootstrap] Adding EPEL Repo\n";
yum --quiet -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
fi
# ===================================================================
# Install python if it doesn't exist.
# ===================================================================
@GaryRogers
GaryRogers / gist:1ff32f3b27f4c4e52d55
Created Aug 12, 2014
Using Forms with Bootstrap-Dialog
View gist:1ff32f3b27f4c4e52d55

Using forms with Bootstrap-Dialog

var alertMessage = "";
var formTemplate = Backbone.Marionette.TemplateCache.get('#myTemplate');
var formString = formTemplate({ defaultDate: moment().add(90, 'days').format('YYYYMMDD') });

// remove the newlines. Bootstrap-Dialog doesn't like them (turns them into <br>'s)
formString = formString.replace(/[\n]/g, '');
@GaryRogers
GaryRogers / RSyslogSetup.md
Last active Jun 27, 2021
RSyslog Forwarding Setup
View RSyslogSetup.md

RSyslog Forwarding Setup

Overview

I'm looking to centralize logging for our dev team into Elasticsearch via Logstash. The wrinkle is that we aren't a Java shop, so installing java on our hosts just to ship logs back to a central Logstash indexer is something we'd like to avoid. So, I'm approaching things as a chance to understand RSyslog and its capabilities as a log shipper.

Procedure

Set up TCP listening on the log index host

Uncomment the following lines in /etc/rsyslog.conf. This will enable the rsyslog daemon to listen for incoming requests on TCP port 514. We're using TCP here so that we can have some confidence that the messages from the agent hosts reach the indexer. (More on this below)

@GaryRogers
GaryRogers / VagrantCentOS.md
Last active Feb 8, 2020
Provisioning Vagrant CentOS hosts
View VagrantCentOS.md
@GaryRogers
GaryRogers / OracleHander.php
Created May 28, 2014
Monolog Oracle Handler
View OracleHander.php
<?php
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\Formatter\LineFormatter;
// https://github.com/Seldaek/monolog/blob/master/doc/extending.md
class OracleHandler extends AbstractProcessingHandler {
View monolog_table.sql
CREATE TABLE
MONOLOG
(
ID NUMBER(11) NOT NULL,
LOG_TIME TIMESTAMP(6),
LOG_LEVEL VARCHAR2(20),
LOG_HOSTNAME VARCHAR2(512),
LOG_USER VARCHAR2(30),
LOG_IP VARCHAR2(45),
LOG_MESSAGE CLOB,
@GaryRogers
GaryRogers / ComposerPHPUnit.md
Last active Jan 28, 2021
Getting Composer and PHPUnit to autoload namespaces
View ComposerPHPUnit.md

Getting Composer and PHPUnit to autoload namespaces.

Overview

Details

Project Structure

ProjectRoot
 src