<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>a tumblelog by ches @ whiskeyandgrits


Twitter

</description><title>crumbtrail</title><generator>Tumblr (3.0; @ches)</generator><link>http://crumbtrail.chesmart.in/</link><item><title>man.vim dude</title><description>&lt;p&gt;It turns out that Vim ships with  a pretty sweet &lt;code&gt;man&lt;/code&gt; page plugin included, which you&amp;#8217;d discover if you edited &lt;code&gt;man&lt;/code&gt; pages very often, but most of us don&amp;#8217;t so it&amp;#8217;s probably a lot more useful to us as a viewer.&lt;/p&gt;

&lt;p&gt;Some of you Vim wise guys are saying, &amp;#8220;But Vim already has a handy &lt;code&gt;man&lt;/code&gt; page viewer, just press &lt;code&gt;K&lt;/code&gt; in normal mode for the word under the cursor.&amp;#8221; Sure. If you type &amp;#8216;sh&amp;#8217; a lot in your code and docs maybe that&amp;#8217;s great. I can count the number of times I&amp;#8217;ve actually used it on one hand (except with plugins that remap it to language-specific doc lookups). Plus it just loads the page in a crummy pager.&lt;/p&gt;

&lt;p&gt;Behold:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;runtime ftplugin/man.vim
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Run that in command mode and observe that you now have a &lt;code&gt;:Man&lt;/code&gt; command available. Think up some fun &lt;code&gt;man&lt;/code&gt; page to browse and BOOM, you&amp;#8217;re reading it in a split window just like &lt;code&gt;:Man sh&lt;/code&gt; &amp;#8212; that. Yeah, whoa.&lt;/p&gt;

&lt;p&gt;This, my friends, is a bonafide Vim buffer. It&amp;#8217;s pretty. It&amp;#8217;s got syntax highlighting. But best of all, references to other &lt;code&gt;man&lt;/code&gt; pages are tags. So when you&amp;#8217;re reading that &lt;code&gt;bash&lt;/code&gt; page and you&amp;#8217;re like, &amp;#8220;WTF &lt;code&gt;isatty(3)&lt;/code&gt;?&amp;#8221; you just put your cursor over that reference and with &lt;code&gt;Ctrl-]&lt;/code&gt; you reach enlightenment.&lt;sup&gt;&lt;a href="#footnote-man"&gt;[1]&lt;/a&gt;&lt;/sup&gt; When you see it&amp;#8217;s &lt;code&gt;libc&lt;/code&gt; and you tremble, &lt;code&gt;Ctrl-t&lt;/code&gt; and you&amp;#8217;re back to &lt;code&gt;bash&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&amp;#8220;This is swell!&amp;#8221; you say. &amp;#8220;It&amp;#8217;d be cool if &lt;code&gt;K&lt;/code&gt; used this for those five times in my life.&amp;#8221;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;nmap K :Man &amp;lt;cword&amp;gt;&amp;lt;CR&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Put that in your &lt;code&gt;.vimrc&lt;/code&gt; and smoke it.&lt;sup&gt;&lt;a href="#footnote-map"&gt;[2]&lt;/a&gt;&lt;/sup&gt; Don&amp;#8217;t forget to first &lt;code&gt;runtime&lt;/code&gt; the plugin as above while you&amp;#8217;re in there, to make it persistent.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://vim.wikia.com/wiki/Using_vim_as_a_man-page_viewer_under_Unix"&gt;Some folks&lt;/a&gt; like this so much they want to use it when they invoke &lt;code&gt;man&lt;/code&gt; on the command line. I&amp;#8217;m not drinking that kool aid yet but you might dig it.&lt;/p&gt;

&lt;p id="footnate-man" style="font-style: italic; font-size: 0.8em"&gt;[1] Or not. What a buzzkill. If you&amp;#8217;re on a Mac or perhaps other platform and get an error, there&amp;#8217;s &lt;a href="https://groups.google.com/forum/#!topic/vim_dev/M22nrEPGSYY"&gt;this bug&lt;/a&gt; where a well-intentioned fellow fixed a problem but introduced a new one for others. Do `:e $VIMRUNTIME/ftplugin/man.vim` and comment out the `let $MANPAGER =&amp;#8221;&amp;#8220;` line about 20 lines in, and you should be sitting pretty.&lt;/p&gt;

