Skip to content


OpenWRT and DynDNS

I have a Linksys WRT54G router and thanks to OpenWRT, its just about the best piece of home networking hardware I have. I recently moved and had to switch to DynDNS account for OpenWRT was very heavy. I’m an Engineer so I decided to make a really simple implementation of 2 scripts. A checker that runs every 15 minutes to verify that DynDNS is up to date and an updater script to update it if that check fails. After reading the api documention on DynDNS.com, I realized that it should be cake. Put them both in the /bin directory on your router. Here are the files.

(substitute your parameters)

Lastly add this to your /etc/crontabs/root file:

0,15,30,45 * * * * /bin//check_dns.sh > /dev/null
0 1 * * 1 /bin/update_dns.sh > /dev/null

The first line will add your check for every 15 minutes and the second will run the update every Monday morning at 1:00A.M. to keep your account up to date.

And there you have it. Easy and simple. The lightest weight DynDNS updater for your OpenWRT router.

(P.S. You can use this on any *NIX system with a little tweaking)

Links:
OpenWRT – http://openwrt.org
DynDNS – http://dyndns.com
Gist Repo – http://gist.github.com/14091

Posted in Tech.

I want my ruby

I have been working on a jms consumer for a tibco server that can monitor and do some calculations on the fly based on what is on the bus and I am going insane. I have to write the thing in java and I want remove my eyes with a spork… I forgot how annoying static languages are and all I want is my ruby language back. Why does tibco jms have to be so java… I would settle for python at this point. I hate java.

public void static main(String[] args) {
System.out.println(“Kill me”); }

Posted in General, Tech, Web.

Building my own Talky Boxy

After much downtime I have been working on a new album in my head and listening to some really good new music that has inspired me at a whole new level. I hear music in my head that I cannot wait to get out and on to tape…ok the computer but still… I have decided that the vocoder is not going to cut it for what I am hearing. I need a talk box. For those of you who don’t know what a talk box is I will explain. A talk box, in it’s simplist form, is a speaker that outputs sound through a tube. You then put the tube in your mouth and use your mouth to shape the sound. Most people feed the talk box with a guitar (like the Bon Jovi song) or a synthesizer (like California Love). How does someone build one you ask? Check out this site: http://www.mocheez.fr/I%20Play%20The%20Talkbox/Custom.html

I will post my pictures, videos, expierences, etc as I get around to doing the project. As of right now, I need to finish unpacking all my stuff; household as well as recording (Just moved to the valley of silicon).

Just to give an idea of what has inspired me check out these artists:
Squarepusher – http://www.myspace.com/akais5000
Daft Punk – http://www.myspace.com/daftpunk
The Society of Rockets – http://www.myspace.com/thesocietyofrockets
Girl Talk – http://www.myspace.com/girltalk

as well as the usual hardcore, metal, emo, etc influences…

You can find all the aforementioned music on my myspace profile playlist – http://www.myspace.com/deceptivedream

Posted in General.

Getting TinyUrl’s in Rails

If you have used twitter I am sure you have noticed that if you post a long url in your update it gets turned in to a tinyurl for you. This is really cool functionality and I have created a helper in rails to do it for me.

First, let’s talk about how you get a tinyurl. Tinyurl has a really simple api that you can call that will return a tiny url. It is rediculous how simple it is. You just call this url with a GET: http://tinyurl.comapi-create.php?url=http://example.com

The returned page will be a single line with the tinyurl equivalent. It is that simple. Now on to the rails part.

In your application.rb helper you would add this:

require ‘net/http’
require ‘uri’

def tinyfy(newurl)
   url = URI.parse(‘http://tinyurl.com/’)
   res = Net::HTTP.start(url.host, url.port) {|http|
   http.get(‘/api-create.php?url=’ + newurl)
   }
   if res.body.empty?
      #tinyurl is not responding properly… Return the original url
      return newurl
   else
      return res.body
   end
end

Now if you call the tinyfy method in your app, let’s say in your view, with the url you want to tinyurlify as the parameter the return will be the tinyurl. I take this one step further and have the tinyfy method make the url a link by adding the ‘a’ tags in the method like so:

require ‘net/http’
require ‘uri’

def tinyfy(newurl)
   url = URI.parse(‘http://tinyurl.com/’)
   res = Net::HTTP.start(url.host, url.port) {|http|
   http.get(‘/api-create.php?url=’ + newurl)
   }
   if res.body.empty?
      #tinyurl is not responding properly… Return the original url
      return ‘<a href=’ + newurl + ‘>’ + newurl + ‘</a>’
   else
      return ‘<a href=’ + res.body + ‘>’ + res.body + ‘</a>’
   end
end

That will return a nice linked tinyurl in your view. That is all there is to it.

Posted in Rails, Tech.

CTRL-Z and fg: my new(old) best friend

As an operations engineer, I get to touch a lot of systems and a lot of different apps on those systems on a daily basis. This means a lot of log following, debugging, fixing, and more log following. Something that I love but often forget to use is background jobs. Background jobs work like windows on your desktop but for the command line. You need to switch between your text editor (vi), the log tail, and the command prompt. You could open three connections to the machine or you could use the background/foreground functionality built in to linux/bsd. Here is what you do:

You need to follow /var/logs/app.log, you need to edit /etc/app/app.conf, and you need to execute /usr/bin/app -debug to fix your problem.

First you run tail -f /var/logs/app.log and then hit ‘ctrl+z’ to suspend this task and return to the prompt. You should see something like:
[1]+ Stopped tail -f /var/logs/app.log

The number at the beginning is the job number. That is how you get back to the process.

Now you run vi /etc/app/app.conf and hit ‘ctrl+z’ This will be assigned job number 2:
[2]+ Stopped vi /etc/app/app.conf

Now you can use the ‘fg’ command to ‘foreground’ a job. So if you want to pull the log back up you do ‘fg 1′ and the log job will come back. Use ‘ctrl+z’ to go back to the command line and run ‘fg 2′ to pull up your app.conf. It’s that easy. If you ever forget what jobs are which you can run ‘jobs’ to display all running jobs:

[1]+ Stopped tail -f /var/logs/app.log
[2]+ Stopped vi /etc/app/app.conf

It’s that freaking easy. Enjoy…

Posted in Tech.