Skip to content

Instantly share code, notes, and snippets.

View jeanfrancis's full-sized avatar
🏠
Working from home

Jean-Francis AHANDA jeanfrancis

🏠
Working from home
View GitHub Profile
<?php
// Declare constants for Google API Key and Civic Information API endpoint.
define("GOOGLE_API_KEY", "");
define("GOOGLE_API_URL", "https://www.googleapis.com/civicinfo/us_v1/voterinfo/4000/lookup?fields=pollingLocations&officialOnly=%official%&key=%key%");
// An extra (optional) message to tell users.
define(EXTRA_VOTER_INFORMATION, "You may be asked for an ID at polling location, but it is not required to vote.");
// A phone number to give voice callers for finding out their polling place.
define(VOTER_INFO_PHONE_NUMBER, "215-686-3460 or 215-686-3461");

Dashboards

Charting

Description

A dashing widget that displays tickets for Freshdesk.com

  • Displays unassigned tickets subject and time.
  • Displays Ticket counts assigned to Agents.
  • Time for each ticket changes color depending on age.

Preview

Freshdesk Dashing Widget

#!/bin/sh
##Variables
APACHE_DOCUMENTROOT="/var/www/html"
KIBANA_SOURCE_URL="https://download.elasticsearch.org/kibana/kibana/kibana-3.1.1.tar.gz"
KIBANA_FILENAME=${KIBANA_SOURCE_URL##*/}
###Script
#!/usr/bin/env ruby
#
# this is a special meta-check. It runs ping checks against all hosts in
# the /endpoints API and sends individual results directly to sensu-client via
# the udp/3030 client socket. this is different from the normal sensu check model
# where individual scripts run and their exit status and output is used to create
# a single event.
#
# the reason for this check is to be able to dynamically ping a list of hosts
# without the race conditions and timing issues involved with creating individual
input {
udp {
host => "0.0.0.0"
port => 2055
codec => netflow { cache_ttl => 1
versions => [ 5, 9 ]
}
type => "netflow"
}
}
@jeanfrancis
jeanfrancis / SensuMultiple
Last active August 29, 2015 14:14
manage together multiple Sensu instance in Uchiwa dashboard
Setting of Uchiwa dealing with multiple sensu-server
In json of Uchiwa, by the sensu in array as follows, it seems it's enough to describe the end point of all of sensu-api.
uchiwa.json
{
"Uchiwa": {
(Omitted)
},
"Sensu": [
#!/bin/bash
export PUBLIC_IPV4=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/address)
export CONSUL_KEY=$(consul keygen)
service consul stop
rm -rf /var/cache/octohost/*
sudo cat > /etc/consul.d/default.json << EOL
{
"data_dir": "/var/cache/octohost",
"server": true,
@jeanfrancis
jeanfrancis / consul.sh
Last active August 29, 2015 14:14 — forked from ianunruh/consul.sh
#!/bin/bash
apt-get install -y curl unzip
mkdir -p /var/lib/consul
mkdir -p /usr/share/consul
mkdir -p /etc/consul/conf.d
curl -OL https://dl.bintray.com/mitchellh/consul/0.3.1_linux_amd64.zip
unzip 0.3.1_linux_amd64.zip
mv consul /usr/local/bin/consul
Sample PHP code to accept PagerDuty webhooks and send out notifications by email on state changes.
For more information, see http://developer.pagerduty.com/documentation/rest/webhooks
This example threads emails based on "$status: $description on $service" so each update to each incident would start a new thread.
This code is unsupported by PagerDuty.
<?php
$emailAddress = "[email protected]";