Displaying articles with tag

DNS for bash

Posted by hank, Sun Mar 30 21:16:00 UTC 2008

Today, I decided I wanted a network service that propagated variables and aliases to every login shell that subscribed to it. This is dangerous on a large scale, but perfectly acceptable on my small home network where everyone trusts everyone else.

First, I got Camping installed, bringing back fond memories of Ruby development. I then copied off the blog example, and created TreeHugger, a 427 line script that provides a web interface to edit the variables, and a plain text output for the shells to source.

This script, when run, allows some simple MVC actions to an sqlite3 database.

Example Screenshot

As you can see, I have some aliases here I want to send to all the subscribing hosts. Eventually, I want to add some detection functionality to the database (mostly reverse DNS lookups for host rule referencing). I just have to access /out to get my desired output:


# Treehugger Configuration
# Aliases
alias ai='sudo apt-get install'
alias aup='sudo apt-get update'
alias aug='sudo apt-get upgrade'

# Environment Variables

Now, to get this into bash. I looked into making the date command spit out pretty unique timestamps. Turns out you can do this with the nanoseconds format:


$ date +%s%N
1206926780157462141

I made it so wget saves the treehugger config to a tempfile using the somewhat random seed above as a filename suffix, and then I have my shell source it:


FILENAME=/tmp/treehugger-`date +%s%N`; 2>/dev/null wget -O $FILENAME  http://rofl.who/treehugger/out && source $FILENAME && rm $FILENAME

And now I have nice aliases on my laptop served up from my desktop as fresh as the shell:


hank@davros:~$ alias
alias ai='sudo apt-get install'
alias aug='sudo apt-get upgrade'
alias aup='sudo apt-get update'
alias ls='ls --color=auto'

Tags:

Photoslice in Bluecloth and Mephisto

Posted by hank, Sat Jan 05 16:49:00 UTC 2008

So, I found this today, and it is awesome. I wanted it in Bluecloth so I could use it in Mephisto. Here’s how.

First, I needed to make it so I could still do normal images, but turn on coolness if I want. Here’s the goal I came up with for the grammar:


[![](thumburl.jpg)](imageurl.jpg "Scrolly Text at top" "photoslice")

Here’s the first test, with a single image:

And now a set with a namespace:

