Skip to content

Instantly share code, notes, and snippets.

import Image
import ImageDraw
import ImageFont
import Adafruit_ILI9341 as TFT
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.SPI as SPI
font = ImageFont.truetype('Minecraftia.ttf', 16)
@matt448
matt448 / BB-DCAN1-00A0.dts
Last active August 29, 2015 14:07
Device tree overlay to enable dcan1 on a Beagle Bone Black
/dts-v1/;
/plugin/;
/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";
/* identification */
part-number = "dcan1pinmux";
fragment@0 {
@matt448
matt448 / canbus_start.sh
Created October 19, 2014 20:29
Script to start can bus interface on a Beagle Bone Black
#!/bin/bash
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo -e "ERROR: Can bus bitrate not a number or a value wasn't entered.\n\nPlease enter a speed in Kbit/s\n\n Example: canbus_start.sh 100\n Speeds: 100,125,250,500\n" >&2; exit 1
fi
echo Bitrate: ${1}Kbit/s
sudo modprobe can
sudo modprobe can-dev
@matt448
matt448 / dcan1_dmesg_output.txt
Created October 19, 2014 18:34
Output from dmesg when enabling dcan1 on a Beagle Bone Black
root@bone:~# dmesg | tail -n 15
[1190326.609897] gadget: high-speed config #1: Multifunction with RNDIS
[1199448.966162] bone-capemgr bone_capemgr.9: part_number 'BB-DCAN1', version 'N/A'
[1199448.966337] bone-capemgr bone_capemgr.9: slot #9: generic override
[1199448.966382] bone-capemgr bone_capemgr.9: bone: Using override eeprom data at slot 9
[1199448.966430] bone-capemgr bone_capemgr.9: slot #9: 'Override Board Name,00A0,Override Manuf,BB-DCAN1'
[1199448.968166] bone-capemgr bone_capemgr.9: slot #9: Requesting part number/version based 'BB-DCAN1-00A0.dtbo
[1199448.968223] bone-capemgr bone_capemgr.9: slot #9: Requesting firmware 'BB-DCAN1-00A0.dtbo' for board-name 'Override Board Name', version '00A0'
[1199448.969684] bone-capemgr bone_capemgr.9: slot #9: dtbo 'BB-DCAN1-00A0.dtbo' loaded; converting to live tree
[1199448.970118] bone-capemgr bone_capemgr.9: slot #9: #2 overlays
@matt448
matt448 / trinket_can_to_uart.ino
Last active August 29, 2015 14:14
A CAN Bus to Uart Converter using an Adafruit Pro Trinket, MCP2515 and a MCP2562.
////////////////////////////////////////////
//
// Trinket Pro CAN Bus to UART Converter
//
// https://matthewcmcmillan.blogspot.com
// Twitter: @matthewmcmillan
//
// For the most up to date version of this file see:
// https://github.com/matt448/Digital_Dash_v2/blob/master/arduino_code/trinket_can_to_uart.ino
//
@matt448
matt448 / backup_nagios.sh
Created March 13, 2013 14:17
Simple backup script for Nagios on Ubuntu 12.04
#!/bin/bash
DATE=`date +%Y%m%d-%H%M`
sudo tar cfvz nagios_backup_$DATE.tgz /etc/nagios3 /etc/nagios-plugins /etc/nagios /usr/lib/nagios/plugins /usr/share/pnp4nagios/html /var/lib/pnp4nagios/perfdata /var/lib/nagios /var/lib/nagios3
@matt448
matt448 / check-template-json-webservice.py
Created March 18, 2013 17:06
Template Nagios check for web services that return JSON data.
#!/usr/bin/python
#########################################
# Notes
#########################################
#
#
# Author: Matthew McMillan - matthew.mcmillan@gmail.com
# Blog: http://matthewcmcmillan.blogspot.com
# Code repo: https://github.com/matt448/nagios-checks
@matt448
matt448 / check_sqs_depth.py
Created October 7, 2013 14:52
Nagios check for monitoring Amazon SQS queue depth
#!/usr/bin/python
##########################################################
#
# Written by Matthew McMillan, matthew.mcmillan@gmail.com
#
# Requires the boto library and a .boto file with read
# permissions to the queues.
#
@matt448
matt448 / commands.cfg
Created December 31, 2013 19:01
Configuration to be added to existing commands.cfg. This tells how to use the slack_nagios.sh script.
###############################
# Slack notifications
###############################
# 'notify-service-by-slack' command definition
define command {
command_name notify-service-by-slack
command_line /usr/local/bin/slack_nagios.sh > /tmp/slack.log 2>&1
}
@matt448
matt448 / contacts.cfg
Created December 31, 2013 19:07
Nagios configuration lines for adding Slack to contacts.
define contact {
contact_name slack
alias Slack
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-service-by-slack
host_notification_commands notify-host-by-slack
}