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 | |
gemRubyMinorVer='2.2.0' ; | |
subHome() { | |
echo subHome ; | |
local home="/home/$(id -un)" ; | |
[[ -e "$home" ]] || home=$(grep $(id -un) /etc/passwd | awk -F: '{print $6}' | sed -e 's/[\/]$//') ; | |
[[ $home ]] || [[ ! -e /Users ]] || home="/Users/$(id -un)" ; | |
[[ $home ]] && [[ -e $home ]] || home='' ; |
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 | |
timeout=gtimeout | |
action() { | |
echo "cf_routes $1 $2" 1>&2 ; | |
local x=`cf_routes $1 $2 | egrep -v '^( *$|space *|name *|Getting routes|FAILED|No space targeted|No routes found)' | egrep '.' | perl -ne 'print " $_"'` ; | |
[[ -z $x ]] || echo -e " Found it:\n$x." ; | |
echo "" 1>&2 ; | |
} | |
main() { |
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 | |
either_rvm_or_rbenv() { | |
[[ $useRubyVersion ]] || useRubyVersion='2.2.3' ; | |
local use_rvm_or_rbenv='' ; | |
[[ $use_rvm_or_rbenv ]] || { rvm -v &> /dev/null && use_rvm_or_rbenv='rvm' || true ; } | |
[[ $use_rvm_or_rbenv ]] || { rbenv -v &> /dev/null && use_rvm_or_rbenv='rbenv' || true ; } | |
if [[ rbenv == $use_rvm_or_rbenv ]] ; then | |
[[ -e $HOME/.rbenv/versions/$useRubyVersion ]] || rbenv install "$useRubyVersion" ; |
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 | |
#Example of how to use the either_rvm_or_rbenv() function in BASH | |
useRubyVersion='2.2.3' ; | |
init() { | |
source ./subHome.sh ; | |
cd .. ; | |
subHome ; | |
either_rvm_or_rbenv ; |
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 | |
main() { | |
execute cd $HOME/w/ ; | |
vexecute false ; | |
execute echo sniffletart ; | |
} | |
# vexecute() | |
# Run the given command verbosely and with trailing newline; |
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 | |
get_proxy() { | |
[[ -n $http_proxy ]] && echo $http_proxy || { | |
[[ -n $HTTP_PROXY ]] && echo $HTTP_PROXY || { | |
[[ -n $HttpProxy ]] && echo $HttpProxy || { | |
return 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
$file_dirs_s = inline_template('<%= @files.map{ |f| File.dirname(f) }.join(",") %>') | |
$file_dirs = split($file_dirs_s, ',') | |
file { $file_dirs: | |
ensure => directory, | |
owner => 'root', | |
group => 'root', | |
mode => '0755' | |
} |
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 | |
# For AWS EC2 CentOS boxes that use LVM and have storage volumes presented as /dev/xvd_ (where _ is a letter). | |
main() { # Args: device (like "c" for xvdc), size[GB], mount point (like /var or /some/folder), volume group, logical volume name. | |
local devPrefix=xvd ; | |
local dev=$1 ; | |
local gb=$2 ; | |
local fs_dir=$3 ; | |
local vg=$4 ; | |
local lv_name=$5 ; |
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
augeas { "puppet.conf certname": | |
lens => 'Puppet.lns', | |
incl => "/etc/puppetlabs/puppet/puppet.conf", | |
context => "/files/etc/puppetlabs/puppet/puppet.conf", | |
changes => [ | |
"set main/certname ${::networking[fqdn]}", | |
], | |
} |
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
find -H /usr -type l -exec /bin/bash -c "ls -l {} | grep etc.alternatives" \; |