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.
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:
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:
[](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 partelsif@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!( /"/, """ )
text += %{ title="%s"} % escape_md( title )
endif rel
rel.gsub!( /"/, """ )
text += %{ rel="%s"} % escape_md( rel )
end
I also added the following to my Mephisto theme layout, in the head section:
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.
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.
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:
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.
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.
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.
I'm a computer programmer from Ellicott City, MD.
I go to OSCON every year, write random code, and blag about it here.
I enjoy cooking,
reviewing beer, hiking, kayaking, and watching movies and television shows.