Skip to content

Instantly share code, notes, and snippets.

@rbirnie
rbirnie / README.md
Last active August 18, 2018 14:58 — forked from rowanu/README.md
Hotness Widget for the Dashing dashboard from Shopify

Dashing Hotness Widget + change-rate

Are you dashing? Are you hot? Then you need the Dashing Hotness Widget! Forked from here: Source. See the original blog post for more details.

Important Unlike the original Hotness widget which used value, this widget uses current and last and can be a direct drop in replacement for the Number widget.

About

This widget is similar to standard Hotness widget but I've added the change-rate arrows from the basic Number widget. The entire widget changes colour based on the value displayed. It is designed to draw attention to

Keybase proof

I hereby claim:

  • I am rbirnie on github.
  • I am rbirnie (https://keybase.io/rbirnie) on keybase.
  • I have a public key whose fingerprint is E811 EA46 30AB B5C3 2401 10DA 626C 7E16 D14E D8F8

To claim this, I am signing this object:

if ! defined(Package['foo']) {
file_line { 'bar':
require => Package['foo']
}
}
#!/bin/bash
# Autostart Libvirt VM's created with Foreman
# /usr/share/foreman/config/hooks/host/managed/create/10_autostart_libvirt.sh
# Source: http://www.uberobert.com/autostart-libvirt-vms-in-foreman/
. $(dirname $0)/hook_functions.sh
username='admin'
password='changeme'
cd /usr/share/foreman
rails c
1.9.3-p484 :001 > a = Host.find_by_name 'hostname'
1.9.3-p484 :002 > a.interfaces
Nic::Base Load (1.2ms) SELECT `nics`.* FROM `nics` WHERE `nics`.`host_id` = 237
+----+-------------------+-------------+----------+------+---------+-----------+-----------+-------------------------+-------------------------+-------------------------+
| id | mac | ip | type | name | host_id | subnet_id | domain_id | attrs | created_at | updated_at |
+----+-------------------+-------------+----------+------+---------+-----------+-----------+-------------------------+-------------------------+-------------------------+
| 6 | 5c:f9:dd:f0:a7:50 | 10.199.11.8 | Nic::BMC | | 237 | | | {:username=>"root", ... | 2013-11-27 01:00:37 UTC | 2013-11-27 01:00:37 UTC |
+----+-------------------+-------------+----------+------+---------+-----------+-----------+-------------------------+-------------------------+-
@rbirnie
rbirnie / gist:7348574
Created November 7, 2013 03:37
Override macaddress fact to always be eth0
#!/usr/bin/ruby
# Eth0 is better than alphabetical.
require 'facter'
Facter.add(:macaddress) do
has_weight 10
setcode do
`facter macaddress_eth0`.strip
end

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@rbirnie
rbirnie / LDAP Error Key.md
Last active December 10, 2015 22:59
LDAP Result Log Key

tail -f /usr/share/foreman/log/production.log

Successful login: # Woot!

Started POST "/users/login" for 10.0.0.2 at Thu Jan 10 14:50:01 -0800 2013
Processing by UsersController#login as HTML
Parameters: {...}

Bad User Password:

@rbirnie
rbirnie / auth_source_ldap.rb
Last active December 9, 2015 23:59
updated auth_source_ldap.rb
# adding these to 60 & 61
# logger.debug "Result: #{ldap_con.get_operation_result.code}" if logger && logger.debug?
# logger.debug "Message: #{ldap_con.get_operation_result.message}" if logger && logger.debug?
# redMine - project management software
# Copyright (C) 2006 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
@rbirnie
rbirnie / fact_importer.rb
Last active October 13, 2015 21:58
fact_importer
#! /usr/bin/env ruby
#
# This scripts runs on remote puppetmasters that you wish to import their nodes facts into Foreman
# it uploads all of the new facts its encounter based on a control file which is stored in /tmp directory.
# This script can run in cron, e.g. once every minute
# if you run it on many puppetmasters at the same time, you might consider adding something like:
# sleep rand(10) # that not all PM hammers the DB at once.
# ohadlevy@gmail.com
# note this requires ruby 1.8.7+