<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Abort, Retry, Hack? &#187; script</title>
	<atom:link href="http://marcansoft.com/blog/tag/script/feed/" rel="self" type="application/rss+xml" />
	<link>http://marcansoft.com/blog</link>
	<description>[ marcan&#039;s blog ]</description>
	<lastBuildDate>Sat, 14 Jan 2012 19:32:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Quickpasting</title>
		<link>http://marcansoft.com/blog/2009/04/quickpasting/</link>
		<comments>http://marcansoft.com/blog/2009/04/quickpasting/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 15:18:33 +0000</pubDate>
		<dc:creator>marcan</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[pastebin]]></category>
		<category><![CDATA[pastie]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://marcansoft.com/blog/2009/04/quickpasting/</guid>
		<description><![CDATA[If you&#8217;ve ever worked with other people on some piece of code or program, particularly over IRC or IM or some other form of real-time or fast text communication, chances are you&#8217;ve used one of the many &#8220;paste&#8221; sites available (my personal favorite is pastie). These sites offer a convenient way of sending small to [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever worked with other people on some piece of code or program, particularly over IRC or IM or some other form of real-time or fast text communication, chances are you&#8217;ve used one of the many &#8220;paste&#8221; sites available (my personal favorite is <a href="http://pastie.org">pastie</a>). These sites offer a convenient way of sending small to medium chunks of text to other people quickly, by simply copyng and pasting the text into a web form. This is a lot better than the old way of having to send an e-mail attachment, spam an IRC channel, or upload the text to some web host, but as I used pastie more and more often I started to realize that it could be made even faster.<br />
<span id="more-36"></span><br />
So I wrote a simple Python script that lets you quickly upload some text or a set of files to Pastie. It can do stdin or a bunch of files, and it also tries to figure out what syntax highlighting to pick from the file extension. You can grab it <a href="http://pastie.org/459763">here</a>. Rename it to &#8216;pastie&#8217;, make it executable, and place it somewhere in your $PATH. There is built-in help available (just call pastie &#8211;help), but here are some simple examples:</p>
<pre># this pasties the output of do_something as a public pastie
$ do_something | pastie -p
# this pasties the specified files, using a header for each
# and the correct syntax highlighting setting
$ pastie foo.c bar.py baz.sh
# pastie stdin with author "marcan" as a python script
$ pastie -t python -n marcan</pre>
<p>You can also set the DEFAULT_NAME variable at the top of the file to a quoted string to use a certain author name by default for all your pasties.<br />
There&#8217;s an extra undocumented feature useful for editor integration: if you pass in a filename to the -t option, it&#8217;ll try to figure out the parser from the extension and use that for syntax highlighting (but it&#8217;ll take input from stdin unless you use file arguments). This is useful for making an editor plug-in or action that can pastie the current selection from a document and still keep the right syntax highlighting:</p>
<pre>echo "%current_selection" | pastie -t "%current_file" | xargs firefox</pre>
<p>A very neat trick is to make a global shortcut to pastie the current clipboard contents. If you&#8217;re using KDE with X11, for example, you could bind ctrl+shift+c to the following command:</p>
<pre>xsel -o | pastie | xsel -i &#038;&#038; play ~/your_favorite_bell.wav</pre>
<p>This will pastie the current X11 selection, then write back the URL as the selection, and play a ding of your choice. This means you can select any text, hit ctrl+shit+c, and then middle-click on an IRC or IM session to paste the URL to the text that you just selected. If your ISP&#8217;s nameservers are slow like mine are, add pastie.org to your /etc/hosts for a speed boost.</p>
<p>Happy pasting!</p>
]]></content:encoded>
			<wfw:commentRss>http://marcansoft.com/blog/2009/04/quickpasting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

