For work I use a Mac. Macs are totally broken in a lot of ways and when running utilities directly on the mac it has been the case more than once that I have to either suffer constant error messages or resort to trickery. Here's the trickery.
#============================================================
# ALIASES
#============================================================
alias vagrant="vagrant_suppress_gssapi_warnings"
alias puppet="puppet_suppress_iconv_warnings"
#============================================================
# FUNCTIONS
#============================================================
function vagrant_suppress_gssapi_warnings {
{
\vagrant "$@" 2>&1 >&3 | egrep -v 'Check your GSSAPI' >&2;
} 3>&1
}
function puppet_suppress_iconv_warnings {
{
\puppet "$@" 2>&1 >&3 | egrep -v 'iconv will be depr' >&2;
} 3>&1
}
Friday, October 19, 2012
Ruby Heredocs and whitespace
- raise(Puppet::Error, "this is a really really long line that causes total terminal line wrap. That's something I typically try to avoid whenever I can!")
+ raise(Puppet::Error, <<-EOL.gsub(/\s+/, " ").strip)
+ this is a really really long line that thanks to a
+ little bit of heredoc trickery can safely be multi
+ line, and the extra whitespace will be reduced down
+ to a single space. Pretty cool, eh!?
+ EOL
Saturday, October 6, 2012
Delete all blank lines and comments in Vim
Got a config file that doubles as a manual? Not any more:
:g/^$\|^#.*/d
:g/^$\|^#.*/d
Subscribe to:
Posts (Atom)