I did it by simply modifying the regex and image url parsing function in BlueCloth like so:

  InlineLinkRegex = %r{
    \(            # Literal paren
      [ ]*        # Zero or more spaces
      <?(.+?)>?     # URI = $1
      [ ]*        # Zero or more spaces

      (?:         # title
        ([\"\'])    # Opening quote char = $2
        (.*?)     # Title = $3
        \2        # Matching quote char
      )?          # Title is optional
      [ ]*        # Zero or more spaces
      (?:         # rel
        ([\"\'])    # Opening quote char = $2
        (.*?)     # rel = $5
        \4        # Matching quote char
      )?          # rel is optional
    \)
    }x

    # and later...

        # ...or for an inline style second part
        elsif @scanner.scan( InlineLinkRegex )
          url = @scanner[1]
          title = @scanner[3]
          rel = @scanner[5]
          @log.debug "  Found an inline link to %p" % url

          text += %{<a href="%s"} % escape_md( url )
          if title
            title.gsub!( /"/, "&quot;" )
            text += %{ title="%s"} % escape_md( title )
          end
          if rel
            rel.gsub!( /"/, "&quot;" )
            text += %{ rel="%s"} % escape_md( rel )
          end

I also added the following to my Mephisto theme layout, in the head section:


   <!-- Photoslice -->
   <link rel="stylesheet" type="text/css" href="/javascripts/photoslice/style.css" />
   {{ "photoslice/functions.js" | javascript }} 

Once again, Ruby is awesome. And so is Markdown.

Tags:

Flash Chart Testing

Posted by hank, Sun Oct 21 23:00:00 UTC 2007

I’m testing a flash chart plugin based on this.

Continue Reading Tags:

Site5 promo code for October

Posted by hank, Sat Oct 20 00:05:00 UTC 2007

You can still get 13% off a new Site5 7.5TB/750GB/$7.50 Plan until November! These guys are a great rails host. Get this deal while it’s hot!

Code: HALLOWEEN2007

Go Now!

Tags:

A Beer Atom Feed

Posted by hank, Fri Oct 12 23:10:00 UTC 2007

So, after reviewing over 50 beers on BeerAdvocate, I’ve come to the conclusion that them not having an RSS or Atom feed of my most recent reviews available is stupid. So, I decided to make my own by scraping their HTML today. I started off by pumping some random code into irb that included Hpricot and Builder. Ruby rocks for doing stuff like this.

Continue Reading Tags:

New Mephisto Post Pinger List

Posted by hank, Sat Oct 06 13:06:00 UTC 2007

Today I found a nice ping list for Wordpress. I decided to put it into my copy of the Mephisto Post Pinger plugin. I’m not sure if it works yet, but this post will give it a good test.

Continue Reading Tags:

Site5's 5 dollar hosting deal gets better again

Posted by hank, Sun Sep 02 01:02:00 UTC 2007

5 Dollar Deal X3!

OK - I’m usually pretty critical in general, but this is the best hosting I’ve ever found, and it’s 3 times better than when I bought it, and it’s still the same price! So, you should click the image above and go sign up. These guys give you great support - I’ve contacted them numerous times and always had my problem solved within just a few minutes. I’ve noticed my site down once, and as soon as I emailed them, it was back up again. This blog is running Mephisto, a Ruby on Rails application, and it’s FAST! I barely ever see the kind of quick response from websites like I see from mine.

Features

  • Full Ruby on Rails support. They have updated gems for you to use, but also allow you to keep your own gem repository in your home directory.
  • Ready-to-go web applications with one-click installs
  • Awesome tech support
  • Very extensive wiki and forum where you can find out how to do anything you want with your account
  • 165GB of storage!
  • 5TB of bandwidth per month - which is great for transferring large files. I’ve never had a problem with the transfer speed, either.
  • 165 domain pointers - This allows me to host all my domains with them. They have a great system for buying domains that I’ve used quite a bit too.
  • Shell access
  • Free setup!
  • 60-day money back guarantee - If you don’t like it, you get all your bones back. How cool is that?

Benchmark

I have 16Mbit internet at home, and I decided just now to test the bandwidth of my site. Here are the results:


hank@rofl:/tmp$ wget -O /dev/null http://ralree.info/videos/grad.mp4
--00:50:57--  http://ralree.info/videos/grad.mp4
           => `/dev/null'
Resolving ralree.info... 70.47.124.108
Connecting to ralree.info|70.47.124.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 63,744,460 (61M) [audio/mp4]

100%[====================================>] 63,744,460     1.92M/s    ETA 00:00

00:51:30 (1.86 MB/s) - `/dev/null' saved [63744460/63744460]

Yes, folks, thats 1.86 MEGABYTES per second.

My Maximum at 16Mbit is 2 Megabytes/second, meaning this completely maxed out my connection.


I used to be a Dreamhost customer, and it sucked. It sucked really bad. I’m so glad I switched. Compare the features to any other plan you can find for $5/month. This is as good as it gets.

Sign up now!


Tags:

Flash Video Player for Mephisto

Posted by hank, Sun Aug 12 22:50:00 UTC 2007

So I made this awesome filter for Mephisto that allows you to easily embed flash videos in your post. May require tweaking if using a non-standard URL root.

It’s as simple as this:


<macro:flash>/assets/2007/8/13/party.flv</macro:flash>

Or, you can make it complicated:


<macro:flash width="640" height="480">/assets/2007/8/13/party.flv</macro:flash>

Which ends up like this:

Installation

Install it from your mephisto directory:


./script/plugin install -x https://modzer0.cs.uaf.edu/repos/hank/code/rails/mephisto/filtered_column_flash_video

Voila! Firebreathing!

Tags:

Mephisto Post Pinging Improvement

Posted by hank, Sat Aug 11 11:47:00 UTC 2007

So, the post pinger plugin was pretty awesome, but it was pinging RubyCorner and Rubylicious when it shouldn’t have. I made it tag-based so it checks a category of feed URL and decides whether the tag matches the category. Right now, I’ve only implemented it for the ruby tag since that’s all I should need for these two services.

ArticlePingObserver::SERVICES = [
  { :url => "http://rpc.pingomatic.com/", :type => :xmlrpc },
  { :url => "http://rpc.weblogs.com/pingSiteForm", :type => :rest },
  { :url => "http://pingomatic.com/ping/", :type => :weblogs_get, :extras => [ "chk_weblogscom=on&chk_blogs=on&chk_technorati=on&chk_feedburner=on&chk_syndic8=on&chk_newsgator=on&chk_feedster=on&chk_myyahoo=on&chk_pubsubcom=on&chk_blogdigger=on&chk_blogrolling=on&chk_blogstreet=on&chk_moreover=on&chk_weblogalot=on&chk_icerocket=on&chk_newsisfree=on&chk_topicexchange=on" ] },
  { :url => "http://rpc.technorati.com/rpc/ping", :type => :xmlrpc },
  { :url => "http://ping.syndic8.com/xmlrpc.php", :type => :xmlrpc },
  { :url => "http://rubycorner.com/ping/xmlrpc/e49ac4608c88606f75486e6da3da34de6527622a", :type => :xmlrpc, :category => 'ruby' },
  { :url => "http://rubylicio.us/ping/xmlrpc", :type => :xmlrpc, :category => 'ruby' }
}

There’s the array of services. Now the magic:

    SERVICES.each do |sinfo|
      if sinfo[:category] == "ruby"
        next unless article.tags(true).collect{|t|t[:name]}.join(" ") =~ /\bruby\b/
      end

Very simple. It should work on the basis of the service categories and the tags. We’ll see. Hopefully this post will end up on RubyCorner.

Tags: