Category Archives: Linux

All my thoughts on Linux

quick and dirty dns lint

I run a DNS server that I and a lot of my friends use. The problem with it being “free” and being between friends is sometimes people forget to tell you if they have switched DNS serving arrangements or just haven’t kept the registration.  I wrote a quick and dirty script, thanks to the whois ruby gem, to check to see if all the domains listed in Bind9‘s named.conf are still registered and if so do they still have our nameserver listed as one of the nameservers.  g0ff asked me for a copy, so I thought it might be useful to share with others.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'rubygems'
require 'whois'
 
zones = Array.new
ZONE_RE = /^zone "(\w+.\w+)" in/
File.open(ARGV[0]) do |f|
  f.each_line do |line|
    md = ZONE_RE.match(line.chomp)
    zones << md[1] unless md.nil?
  end
end
 
NS_RE = /^#{ARGV[1]}$/i
 
zones.each do |zone|
  c = Whois::Client.new
 
  begin
    domain = c.query(zone)
 
    if domain.registered?
      if domain.nameservers.detect { |ns| !NS_RE.match(ns.name).nil? }.nil?
        puts "#{domain.domain} doesn't seem to have us as a dns server"
      end
    else
      puts "#{zone} doesn't appear to be registered"
    end
  rescue Whois::ResponseIsThrottled
    sleep 120
    c = Whois::Client.new
    retry
  end
end

Thanks, Steve

Steve Jobs passed away today at age 56 after a battle with cancer.  Here’s a few random thoughts…

On this day, I own a buttload of Apple gear: iPhone, iPod, iPad, MacBook Pro, Apple TV, Apple TV 2, Time Capsule, Mac Mini… I’m planning on getting an iPhone 4S as soon as possible.

I was (and am) a big open source dork at heart, but Apple’s simplicity and ease of use, especially the past 7 years really spoke to the pragmatic side of me.  It turned me into a fan boy, I guess.  It didn’t hurt that OS X is NeXTStep is UNIX… I touch OS X and Linux every day.

One of Dinah’s first words was iPod which she taught herself so she could ask me to turn on music for her.

In college, I loved using the NeXT computers we had. My first class in college used scheme on the NeXT’s. The NeXT is one of the first places I played Doom.  I took calculus using Mathematica on the Mac in college.

Steve also touched my kids’ lives via Pixar. (Okay, my life too, I saw Toy Story in the theater first run, long before I had kids.) Also through their first computer, a Mac Mini.

There were too other public figures who’s lives and deaths touched me the way Steve’s passing is touching me today: Jim Henson and Fred Rodgers.

Things that are fun, but shouldn’t be

The server that this blog lives on has switched in the past two hours.  I share a co-op box with 9 people, but I’m one of the two admins.  You know, I really get a kick out of admining still, which is probably a sign of mental illness.  But the admin fuel, er, beer helps.

In any case, this point was to share that something that shouldn’t at all be fun is, but also to test to see if the blog migrated okay. :)  If you notice anything weird, please let me know.  But if its broken, you probably can’t let me know, and i’ll live in blissful ignorance.

Tivo2Podcast update

I’ve made a few updates since my last release a few weeks ago. I thought I’d toss an updated version out there.  What’s new in this version:

  • Duration is no longer hard-coded to 32:00 and actually reflects the duration of the show
  • The script will attempt to find the TiVo via Bonjour/mDNS/ZeroConf/DNS-SD/whatever unless passed a -t flag with the TiVo’s IP address. If you have more than one TiVo, it will go with the first one it finds.
  • Moved the stuff in lib to lib/tivo so the package is more easier sucked in by something like encap or stow

Download: tivoscripts-20100314.tar.gz

When I get some motivation later in the week, I’ll put the git archive online, incase anyone wants to clone it and do some development on it.

TiVo -> Video Podcast

Previously on “You can imagine where it goes from here”: We released a script to download stuff from the tivo, and then made some improvements to it.

