Author Archive for Eric Greer

Sorting images into folders based on exif year, month and date taken with bash

I need to sort about 18,000 home images taken over four years into a variety of folders on my home computer. We thought: hey, its on the server – mission complete. Three years later it’s an utter mess. Perhaps I can find the words to ask my computer to do this task for me.

First, you’ll need to install the exif tool:

su -c 'yum install perl-Image-ExifTool'

Then, I ran the following command:

screen -S sort nice find ./Pictures -type d -exec exiftool '-Directory

./Pictures being the location of the stuff I wanted to sort relative to my working directory, and Orginized/ being the dir I want to move them into.

The screen -S command starts up a screen session so you can press Control-A then d to background it and keep doing other work. The nice command makes my pathetic little Pentium 1.6 not explode into flames. Don’t you hate it when that happens???

This worked on Centos 5.4, i386.

Google is weird how it crawls websites…

I recently have been working on a side project hosting dedicated game servers at HostedGameServers.com and have been hitting a lot of snags.

Basically, the site used to be at Hostedd.com and was doing ‘ok’ for Google rank. It was steadily climbing the ladder toward page one. I decided since the domain hostedd.com had only been around for a month or two, I would re-brand the entire company to Hosted Game Servers so relevant things were in the URL. I also went ahead and added a keyword or two in my page URLs. I set my prior domain hostedd.com to be a 301 redirect to hostedgameservers.com and figured all was well. I setup the old URLs to redirect to the new slightly longer URLs with keywords in them in case anyone hit the old URLs.

I generated a new sitemap, added the new site to google analytics and google webmaster tools. A strange thing happened. Google appeared to crawl one of the old non-existent pages that I had a redirect for… detected it missing (thats how it handles RewriteRule?!!?) and left my site promptly! It didn’t return for days. Considering I had a current sitemap which mentioned NOTHING of these files; its rather weird it even tried to visit them.

Wow I thought… what a setback. I’m sure this kind of thing is on my record with Google for awhile….

So I went and requested removal of he old URLs from google at both the new and old domain names. Google denied them 24 hours later because they were not restricted by my robots.txt. In the mean time google crawled my website again, ignored what was listed in my html and xml sitemaps, hit a redirect and reported it as a couple 404 missing pages. WTF? My web host is wasn’t even having outages! I did all this sitemap and immigration work and google tagged my domain with a big red F for having what it thinks are 404 errors. Total crap!

So anyway, I requested removal again after adding the old url’s to the robots.txt file and they were accepted. Google crawled my site again, indexed two pages, and left. My site is ranking horribly, even if i search for all the words in the new domain name and all I can do is wait.

It’s common practice o use rewrite rules and rename pages. I’m really surprised this caused complications with the internet giant. It’s really frustrating and for an internet business can be deadly. Maybe google has become scored and petrified of google rank stealing tricks?!

GameGuard working on Windows 7 European Aion Beta Access (Fix for Error: 0)

Did some digging because my stupid do nothing game guard client for Aion would just crash with error message 0 a few seconds after starting. Deleting the GameGuard folder does not seem to matter.

Apparently you can use the .des files from the Chinese version over top of yours and it works fine.

Found the solution at the bottom of this thread.

But, because you don’t need to go chasing links… here’s the .des file in the form of a .rar as linked on the forums (no registration required to download for this site!).
CLICK HERE

Open up this folder for 64bit:
C:\Program Files (x86)\NCSoft\Aion\bin32
For 32bit, AION will just BSOD in Win7 right now, I’m assuming this is going to be fixed by Aion later.

Then rename GameGuard.des to GameGuard.bullshit and copy in the one from the rar supplied here. Presto, it works! You’re Welcome!

If you appreciate, please drop a comment thanks!
Oh.. and if you can’t extract it, download winrar from www.rarlabs.com

(written from windows live writer)

Fetch the local weather and optionally put it on the footer of your motd

I wanted to put my local weather on the bottom of my /etc/motd – because i’m dorky like that.

I found a bunch of random ways to fetch the weather forecast in plain text… and a lot of complicated grep/sed/curl commands to get there. I wanted something as simple as possible.

So first, the shell script to get the weather in plain text…

echo " Weather for Palmyra, Virginia:"
lynx --dump "http://mobile.weather.gov/port_mp_ns.php?CityName=Palmyra&site=AKQ&State=VA&warnzone=VAZ048/" | head -n 7 | tail -n 1 | sed -e 's/\ //g' | sed -e 's/°/°/'

The echo is just for looks, obviously. You’ll need to change it to whatever you want it to be headed up by… or remove it completely.

The first lynx command fetches the website how a browser sees it.
The second head takes only the top portion of that resulting website.
The third command, tail, only takes the bottom line of the resulting head display.
The fourth sed command takes all the spaces out.
The fifth command gets rid of some weird character interpritation from lynx and makes it nicely have a Fahrenheit symbol.

You’ll need to get your own weather url and replace mine with it by entering your zip code here: http://mobile.weather.gov/.

Okay, so now we have a way to get the local weather. I actually setup an alias in .bashrc for this, too.

Next, we have the script that puts this at the bottom of your /etc/motd file. That script, in my case, assumes that you have sudo without entering your password:


cat ~/sh/backup/motd.backup > ~/motd.new
sh ~/sh/weather.sh >> ~/motd.new
echo "" >> ~/motd.new
sudo mv ~/motd.new /etc/motd

The first line copies my standard motd message into place within what will be the new motd file. This makes sure we maintain the same static message at the top. You’ll have to update that line and point it to a basic motd message file that serves as a template.
The second line, runs my weather script, which you’ll need to update and point to where yours is.
The third adds a blank line to the bottom of the new motd file, for better formatting.
The last of the 3 lines moves the new motd into place on top of your current.

Then, I scheduled that last script to run each hour in my user’s crontab with the command ‘crontab -e’:
0 * * * * ~/sh/generateMOTD.sh