planetfoo

Linux

imdb url grabber

by Matt on Aug.04, 2010, under Linux

Here’s a quick and dirty shell script that will attempt get the correct IMDB link based on a files name. I use this to copy media into the appropriate places on my media server along with an NFO file that xbmc can use to download the appropriate movie info. This technique can be used to fetch links from google for a lot of different things from the command line. Be careful though, if you use this too many times (1000s?) in a short amount of time google will ban you for a while. I think the correct thing to do is use their API. I did say quick and dirty though :) Adjust path’s, etc. accordingly and try your luck.

#!/bin/bash

SEARCHSTRING=`echo $1|cut -d. -f1|sed 's/ /_/g'|sed 's/-/_/g'|sed 's/_/+/g'`
IMDBURL=`curl -iIs -A "Mozilla/5.0" "http://www.google.com/search?&q=site+www.imdb.com+$SEARCHSTRING&btnI" | grep Location | awk {'print $2'}`
echo $IMDBURL
Leave a Comment :, more...

Ubuntu Server

by Matt on Jun.04, 2010, under Linux

I’ve been using Linux as my *nix server of choice for about 15 years now. I’ve been using it as my primary desktop for about 10 years. On the desktop I’ve used just about everything from Slackware, to Rehdat, to Suse and Debian. I’ve been using Ubuntu on the desktop for about 4 years now and I am very happy with it. The work that canonical has put into Ubuntu has dramatically improved Linux as a desktop operating system and I find it hard to use anything else. When I use any other OS I miss using Linux and at least some of that credit goes to Canonical for doing such a good job with Ubuntu. My preference for Linux on the server side has always been different from what I use on the desktop.

(continue reading…)

Leave a Comment :, more...

Dynamic IP address checker / DNS / IPv6 Tunnel Updater

by Matt on Jan.08, 2010, under Internet, Linux

Here’s a script I wrote that will check the IP address of my FIOS connected firewall, update DNS and IPv6 tunnel settings and send me an email. This script assumes you have control of a DNS server somewhere that has resource records related to your firewall host. I use he.net’s tunnelbroker for my IPv6 tunnel and this script uses their facility to update the tunnel end point configuration and then restarts the tunnel on my side. Details and script are below.
(continue reading…)

Leave a Comment :, , more...

Import apt repository GPG keys

by Matt on Dec.01, 2009, under Linux

Here’s how to import the appropriate key in ubuntu:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $Key

Where $key == the gpg key id. The key id is shown in the error message you get when running apt-get update after adding a new repository. For example:

GPG error: http://download.virtualbox.org karmic Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY DCF9F87B6DFBCBAE

DCF9F87B6DFBCBAE is the key ID for the virtualbox karmic repository. So doing this:

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DCF9F87B6DFBCBAE

imports the correct key.

1 Comment more...

Reboot Linux via proc

by Matt on Nov.23, 2009, under Linux

Every now and then one of my machine looses a disk in such a way that I can no longer read the file system but the system is up and I can log in or get console access. This seems to happen when using software RAID1 when one of the disks fails on some of the hardware I use.

To reboot the box:

echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

To shut it down:

 echo 1 > /proc/sys/kernel/sysrq
echo o > /proc/sysrq-trigger
Leave a Comment more...

Zoneminder with Megapixel Cameras

by Matt on Nov.16, 2009, under Linux

I’m continuing to post technical articles from the old blog. This is a zoneminder how-to I wrote for work a while back. The most interesting thing about this article is that I got zoneminder to work with cameras that previously did not work due to their proprietary nature. The particular cameras, the Megapixel MPix13D and MPix1339WIR only work with Internet Explorer which makes getting them to work with zoneminder difficult if not impossible.  I was able to get them working though. See the details below.

(continue reading…)

Leave a Comment :, , more...

net-snmp and lm_sensors on centos (rhel)

by Matt on Nov.14, 2009, under Linux

Why does Redhat disable support lm_sensors support in net-snmp? The spec file contains everything needed to add lm_sensors support but it is disabled by default.  I modified the spec file and rebuilt the RPM to enable lm_sensors on my CentOS boxes. Seems to work fine for me. I’d love to know why they disabled it though.

Here’s a great article on setting up cacti with lm_sensors:

http://www.eric-a-hall.com/software/cacti-netsnmp-lmsensors

Leave a Comment :, , more...

Useful Links for Running Linux on Apple Hardware

by Matt on Nov.13, 2009, under Apple, Linux

Here’s some links with information about running Linux on Apple hardware. I’ll keep adding to this as I find more information:

The Ubuntu Mactel support team. Home of applesmc and other required software:
https://wiki.ubuntu.com/MactelSupportTeam/PPA

Install Guides:
https://help.ubuntu.com/community/MacBookPro5-1_5-2/Jaunty
https://help.ubuntu.com/community/MacBook Aluminum
http://ubuntuforums.org/showthread.php?t=1192296

Power Management / Heat:
http://ubuntuforums.org/showthread.php?t=969183
https://wiki.ubuntu.com/MacBookPro/SantaRosaFanControl

Leave a Comment :, more...

Macbook Fan Control in Linux

by Matt on Nov.13, 2009, under Apple, Linux

Update: Since Karmic came out I no longer need to run this….

Update: I have gone back to using this script because my laptop was getting too hot. I also tweaked it a bit for my new macbook pro 7,1.

Here’s a daemon written in python to monitor the temperature and control the fan speed in linux. It depends on the applesmc module available from: https://wiki.ubuntu.com/MactelSupportTeam/PPA.

Main Script:
copy to /usr/local/sbin/mb-fancontrol (note that the .py is removed!)
link: http://planetfoo.org/files/mb-fancontrol.py

Init Script:
copy to /etc/init.d/mb-fancontrol  (note the .sh is removed!) and
run ‘update-rc.d mb-fancontrol defaults’
link: http://planetfoo.org/files/mb-fancontrol.sh

Leave a Comment :, more...

MAME Cabinet

by Matt on Nov.13, 2009, under Linux, MAME

A friend gave me an old video game cabinet a while back and I set about making it into a MAME cabinet. The ultimate goal was to relive a favorite part of my youth through the wonders of modern emulation technology. (continue reading…)

Leave a Comment :, more...