Skip to content

Instantly share code, notes, and snippets.

View mapledyne's full-sized avatar

Michael Knowles mapledyne

View GitHub Profile
@mapledyne
mapledyne / 0_reuse_code.js
Created March 4, 2016 05:31
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mapledyne
mapledyne / check_github_mfa.py
Created January 12, 2016 18:14
Nagios check file to check for MFA use with users in our org
#!/usr/bin/python
import sys
import commands
import json
def update():
"""Return list of users without MFA, or an OK status."""
status, data = commands.getstatusoutput("curl -s -H \"Authorization: token YOUR_GITHUB_TOKEN\" https://api.github.com/orgs/ORG_NAME/members?filter=2fa_disabled")
@mapledyne
mapledyne / environment.erb
Last active September 16, 2015 20:31
Dynamically creating dashing.io dashboards
<%
require 'rubygems'
require 'json'
class Widget
def initialize(id,title,view,order)
@widget_id = id
@widget_view = view
@widget_title = title
@widget_order = order
@mapledyne
mapledyne / fontawesome.coffee
Created September 9, 2015 21:30
Fontawesome widget add on for Übersicht
refreshFrequency: false
render: () ->
return '''
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
'''
@mapledyne
mapledyne / bandwidth.rb
Created September 3, 2015 15:41
Cisco ASA Bandwidth usage widget for dashing.io
require 'rubygems'
require 'snmp'
# Populate the graph with some random points
@inbound_points = []
@outbound_points = []
@inbound_long = []
@outbound_long = []
@mapledyne
mapledyne / bashrc
Last active November 7, 2016 23:34
A gradual list of bash aliases
export PATH=/Users/mknowles/Documents/BitBucket/belfry:/Users/mknowles/Dropbox\ \(Personal\)/Tech\ Tools/scripts:$PATH
export PYTHONPATH="${PYTHONPATH}:/Users/mknowles/git/skytap"
#export MAGICK_HOME="/usr/local/bin/ImageMagick-6.9.2"
#export PATH="$MAGICK_HOME/bin:$PATH"
#export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"
# source ~/Git/liquidprompt/liquidprompt
# source /Users/mknowles/Dropbox\ \(Personal\)/Tech\ Tools/scripts/switch.sh
@mapledyne
mapledyne / Close All.scpt
Created July 28, 2015 17:16
Close open applications
tell application "System Events" to set quitapps to name of every application process whose visible is true and name is not "Finder"
repeat with closeall in quitapps
quit application closeall
end repeat
@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
@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 / 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