This file contains hidden or 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
# Default value for :user_id is generated in this function | |
def create_project(options = {}) | |
options.reverse_merge!( | |
:user_id => @user.id | |
) | |
FactoryGirl.create(:new_project, options) | |
end |
This file contains hidden or 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
Gem::Specification.new do |s| | |
s.name = "expect4r" | |
s.version = '0.1.0' | |
s.files = Dir["{lib,spec}/**/*", "[A-Z]*", "init.rb"] - ["Gemfile.lock"] | |
s.require_path = "lib" | |
s.summary = 'Expect functionality for network equipment' | |
s.author = '' | |
end |
This file contains hidden or 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
# Requires jquery.hammer.js | |
# Requires wiselinks | |
# Add class 'tapit' to any clickable element on the page | |
tapAction = (element) -> | |
$(element).hammer().on 'tap', -> | |
$(this).fadeOut { | |
duration: 200 | |
} | |
$(this).fadeIn { |
This file contains hidden or 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
# The IP Address Validator accepts the following options | |
# | |
# * allow_nil - allows nil values | |
# * allow_blank - allows blank values | |
# * allow_cidr - allows /prefixlen CIDR masks in values | |
# | |
# the validator will use regular expressions in an attempt to prevent | |
# malformed IP addresses from being passed to the IPAddr.new initializer | |
# as this method can be very slow to raise exceptions for malformed input. | |
class IpAddressValidator < ActiveModel::EachValidator |
This file contains hidden or 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
namespace :db do | |
desc 'regenerate test and dev db' | |
task :regenerate do | |
Rake::Task['db:drop'].invoke | |
Rake::Task['db:create'].invoke | |
Rake::Task['db:migrate'].invoke | |
Rake::Task['db:test:purge'].invoke | |
Rake::Task['db:test:prepare'].invoke | |
end | |
end |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'getoptlong' | |
require 'rubygems' | |
require 'snmp' | |
SNMP_COMMUNITY = 'public' | |
HOSTNAME_BLACKLIST = [ "that_one_switch_thats_down_but_in_dns" ] | |
ZONE_FILE = /path/to/dns/zone/file | |
HOSTNAME_REGEX = /^\s?(switch[0-9]+)/i |
This file contains hidden or 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
#!/bin/bash | |
# Script for checking if SSH port is open | |
# Only checks that port is open. Not that actually SSH connection can occur | |
counter=0 | |
result="ssh disabled" | |
if [ -z "$1" ] | |
then | |
echo "hostname argument required. Example ssh_port_checker.sh 10.1.1.1" |
This file contains hidden or 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
#!/bin/bash | |
# Change the hostname without reboot | |
# Applies only to debian based OS | |
# TODO | |
# Understand common practises in setting hostnames in /etc/hosts | |
# in a typical production setting. | |
This file contains hidden or 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
# Execute gnome action as a user | |
- name: enable middle click | |
shell: "sudo -u {{ core_username.stdout }} dbus-launch gsettings set org.gnome.settings-daemon.peripherals.mouse middle-button-enabled true" | |
# Execute Gem Install using RVM | |
- name: install knife-solo | |
shell: > | |
executable=/bin/bash source /etc/profile.d/rvm.sh; | |
gem install --no-ri --no-rdoc knife-solo |