Skip to content

Instantly share code, notes, and snippets.

View rbramwell's full-sized avatar
🚀
Blazing a trail the likes of which has never been seen.

Rory Bramwell rbramwell

🚀
Blazing a trail the likes of which has never been seen.
View GitHub Profile
@rbramwell
rbramwell / nxfetch.sh
Last active September 21, 2015 17:19 — forked from hborders/nxfetch.sh
#!/bin/bash -e
# Argument = -h -v -i groupId:artifactId:version -c classifier -p packaging
#shopt -o -s xtrace
# Define Nexus Configuration
NEXUS_BASE=http://repository.example.com:8081/nexus #this URL shouldn't end in a /
REST_PATH=/service/local
ART_REDIR=/artifact/maven/redirect
@rbramwell
rbramwell / sorted_json.rb
Created October 21, 2015 17:23 — forked from aj-jester/sorted_json.rb
Puppet parser function that takes unsorted hash and outputs sorted JSON object.
#
# LICENSE: https://gist.github.com/aj-jester/e0078c38db9eb7c1ef45
#
require 'json'
module JSON
class << self
@@loop = 0
def sorted_generate(obj)
@rbramwell
rbramwell / zenoss-shell-functions
Created October 22, 2015 19:37 — forked from cluther/zenoss-shell-functions
Zenoss JSON API Examples (curl)
# This shell script is intended to be sourced into your shell. It adds
# Default Zenoss server settings.
[ -z "$ZENOSS_URL" ] && export ZENOSS_URL="http://localhost:8080"
[ -z "$ZENOSS_USERNAME" ] && export ZENOSS_USERNAME="admin"
[ -z "$ZENOSS_PASSWORD" ] && export ZENOSS_PASSWORD="zenoss"
# Generic call to make Zenoss JSON API calls easier on the shell.
zenoss_api () {
ROUTER_ENDPOINT=$1
@rbramwell
rbramwell / Install Ruby and RubyGems
Created January 12, 2016 03:22 — forked from chiraggude/Install Ruby and RubyGems
Install Ruby 2.1.1 and RubyGems 1.8.25 on CentOS 6.5
# Install Ruby
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
tar xvzf ruby-2.1.1.tar.gz
cd ruby-2.1.1
./configure --prefix=/usr
make
make install
# remove "ruby-2.1.1" folder in /root
@rbramwell
rbramwell / dreamhost_python_setup.sh
Created January 17, 2016 14:40 — forked from wting/dreamhost_python_setup.sh
Dreamhost Python Setup script
#!/usr/bin/env bash
# Written by William Ting for the following blog post:
# http://williamting.com/posts/2012/04/18/set-up-python-and-django-on-dreamhost/
rcfile="${HOME}/.bashrc"
version="2.7.3"
setuptools_version="2.7"
tmp_dir="${HOME}/tmp-${RANDOM}"
if [[ ${#} == 0 ]]; then
@rbramwell
rbramwell / gem-fetch-dependencies.rb
Created January 18, 2016 03:51 — forked from drhuffman12/gem-fetch-dependencies.rb
Extend 'gem fetch' command. Fetch all dependencies. Handles OS (Windows vs non-Windows) and Ruby Platform (JRuby vs Ruby).
#!/usr/bin/ruby
=begin
## USAGE:
# Ruby:
ruby gem-fetch-dependencies.rb fetch <gem_name> --dependencies
# JRuby:
jruby gem-fetch-dependencies.rb fetch <gem_name> --dependencies
@rbramwell
rbramwell / validate_url.sh
Last active December 11, 2017 00:55 — forked from hrwgc/validate.sh
Validate URL using Bash cURL - Check if a resource exists at a URL
#!/bin/bash
# Simple function to check http response code before downloading a remote file
# Example usage:
# if `validate_url $url >/dev/null`; then dosomething; else echo "does not exist"; fi
function validate_url () {
if [[ `curl -s --head "$1" | head -n 1 | grep "HTTP/[1-3].[0-9] [23].."` ]]; then echo "true"; fi
}
@rbramwell
rbramwell / Curl job run.md
Created February 23, 2016 21:24 — forked from gschueler/Curl job run.md
How to run a rundeck job using curl

Run a Job using Curl

This document describes how to use CURL to interact with the RunDeck server to invoke a Job to run.

The steps are as follows:

  1. Authenticate to the RunDeck server and acquire a session cookie.
  2. Submit run request for particular Job ID, sending session cookie.
@rbramwell
rbramwell / puppet-agent.sh
Created April 18, 2016 01:34 — forked from obazoud/puppet-agent.sh
Append hostname and current timestamp in puppet logs
cd /etc/puppet/ && puppet agent --test --environment=$1 --verbose --debug 2>&1 | awk -v hostname=$(hostname) '{print hostname" - " strftime("%Y-%m-%d %H:%M:%S") " - " $0}'
# Get a list of trusted hosts
Get-Item WSMan:\localhost\Client\TrustedHosts
# Note that these commands don't create a list of trusted hosts, it simply replaces the trusted host with what you set via the command. If you need to add multiple hosts, they need to be comma seperated
# Trust all computers in a domain
Set-Item WSMan:\localhost\Client\TrustedHosts *.contoso.com
# Turst a single machine
Set-Item WSMan:\localhost\Client\TrustedHosts -Value myserver