Skip to content

Instantly share code, notes, and snippets.

View proffalken's full-sized avatar

Matthew Macdonald-Wallace proffalken

View GitHub Profile
@msg = @connection.receive
message_body = JSON.parse(@msg.body)[0]['body']
#Resque.enqueue(NrodLookup,message_body)
current_sql_statement = "SELECT nlcdesc FROM tiplocdata WHERE stanox = '#{message_body['reporting_stanox']}'"
next_sql_statement = "SELECT nlcdesc FROM tiplocdata WHERE stanox = '#{message_body['next_report_stanox']}'"
# puts sql_statement
@client.query(current_sql_statement).each do | row |
@current_loc = row['nlcdesc']
end
@client.query(next_sql_statement).each do | row |
@proffalken
proffalken / after:
Created December 3, 2012 17:36
proutes output
Name Pattern View
---- ------- ----
home / <function home at 0x419a8c0>
__static/ /static/*subpath <function <pyramid.static.static_view object at 0x411e5d0> at 0x4194b18>
location_index /location <function location_index at 0x419ab90>
location_new /location/new <function location_new at 0x419acf8>
location_create /location/create <function location_create at 0x419aa28>
location_show /location/{id} <function location_show at 0x419ae60>
timingload_index /timingload <function timingload_index at 0x419d758>
timingload_new /timingload/new <function timingload_new at 0x419d8c0>
@proffalken
proffalken / discovery.cfg
Created April 27, 2012 12:00
shinken discovery config
# Log file of the discovery command
log_file=/tmp/discovery.log
# Configuration files with common discovery objects
# like discoveryrules or runners
cfg_dir=packs
# Default discovery rules and runners. Should be AFTER
# the packs ones ;)
@proffalken
proffalken / commands.cfg
Created April 27, 2012 11:53
Shinken Commands Configuration File
# Here are some sample commands for checking classics things like
# systems and websites
# -----------------------------------------------------------------
#
# Localhost checks
#
# -----------------------------------------------------------------
@proffalken
proffalken / template.cfg
Created April 27, 2012 11:46
Shinken Host Templates
###############################################################################
###############################################################################
#
# HOST TEMPLATES
#
###############################################################################
###############################################################################
@proffalken
proffalken / localhost.cfg
Created April 27, 2012 11:11
localhost.cfg
define host{
use generic-host
contact_groups admins
host_name localhost
address localhost
icon_set server
}
global_variables = data_bag_item("backupservers", "_global")
if global_variables['primary'].length > 1 then
default[:backups][:primary] = global_variables['primary'][1]
else
default[:backups][:primary] = global_variables['primary'][0]
end
@proffalken
proffalken / ArduinoExample.pde
Created April 20, 2012 10:59
Arduino Example
loop(){
function1(arg1, arg2);
function2(arg3)
}
@proffalken
proffalken / dir.rb
Created March 13, 2012 10:19
Bacula Issues
## Based on tknetwork's bacula cookbook
filedaemon_nodes = search(:node, "roles:bacula_filedaemon")
filedaemon_nodes.each do |n|
bacula_client "#{n.hostname}-fd" do
extend Chef::Bacula
address getClientName(n.fqdn)
end
end
@proffalken
proffalken / gist:2001575
Created March 8, 2012 15:43
Error on Environment
## Check to see which environment we are in
if node.chef_environment == "_default" then
text = "\n\n\nENVIRONMENT ERROR\n=================\n\nYou are currently in environment #{node.chef_environment} which does not"
text << "\nhave any roles, recipes or attributes associate with it.\n\nPlease update the node to use one of the following environments:\n\n"
Chef::Environment.list.each do | name,uri |
if name != "_default"
text << "\t* #{name}\n"
end
end