Skip to content

Instantly share code, notes, and snippets.

View mapledyne's full-sized avatar

Michael Knowles mapledyne

View GitHub Profile
@mapledyne
mapledyne / skytap_info
Created February 24, 2015 23:20
Get a Skytap configuration URL from IP address
#!/bin/bash
# A simple script that wraps a call to the Skytap metadata service. This will pull the configuration URL
# from the metadata service. Useful when you have the IP address of the server, but not easy translation to
# what configuration it is.
# It just passes the first parameter into SSH, so use the formatting as apporpriate:
# Example:
# skytap_info user@172.10.0.67
@mapledyne
mapledyne / widget-count.rb
Last active August 29, 2015 14:24
Get widget count in Dashing
require 'rubygems'
widget_count = "widget_count"
SCHEDULER.every '30s' do
widgets = Sinatra::Application.settings.history
total = widgets.length
puts "sending " + widget_count.to_s + " : " + total.to_s
@mapledyne
mapledyne / oba.rb
Created June 30, 2015 18:30
Local bus info widget in Dashing
require 'rubygems'
require 'nokogiri'
require 'open-uri'
widget = 'oba'
walktime = 5
SCHEDULER.every '1m' do
soonest = 20
@mapledyne
mapledyne / nagios-dashing.erb
Created June 30, 2015 19:02
nagios display in dashing
<li data-row="1" data-col="1" data-sizex="3" data-sizey="1">
<div data-id="nagios-fulcrum" data-view="Iframe" data-service="Nagios Fulcrum" data-title="Nagios" data-url="http://<nagios server>/Naglite3/"></div>
</li>
@mapledyne
mapledyne / dashing-clear.rb
Created June 30, 2015 19:05
Clear Dashing widgets
require 'rubygems'
SCHEDULER.cron '0 0 * * *' do
Sinatra::Application.settings.history.clear()
end
@mapledyne
mapledyne / delete-widget.rb
Created June 30, 2015 21:07
Delete a Dashing widget
require 'rubygems'
SCHEDULER.every '10s' do
widget = 'oba'
puts 'Deleting widget: ' + widget
Sinatra::Application.settings.history.delete(widget)
end
@mapledyne
mapledyne / application.scss
Created July 1, 2015 16:18
Will mark stale widgets in Dashing
$background-stale-color-1: #cc9999;
$background-stale-color-2: #333333;
$text-stale-color: #fff;
@-webkit-keyframes status-stale-background {
0% { background-color: $background-stale-color-1; }
50% { background-color: $background-stale-color-2; }
100% { background-color: $background-stale-color-1; }
}
@mapledyne
mapledyne / expiring_passwords.ps1
Last active July 2, 2016 22:57
Dashing widgets for Active Directory
#requires -version 2.0
#this script assumes all users have the same policy and does
#not take fine grained password policies into account.
#The -Next parameter indicates how many days to check. In other words
#user accounts with expiring passwords in the next X days. The script
#defaults to the user domain, but you can specify another search base
#by using a distinguished name like ou=employees,dc=jdhlab,dc=local
@mapledyne
mapledyne / widgetdata.erb
Last active August 29, 2015 14:24
Exposing Dashing widget data
<script type='text/javascript'>
$(function() {
// These settings override the defaults set in application.coffee. You can do this on a per dashboard basis.
Dashing.widget_base_dimensions = [356, 470]
Dashing.widget_margins = [5, 5]
Dashing.numColumns = 3
});
</script>
@mapledyne
mapledyne / Automated Evernote Tasks.scpt
Created July 28, 2015 17:15
Various tasks to clean up my triage notebook in Evernote
tell application id "com.evernote.Evernote"
-- Move/tag Fitbit status updates
set note_query to "notebook:triage source:mail.* fitbit"
set myNotes to find notes note_query
repeat with CurrentNote in myNotes
assign tag "fitbit" to CurrentNote
move CurrentNote to notebook "Michael"
end repeat