&lt;p id="footnote-map" style="font-style: italic; font-size: 0.8em"&gt;[2] The plugin actually maps `&amp;lt;Leader&amp;gt;K` for you to do the same thing, if you want to just commit that to memory instead.&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/5024677985</link><guid>http://crumbtrail.chesmart.in/post/5024677985</guid><pubDate>Thu, 28 Apr 2011 19:22:00 -0400</pubDate><category>vim</category></item><item><title>Handy Bits for Mongoid with Rails 3</title><description>&lt;p&gt;Rails 3 and &lt;a href="http://mongoid.org"&gt;Mongoid&lt;/a&gt; are just peachy. Here are a couple of development conveniences for using them together.&lt;/p&gt;

&lt;p&gt;Pop this snippet in your &lt;code&gt;~/.irbrc&lt;/code&gt; to show the raw JavaScript queries that Mongoid is running as you play with your app in the Rails console (and/or SQL, when you&amp;#8217;re using ActiveRecord). Formatting isn&amp;#8217;t great for Mongo queries, but it&amp;#8217;s helpful nonetheless.
&lt;script src="http://gist.github.com/630625.js"&gt; &lt;/script&gt;&lt;/p&gt;

&lt;p&gt;Setting &lt;code&gt;autocreate_indexes&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; will spare you some log noise. It&amp;#8217;s also worth noting that &lt;a href="https://github.com/cldwalker/hirb"&gt;Hirb&lt;/a&gt; works nicely out of the box for Mongoid documents, and I heartily recommend it.&lt;/p&gt;

&lt;p&gt;And here&amp;#8217;s a &lt;code&gt;db:console&lt;/code&gt; Rake task to stand in for the &lt;code&gt;rails dbconsole&lt;/code&gt; command that won&amp;#8217;t work with Mongoid:
&lt;script src="http://gist.github.com/630581.js"&gt; &lt;/script&gt;&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/1334264255</link><guid>http://crumbtrail.chesmart.in/post/1334264255</guid><pubDate>Sun, 17 Oct 2010 03:39:00 -0400</pubDate><category>ruby</category><category>code</category><category>mongodb</category><category>rails</category><category>mongoid</category></item><item><title>GNU screen Wrapper for SSH Agent Forwarding</title><description>&lt;p&gt;This problem is well-documented around the web, this is just my personal reminder. Others have crafted various solutions varying in complexity. I like this one for the simplicity and easy portability&amp;#8212;I don&amp;#8217;t remember who to credit for it, unfortunately.&lt;/p&gt;

&lt;p&gt;Without getting too deeply into the gory details, if you connect to a remote shell and run GNU &lt;code&gt;screen&lt;/code&gt; there, then detach the screen and come back to it in a later SSH session, environment variables that &lt;a href="http://unixwiz.net/techtips/ssh-agent-forwarding.html"&gt;SSH agent forwarding&lt;/a&gt; requires to function will have changed and your &lt;code&gt;screen&lt;/code&gt; session is none the wiser. This is rather annoying if you frequently connect to a gateway server and use &lt;code&gt;screen&lt;/code&gt; to do work on other servers inside of it&amp;#8212;your public key will not be forwarded to the internal servers on subsequent connections.&lt;/p&gt;

&lt;p&gt;Enter wrapper script to save new SSH variables when you connect again and resume your &lt;code&gt;screen&lt;/code&gt; session:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;#!/bin/bash
# Wrapper script to set SSH env vars so agent forwarding works when
# resuming screen sessions. Place at ~/bin/screen and make sure
# your personal bin directory has priority in your PATH

for SSHVAR in SSH_CLIENT SSH_TTY SSH_AUTH_SOCK SSH_CONNECTION DISPLAY; do
    echo "export ${SSHVAR}=\"${!SSHVAR}\""
done &amp;gt; ~/.sshvars
/usr/bin/screen $*
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then, a simple alias for your &lt;code&gt;.bashrc&lt;/code&gt;, to run once you&amp;#8217;ve resumed &lt;code&gt;screen&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# After reconnecting to a screen session, this restores env vars
# to allow agent forwarding to work again
alias fixssh='source ~/.sshvars'
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Off you go to now to connect to those internal servers needing your forwarded key.&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/213631924</link><guid>http://crumbtrail.chesmart.in/post/213631924</guid><pubDate>Thu, 15 Oct 2009 05:00:00 -0400</pubDate></item><item><title>Sanely Rebuild Corrupt Font Caches on OS X</title><description>&lt;p&gt;For Leopard, at least:

&lt;code&gt;&lt;pre&gt;
# Clear user font caches
$ atsutil databases -removeUser

# And system cache
$ sudo atsutil databases -remove

# Restart the ATS server
$ atsutil server -shutdown
ATSServer shutdown
$ atsutil server -ping
ATSServer is running

# Check for filesystem activity (this is just generally cool)
$ sudo fs_usage | grep ATS
&lt;/pre&gt;&lt;/code&gt;

You might possibly still need to restart applications, log out and back in, or restart completely.

Thanks to the fine people on &lt;a href="http://www.macosxhints.com/article.php?story=20071026081555971"&gt;this thread&lt;/a&gt;.&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/207661404</link><guid>http://crumbtrail.chesmart.in/post/207661404</guid><pubDate>Thu, 08 Oct 2009 12:56:00 -0400</pubDate></item><item><title>"The future is no more uncertain than the present."</title><description>“The future is no more uncertain than the present.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Walt Whitman&lt;/em&gt;</description><link>http://crumbtrail.chesmart.in/post/136079506</link><guid>http://crumbtrail.chesmart.in/post/136079506</guid><pubDate>Sun, 05 Jul 2009 20:01:00 -0400</pubDate></item><item><title>"I’m no good at those “guess how many jelly beans are in the jar” things though...."</title><description>“I’m no good at those “guess how many jelly beans are in the jar” things though. Usually you just win the jar anyway, and who wants that many jelly beans?”</description><link>http://crumbtrail.chesmart.in/post/62629774</link><guid>http://crumbtrail.chesmart.in/post/62629774</guid><pubDate>Tue, 02 Dec 2008 10:43:33 -0500</pubDate></item><item><title>Gorefest</title><description>&lt;p&gt;&amp;#8216;clean blood stain&amp;#8217; is probably one of those Web History moments where you want to make certain that you&amp;#8217;re logged out of your Google account.&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/58262740</link><guid>http://crumbtrail.chesmart.in/post/58262740</guid><pubDate>Thu, 06 Nov 2008 01:53:00 -0500</pubDate></item><item><title>Um... Arrrr!!</title><description>Ches&lt;br /&gt;&#13;
I've switched Facebook to Pirate speak and it's pretty awesome&lt;br /&gt;&#13;
&lt;br /&gt;&#13;
Sophie&lt;br /&gt;&#13;
You win!  That's the most inane thing I've heard so far today</description><link>http://crumbtrail.chesmart.in/post/52929208</link><guid>http://crumbtrail.chesmart.in/post/52929208</guid><pubDate>Fri, 03 Oct 2008 12:39:00 -0400</pubDate></item><item><title>Get the Ruby mysql gem to build with MySQL installed from 64-bit binary installer:


sudo env...</title><description>&lt;p&gt;Get the Ruby mysql gem to build with MySQL installed from 64-bit binary installer:

&lt;pre&gt;&lt;code&gt;
sudo env ARCHFLAGS=”-Os -arch x86_64 -fno-common” \
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
&lt;/code&gt;&lt;/pre&gt;

Courtesy of synth @ &lt;a href="http://cho.hapgoods.com/wordpress/?p=158"&gt;Chris Cruft&amp;#160;» Blog Archive&amp;#160;» Ruby, Rails and MySQL with Leopard 10.5.2 and XCode 3.0&lt;/a&gt;&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/39586085</link><guid>http://crumbtrail.chesmart.in/post/39586085</guid><pubDate>Mon, 23 Jun 2008 21:50:00 -0400</pubDate></item><item><title>Sophie&#13;</title><description>Sophie&lt;br /&gt;&#13;
Do you know what I would have to do to make $65 an hour?&lt;br /&gt;&#13;
&lt;br /&gt;&#13;
Ches&lt;br /&gt;&#13;
does it involve a pole and acrylic shoes?</description><link>http://crumbtrail.chesmart.in/post/30806389</link><guid>http://crumbtrail.chesmart.in/post/30806389</guid><pubDate>Fri, 04 Apr 2008 15:57:24 -0400</pubDate></item><item><title>Swap Control and Caps Lock in X.Org</title><description>&lt;p&gt;In the keyboard section of xorg.conf:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Option          "XkbOptions"    "ctrl:swapcaps"&lt;/code&gt;&lt;/p&gt;

This will naturally effect all X users on a system, so you may want to look at alternatives if you&amp;#8217;re not the only one using your system ;-)</description><link>http://crumbtrail.chesmart.in/post/30331933</link><guid>http://crumbtrail.chesmart.in/post/30331933</guid><pubDate>Mon, 31 Mar 2008 03:54:14 -0400</pubDate></item><item><title>Bash Prompt</title><description>&lt;p&gt;&lt;code&gt;export PS1="\n\[\033[0;32m\]\w\[\033[0m\]\n[\u@\h]\$ "&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Produces a prompt that looks something like this, with that initial newline giving some space from the output of the previous command:&lt;/p&gt;
&lt;code&gt;&lt;pre&gt;
&lt;span style="color: green;"&gt;~/src/lexblog/lexcode&lt;/span&gt;
[ches@porco]$ 
&lt;/pre&gt;&lt;/code&gt;</description><link>http://crumbtrail.chesmart.in/post/28716092</link><guid>http://crumbtrail.chesmart.in/post/28716092</guid><pubDate>Thu, 13 Mar 2008 01:45:00 -0400</pubDate></item><item><title>gitnub</title><description>&lt;a href="http://github.com/Caged/gitnub/wikis/home"&gt;gitnub&lt;/a&gt;: &lt;p&gt;A RubyCocoa frontend to the Git SCM.&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/28621678</link><guid>http://crumbtrail.chesmart.in/post/28621678</guid><pubDate>Wed, 12 Mar 2008 02:39:52 -0400</pubDate></item><item><title>Literature and Latte - Scrivener</title><description>&lt;a href="http://literatureandlatte.com/scrivener.html"&gt;Literature and Latte - Scrivener&lt;/a&gt;: &lt;p&gt;Scrivener is a word processor and project management tool created specifically for writers of long texts such as novels and research papers. Has a screenplay mode, WriteRoom-like fullscreen edit,…&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/28621677</link><guid>http://crumbtrail.chesmart.in/post/28621677</guid><pubDate>Wed, 12 Mar 2008 02:39:52 -0400</pubDate></item><item><title>finding that just about everything in the Rails Recipes book is useful and pertinent</title><description>&lt;p&gt;finding that just about everything in the Rails Recipes book is useful and pertinent&lt;/p&gt;</description><link>http://crumbtrail.chesmart.in/post/28617408</link><guid>http://crumbtrail.chesmart.in/post/28617408</guid><pubDate>Wed, 12 Mar 2008 01:39:15 -0400</pubDate></item><item><title>"It does not matter how slow you go so long as you do not stop."</title><description>“It does not matter how slow you go so long as you do not stop.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Wisdom of &lt;a href="http://en.wikipedia.org/wiki/Confucious" title="Confucious @ Wikipedia"&gt;Confucius&lt;/a&gt;&lt;br/&gt;&lt;/em&gt;</description><link>http://crumbtrail.chesmart.in/post/28615025</link><guid>http://crumbtrail.chesmart.in/post/28615025</guid><pubDate>Wed, 12 Mar 2008 01:06:53 -0400</pubDate><category>life eastern philosophy patience</category></item></channel></rss>

