This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You'll need a container OS like Fedora Atomic first | |
wget https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2 | |
openstack image create fedora-atomic-latest --disk-format "qcow2" --public \ | |
--container-format 'bare' \ | |
--file 'fedora-atomic-latest.qcow2' \ | |
--property os_distro=fedora-atomic | |
# Use your own keypair name in place of 'kp' | |
magnum cluster-template-create --name='k8s-cluster-template' --image-id='fedora-atomic-latest' \ | |
--keypair-id='kp' --external-network-id='public' --master-flavor-id='m1.small' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On a Ubuntu 14.04 server | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get install -y git | |
sudo mkdir -p /opt/stack | |
sudo chown $USER /opt/stack | |
git clone https://git.openstack.org/openstack-dev/devstack /opt/stack/devstack | |
cd /opt/stack/devstack | |
git checkout stable/newton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Fixnum | |
def prime? | |
/^.?$|^(..+?)\1+$/ !~ '1'*self | |
end | |
end | |
0.prime? #=> false | |
1.prime? #=> false | |
2.prime? #=> true | |
3.prime? #=> true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module BinaryTree | |
class Node | |
attr_reader :element | |
attr_accessor :left, :right | |
def initialize(e=nil) | |
@element = e | |
end | |
def traverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clouds: | |
datacentred: | |
auth: | |
username: YOUR_USERNAME | |
password: YOUR_PASSWORD | |
project_name: YOUR_PROJECT_NAME | |
auth_url: https://compute.datacentred.io:5000/v2.0/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails.configuration.log_level = :info | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
# run your code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 443 ssl http2; | |
server_name awesomehost.ninja; | |
ssl_certificate /path/to/server.crt; | |
ssl_certificate_key /path/to/server/key | |
ssl_client_certificate /path/to/client-ca.crt; | |
ssl_verify_client optional; | |
location /secret { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
def no_layout? | |
params.keys.include?('no_layout') | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= link_to "Edit", @model.edit_path %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I18n.t("model_helper_texts.#{model.downcase.underscore}.#{attribute_name.downcase.underscore}) |