After two years of saying I was going to fully automate the process of downloading and transcoding shows for my iPhone, I finally got off my ass and did it.  The script is called TiVo2Podcast and it not only does the downloading and transcoding, but it stuffs the resultant video into a an RSS feed for easy consumption/playback by a podcatcher such as iTunes. I’m now automatically getting the shows off my TiVo and onto my iPhone for easy commute-time consumption. (I commute by train, I do not recommend commute-time consumption if you are driving.)

The ruby script wraps tivodecode, HandbrakeCLI, and AtomicParsley and is intended to be run from cron.  I’ve tested this on Linux, but it should run on any UNIX-alike, but it won’t run on windows since I make liberal use of the system() call. Also, this is intended for PERSONAL USE ONLY, do not set up podcast feeds and violate the ethics (and also the laws) of copyright left and right.

This is a very early version and can certainly use some tweaks and enhancements, primarily in configuring the shows you want to capture.  Right now, configuration is in the form of doing INSERT statements in SQLite.  Not very friendly, but it gets the job done until I can make a quick and dirty question based TUI. Here’s an example of setting up getting the best fucking news team on the planet:

INSERT INTO configs (config_name, show_name, rss_filename, rss_link,
                     rss_baseurl, rss_ownername, rss_owneremail, ep_to_keep, encode_decomb)
            VALUES ('tds', 'The Daily Show', 'tds.xml', 'http://www.thedailyshow.com/', 
                    'http://example.com/podcasts/', 'Keith T. Garner', 'kgarner@example.com', 4, 1);

Download tivoscripts-20100304.tar.gz and let me know what you think. Make sure you read the README!

[Update 3/5: Forgot to add that all the code I wrote is under the Simplified BSD License, so have at it.]

Linux nostalgia

There is a question/thread over at slashdot titled What did you first do with Linux? Rather than copy my reply here, I’ll just put a link to my reply to that subject.  I did have (and I mentioned it in the post) a get off my lawn moment when writing it.  A fun walk down memory lane, and reading the rest of the comments on slashdot shows you how relatively early I was to the game.

It also makes me want to link to Anne’s idea of the best to learn Linux.

Truth in comics

I love xkcd and its geeky geeky ways.  It often captures things I’ve lived and/or seen.  Today’s is one I have lived and seen lived.

This reminds me of a post on usenet my friend Anne made in 1998.  To quote:

So I am left not bitter just tired of this whole meeting people, emotional ties, finding a compatible person and then having them yank away.

It is just an emptiness right now.

From what I have observed from my male friends, though, this is exactly the climate required to learn Linux. Without a full and happy lovelife or distraction of soft lips and a reason to kiss them, there is enough room to grasp the intricacies and nuances of such a fine operating system.

It has already begun to happen. As I walk down the street I am not thinking of emptiness, kising, nathan or any other previous SO’s, I am thinking of penguins, rm -rf / and lilo.

I am already convinved that linux will dull the pain better than heroin.

I still loves me some linux hardcore, though.

Sunday fun

  1. Shutdown
  2. <install new/replacement disk>
  3. fdisk
  4. mkswap
  5. umount /boot
  6. dd
  7. e2fsck && resize2fs
  8. mount -o remount,ro /
  9. dd
  10. e2fsck && resize2fs
  11. mount -o remount,rw /
  12. pvcreate
  13. vgextend
  14. pvmove (wait a long long long time for 174 GB, especially with disk read errors, to move)
  15. vgreduce
  16. shutdown
  17. remove old and busted, put new hotness in as primary disk
  18. boot into rescue disk
  19. mount / /usr
  20. grub-install /dev/hda1
  21. ms-sys -m /dev/hda
  22. vi /etc/fstab
  23. shutdown -r now
  24. Party like its 1999 or, if you like assembler better:   GGB

Place shifting action 3: Revenge of the Sith

tivo.jpgPreviously I put out an early version of my ruby based command line oriented tivo download script.

I’ve had a patch from MARK NOTARUS to make the menu have some more options and I’m using Console::ProgressBar from facets now.

It works well enough for my needs, but let me know if you hit any roadblocks. Just as a reminder, my target was to download stuff off my tivo on one of my headless Linux boxes for batch encoding for my iPhone and/or PSP.

Download tivo-ruby-0.2.tar.gz