Skip to content

Instantly share code, notes, and snippets.

[root@test ]# tftp foreman
tftp> get pxelinux.0
tftp> quit
[root@test ]# ls | grep pxelinux.0
pxelinux.0
@rbirnie
rbirnie / gist:4019346
Created November 5, 2012 18:06
Fact Loop
irb(main):049:0> a = 0
=> 0
irb(main):050:0> FactValue.where(:fact_name_id => fact_name_id).includes(:fact_name).map do |fact|
irb(main):051:1* a += 1
irb(main):052:1> puts fact.value
irb(main):053:1> end
irb(main):054:0> a
=> 6391
irb(main):061:0> FactValue.group(:fact_name_id, :value).where(:fact_name_id => fact_name_id).includes(:fact_name).map do |fact|
irb(main):062:1* a += 1
@rbirnie
rbirnie / _fact_hosts.html.erb
Created November 1, 2012 05:26
Show page with Partials
<% list = @hosts.nil? ? @trend : @hosts %>
<% list.values.includes(:trendable).in_groups(4, false) do |group| %>
<div class="span3">
<td>
<% group.each do |host| -%>
<ul class="base">
<li>
<% opts = host.name? ? host.name : host.fact_value %>
<%= link_to(opts, host_path(:id => opts), :title => "Show Host") %>
</li>