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
@jeanfrancis
jeanfrancis / RPi-Dashing-howto.md
Created September 5, 2016 12:51 — forked from stonehippo/RPi-Dashing-howto.md
Setting up a Raspberry Pi as a dashboard server with Dashing

Setting up a Raspberry Pi as a dashboard server with Dashing

Why the heck did I do this?

I wanted to set up one of my Raspberry Pi's as a data dashboard, pushing sensor data to a web interface that's easy to digest. I decided to use Shopify's Dashing framework. Dashing is based on Sinatra, and is pretty lightweight.

Dashing does require Ruby 1.9.3 to run. In addition, it makes use of the execjs gem, which needs to have a working Javascript interpreter available. Originally, I tried to get therubyracer working, but decided to switch over to Node.js when I ran into roadblocks compiling V8.

One warning: The RPi is a very slow system compared with modern multi-core x86-style systems. It's pretty robust, but compiling all this complex software taxes the system quite a bit. Expect that it's going to take at least half a day to get everything going.

@jeanfrancis
jeanfrancis / unattended_munin_ubuntu.sh
Created July 17, 2016 21:41
Unattended Installation / Bootstrap Script for Installing Munin Server on Ubuntu 12.04. You can simply pass this into an AWS EC2 box and you're 99% of the way done with setting up a Munin Server and an Apache/HTTP WebUI
#!/bin/bash
################################################################################################
################################################################################################
################################################################################################
##
## Basic Ubuntu 12.04 Unattended Bootstrap for Munin
##
## Author: Allan Parsons (allan.parsons@gmail.com)
##
@jeanfrancis
jeanfrancis / gist:07ca6ab6d97206fa5dd5
Last active August 29, 2015 14:26 — forked from seth-paxton/gist:d19571620e8986c2ef1a
Sensu Remediate Example
1. Download the plugin from: https://github.com/sensu/sensu-community-plugins/blob/master/handlers/remediation/sensu.rb
2. Create the handler definition:
{
"handlers": {
"remediator": {
"type": "pipe",
"command": "/etc/sensu/handlers/remediator.rb"
}
}
}
@jeanfrancis
jeanfrancis / gist:fa1de85301382acec15c
Last active August 29, 2015 14:26 — forked from seth-paxton/gist:a653dbe1a1c77160df34
Sensu Remediation Example
{
"checks": {
"seyren_check": {
"command": "/etc/sensu/plugins/check-procs.rb -p PROC",
"interval": 10,
"subscribers": ["SUB"],
"handlers": ["remediator","pagerduty"],
"occurrences": 1,
"refresh": 10,
"remediation": {
{
"checks": {
"check_something": {
"command": "ps aux | grep cron",
"interval": 60,
"subscribers": ["application_server"],
"handlers": ["debug", "irc", "remediator"],
"remediation": {
"light_remediation": {
"occurrences": [1, 2],
import zillabyte
from twilio.rest import TwilioRestClient
def send_text(controller, tup):
# Register twilio client
twilio_client = TwilioRestClient(tup["twilio_sid"], tup["twilio_auth"])
try:
# Send message to recipient and wait 1 second (twilio SMS rate limit)
import zillabyte
twilio_sid = "SID_HERE"
twilio_auth = "AUTH_HERE"
class TwilioEach:
def prepare(self, controller):
# Dictionary of phone numbers subscribed to cities (just for show with small sample, please use a
# REAL source when using a significant number of phone numbers)
  1. General Background and Overview