An occasional outlet for my thoughts on life, technology, motorcycles, backpacking, kayaking, skydiving...

Thursday, November 20, 2008

Command line tool for dpaste

There are lots of snippet hosts sites that are good for sharing in chats. I like dpaste because its interface is simple and effective even if it doesn't have an official API. I wrote this tool to help use it from the command line. Here is an easy way for you to get it:

cd ~/bin #assuming you have a personal bin folder in your $PATH
curl -o dpaste
chmod +s dpaste

If you look at the title for that dpaste "paste" you'll see an example of how to use it:
dpaste command line tool example title
There are a lot of really cool things happening there.

  • The tool published itself

  • It used my OS username

  • It captured the entire command line for the title

  • The command included a Unix pipe

  • The command included process substitution

And to top it all off I landed a really cool, rounded paste number (92000).

Just in case that paste disappears I will also place a copy of the code here:

# In order for the default title to capture the complete command, a shebang (#!) must not be used
cat < < EOF
dpaste - a command line tool for posting to
dpaste [-h] [-l language] [-t title|-u] [-p poster|-a] [file]

dpaste accepts a stdin pipe and posts the content to
with the command (complete with pipes) as the title and your username as
the name. If you pass a file it will be sent instead of stdin and the
filename will be used as the title. The following flags are available:
-H Hold until nobody has looked at it for 180 days.
-l language
Specify: Python|PythonConsole|Sql|DjangoTemplate|JScript|
-t title
Override the default title.
-u Paste untitled.
-p poster
Override the default Name/Email.
-a Paste anonymously.
-- Denote the end of flags. Needed if filename starts with a "-".

Copyright (c) 2008 Richard Bronosky
Offered under the terms of the MIT License.
Created while employed by Atlanta Journal-Constitution

title=$(history|tail -n1|tr "\t" "#"|sed "s/[^#]*#//")
poster=$(id -un);

while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) usage; exit 0;;
-H) hold="-F hold=on"; shift;;
-l) language=$2; shift 2;;
-t) title=$2; shift 2;;
-u) unset title; shift;;
-p) poster=$2; shift 2;;
-a) unset poster; shift;;
--) shift; break;;

if [[ -n "$1" ]]; then

url=$(curl -s -L -o /dev/null -w "%{url_effective}" \
-F "content=<$content" \
-F "language=$language" \
-F "title=$title" \
-F "poster=$poster" \

# copy the url to the clipboard if you are using a Mac
$(which pbcopy > /dev/null 2>1) && echo -n "$url" | pbcopy
echo "$url"

# vim:ft=sh:tw=78

More “Basic Economics”

I saw someone make the following statement on a technology forum discussing expensive Solid State Drive storage: "Why not save that thousand bucks or two so we can help prevent another economic disaster like the one we currently got ourselves into?"

This demonstrates how poorly the average person understands our basic economic fabric. It does not give me encouragement about our future.

A strong economy relies on the exchange of liquid assets. Economic downturns can almost always be attributed to the spending of money that is [merely] speculated to exist in the future.

In non-academic English: Going into debt almost always kills an economy (eventually). (Whether that be the economy of a nation, state, county, city, business, church, or family, it still holds true.) When you go into debt you spend tomorrow's money. When tomorrow gets here*, you are in trouble. This problem is resolved when people spend money they have. That "spending" can be on groceries or fancy restaurants, netbooks or expensive SSDs, charitable donations or investments/savings (which get invested). The only thing you can do with money that is bad for an economy is take it out of circulation. (aka: "Save" it under your mattress.)

Huh? But what about debt? Aren't I contradicting myself? No. Debt is not money. Debt is like anti-money. The collision of money and anti-money is similar to that of matter and anti-matter. Tomorrow finally got here*, and this is what it looks like. Go spend some money. Just do it responsibly. For some that means buying 256GB SSDs. For me that means having $0 debt and socking money into low to moderate risk investments to be prepared for layoffs, retirement, and kids going to college (in that order).

Do not think that luxury items or those who purchase them are evil. That's politics. We have to be smarter than that.

Monday, November 17, 2008

book meme

Obsolete constructs.

Linux in a Nutshell, 5th Edition

Book meme:

- Grab the nearest book.
- Open it to page 56.
- Find the fifth sentence.
- Post the text of the sentence in your journal along with these instructions.
- Don’t dig for your favorite book, the cool book, or the intellectual one: pick the CLOSEST.


Wednesday, November 5, 2008

Entire nation enjoys beautiful weather as God celebrates the election of his spawn

This is an onion-style article that I thought up.

In an unprecedented meteorological anomaly the entire continental United States of America unanimously enjoyed beautiful weather on November 5th. They say "you can't please everyone," but that is exactly what Yahweh pulled off for this post election celebration. The descended man-child President Elect and his surroundings enjoyed a moderate 72 degrees which is, not so coincidentally, the exact temperature that Barack sets the thermostat to in his home. In Georgia they got that "warm in the sun, but cool when the breeze whips" weather that they love. "I know they could use some rain, but let's face it, they can't drive in the stuff", remarked the Lord, "I just didn't feel like killing anyone with stupid traffic accidents." The ski resorts in the Mid-West got the snow they'd been praying for, in an amazing show of Grace upon the red states who did little to embrace the inevitable. "It's not like I couldn't target the snow just on Colorado, right?", he joked, "I'm just not like that anymore, and I haven't been for thousands of years." America has taken to the streets to enjoy this amazing gift from God. Both gifts actually. "I gave Noah a really cool rainbow, but those are pretty gay by today's standards", remarked the deity. He declined to comment on why Alaska was omitted in this gesture of good fortune. Asked about the abortion issue, God said he was "tired of single-issue politics", explained that you could be pro-life and pro-Obama, and then pretended that he was getting an important call.