Skip to content

Instantly share code, notes, and snippets.

View daviddavis's full-sized avatar

David Davis daviddavis

View GitHub Profile
@daviddavis
daviddavis / prime_factorization.rb
Created February 15, 2012 14:52 — forked from masassiez/prime_factorization.rb
#42@Rubeque - Prime Factorization
def prime_factorization(num)
prime = Enumerator.new do |y|
mem = []
is_prime = lambda { |e| mem.find { |_| e.gcd(_) != 1 } }
2.upto(num) do |n|
unless is_prime[n]
mem << n
y << n
end
@daviddavis
daviddavis / call.rb
Last active December 22, 2015 12:59 — forked from ehelms/gist:6476483
args << generate_payload(options) if [:post, :put].include?(method)
def generate_payload(options)
if options[:payload].is_a?(String)
return options[:payload]
elsif options[:payload].is_a?(Hash)
return format_payload(options[:payload])
end
end
  1. Follow standard Katello development instructions that include installing Katello via RPM and switching to git

  2. Check out the engine branch (if you haven't already)

  3. Clone Foreman beside Katello, such that:

     workspace/
     worksapce/foreman
     workspace/katello
    
  4. cd foreman

  5. Create local Gemfile - vim bundler.d/katello.local.rb

@daviddavis
daviddavis / tmux-1.8.txt
Last active February 18, 2016 22:52 — forked from sturadnidge/tmux-1.8-on-CentOS-6.x.txt
Install tmux 1.8 on CentOS and RHEL
# download latest libevent2 and tmux sources, and extract them somewhere
#
# at the time of writing:
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
# http://downloads.sourceforge.net/project/tmux/tmux/tmux-1.8/tmux-1.8.tar.gz
#
# install deps
sudo yum install gcc kernel-devel make ncurses-devel
@daviddavis
daviddavis / fix.diff
Created June 10, 2014 13:33 — forked from anonymous/-
diff --git a/lib/pfrpg_rules/lib/pfrpg_rules.rb b/lib/pfrpg_rules/lib/pfrpg_rules.rb
index a9ed005..17d0cab 100644
--- a/lib/pfrpg_rules/lib/pfrpg_rules.rb
+++ b/lib/pfrpg_rules/lib/pfrpg_rules.rb
@@ -1,2 +1,4 @@
+require "pfrpg_rules/tickle"
+
module PfrpgRules
end
@daviddavis
daviddavis / pantheon-init
Last active August 28, 2015 16:31 — forked from n3uromanc3r/pantheon-init
Initialize pantheon terminal for xterm 256 colour palette and powerline glyphs
gsettings set org.pantheon.terminal.settings palette "#000000:#800000:#008000:#808000:#000080:#800080:#008080:#c0c0c0:#808080:#ff0000:#00ff00:#ffff00:#0000ff:#ff00ff:#00ffff:#ffffff"
gsettings set org.pantheon.terminal.settings opacity "100"
gsettings set org.pantheon.terminal.settings foreground "#ff5f00"
gsettings set org.pantheon.terminal.settings font "Ubuntu Mono derivative Powerline 12"
@daviddavis
daviddavis / gist:ae014e50d3bab138530b
Last active October 1, 2015 17:11 — forked from jmrodri/gist:437cb71622be36ea3213
Deployment restart procedure
1. delete my hypervisor and engine VMs from libvirt
2. go to Hosts -> Discovered Hosts and delete each host individually
* if you get an error about tokens then you need to delete them manually from the DB:
* vagrant ssh
* sudo -s
* sudo -u foreman psql
* > delete from tokens;
* > \q
* repeat step 2, deleting hosts from UI
3. go to RHCI Installer -> Deployments, DELETE the deployment
@daviddavis
daviddavis / ListenOnCandlepin.md
Created November 24, 2015 17:37 — forked from jlsherrill/ListenOnCandlepin.md
clearing ListenOnCandlepin Events

Shut down foreman-tasks:

  service foreman-tasks stop

Open the rails console:

foreman-rake console
PATH
remote: .
specs:
katello (2.2.0.77)
anemone
bastion
deface (< 1.0.0)
foreman-tasks (~> 0.6.0)
foreman_docker (>= 0.2.0)
gettext_i18n_rails
2015-12-14 05:43:39 [I] Connecting to database specified by database.yml
2015-12-14 05:43:50 [D] Setting::General Load (1.6ms) SELECT "settings".* FROM "settings" WHERE "settings"."category" IN ('Setting::General') AND "settings"."name" = 'fix_db_cache' ORDER BY name LIMIT 1
2015-12-14 05:43:50 [D] Setting Load (0.6ms) SELECT "settings".* FROM "settings" ORDER BY name LIMIT 1
2015-12-14 05:43:50 [D]  (0.1ms) BEGIN
2015-12-14 05:43:50 [D] Setting Load (0.3ms) SELECT "settings".* FROM "settings" WHERE "settings"."name" = 'dynflow_allow_dangerous_actions' ORDER BY name LIMIT 1
2015-12-14 05:43:51 [D] Setting Exists (0.6ms) SELECT 1 AS one FROM "settings" WHERE ("settings"."name" = 'dynflow_allow_dangerous_actions' AND "settings"."id" != 2) LIMIT 1
2015-12-14 05:43:51 [D] removing dynflow_allow_dangerous_actions from cache
2015-12-14 05:43:51 [D] Setting Load (0.4ms) SELECT "settings".* FROM "se