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
# a useful addition to anyone's .bashrc | |
# | |
# Note, you don't want this function in effect on the remote host side of the scp transfer, | |
# so make sure to only define it for interactive shells, e.g.: wrap with: if [ ! -z "$PS1" ] | |
function scp() { | |
if echo "$@" | grep -q ':' | |
then | |
/usr/bin/scp "$@" | |
else |
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
#!/bin/sh | |
## | |
# This is a script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# Run in interactive mode with: | |
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)" | |
# | |
# or run it without prompt questions: |
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
#!/bin/sh | |
die () { | |
echo >&2 "$@" | |
exit 1 | |
} | |
available_configs () { | |
echo "Available configs:" | |
ls -A ~ | grep .chef- | sed 's/.chef-//' | |
} |
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
ruby_block "configure #{p} module" do | |
block do | |
require 'chef/util/file_edit' | |
nc = Chef::Util::FileEdit.new("/etc/reconnoiter/noit.conf") | |
nc.insert_line_after_match(/lua.*noit.module.smtp/, "<module loader=\"lua\" name=\"#{p}\" object=\"noit.module.#{p}\"/>") | |
nc.write_file | |
Chef::Log.info "Inserted module config for #{p}" | |
end | |
http://tickets.opscode.com/browse/CHEF-78?focusedCommentId=10781&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-10781 |
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
execute "chown tomcat" do | |
command "chown -R #{node[:tomcat][:config][:user]} #{node[:tomcat][:config][:home]}" | |
action :nothing | |
end | |
ruby_block "delay chown tomcat" do | |
block {} | |
notifies :run, resources(:execute => "chown tomcat") | |
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
# http://twistedmind.com/bundle-exec-bash-shortcut | |
bundle_commands=( rake spec rspec cucumber cap watchr rails rackup ) | |
function run_bundler_cmd () { | |
if [ -e ./Gemfile ]; then | |
echo "bundle exec $@" | |
bundle exec $@ | |
else | |
echo "$@" | |
$@ | |
fi |
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
Problem: You want to access Futon on a remote server but do not want port 5984 to listen for outside connections. | |
Solution: Tunnel through a local port using SSH. [1] | |
Example: | |
ssh -L5984:127.0.0.1:5984 ssh.example.com | |
Access: |