Send email notifications on IP address change

I recently discovered that my home IP address is not as static as I would like. This will prove a problem if it changes while I'm away from home, so I needed to find a way to get updates on the IP if and when it changes. I threw together a quick bash script that I could run regularly with my server's cron daemon. Any time the IP address changes, it emails the provided email with a customizable message that includes both the old and new IP's.

#/bin/bash

#Variables
IPADDR=""
OLDIP=""
#Path to where you want the ip address file stored
HOME_PATH="/home/user"
IP_PATH="${HOME_PATH}/.ipaddress"
#Destination email address
EMAIL_DEST="user@example.com"
#Email body. Don't remove the inner double quotes, and remember to properly escape any single quotes
EMAIL_MSG=$'"This server'\''s IP address appears to have changed from $OLDIP to $IPADDR. Might be time to update your DNS!"'
#Email Subject
EMAIL_SUB="Server Alert: IP Address Change"

#Function: sends the email when called. Requires that you actually have mail configured to use a mail client.
email_alert ()
{
echo "$IPADDR" > "$IP_PATH"
eval EMAIL_MSG=$EMAIL_MSG
echo "$EMAIL_MSG" | mail -s "$EMAIL_SUB" "$EMAIL_DEST"
}

cd "$HOME_PATH"

#Grab our current IP address and do a quick sanity check
IPADDR=$(curl icanhazip.com -s | grep -m 1 -o --regexp="[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}")

#Compare current IP to old IP and take appropriate actions
if (( ${#IPADDR} > 7 ))
then
if [ -e "$IP_PATH" ]
then
OLDIP=$(<"$IP_PATH")
if [ "$IPADDR" != "$OLDIP" ]
then
email_alert
fi
else
email_alert
fi
fi

Sinners in the hands of an evil god.

Christianity is wrong. Whether it be the dogma of fundamentalists, or the cafeteria plan of more liberal Christians, it’s all crap. Why? Because either way you look at it, the Christian god is an evil bastard.

 

“Evil? But God is good!”

If the Christian god is good, and he loves every person unconditionally, then he would want to create a universe in which he maximizes the number of souls in heaven, and minimizes the number of souls in hell. In fact, the Bible says just this in 2 Peter 3:9

The Lord is not slack concerning his promise, as some men count slackness; but is longsuffering to us-ward, not willing that any should perish, but that all should come to repentance

But no, the Christian god is evil because among all the possible universes he could have made, he made one in which sin, pain, and suffering are not minimized and the ratio of the number of people in heaven to the number of people in hell is not optimized.

 

But God didn’t create sin or pain or suffering! Sin was the fault of Adam and Eve! Pain and suffering are a result of sin!

Bull shit. First, the Christian god is omniscient. This would require that he knew that Adam and Eve would sin before he created them. Further, by actually creating them while knowing this, it requires that he wanted them to sin or else he would not have created them. Being omniscient, he by definition knew that he was creating a universe in which sin would arise and, in fact, would be the pivot of his “plan” for salvation. Being omnipotent, he could have created any universe for which it is not logically impossible for it to exist.

 

But you’re not God! How do you know that he didn’t create the best universe? That some pain and suffering is not required for the most good to be done? And anyway, we have free will so it was our (Adam and Eve’s) choice to disobey God’s law.

Well the Bible itself hands us a better, more perfect scenario that is possible and that would have presented no problem for a good, omnipotent, omniscient god to create.

Consider this: there will be no sin in heaven. People in heaven will have free will, or they won’t be people. Some people go to heaven without having lived a significant life on earth, and more importantly, without having made a conscious decision about the Christian god (eg. babies). Since in Christian theology, the scenario exists in which heaven can be populated with people with free will and without requiring that these people do whatever it is that Christians believe must be done to get to heaven, then the Christian god could have created a universe with only these requirements / people / scenarios. All he would have needed to do is create Adam and Eve like any of the millions of babies and young children that have ever died, or just create in heaven from scratch anyone he wants to be in heaven, and not give them a sin nature. Take your pick as there’s a number of ways for it to work.

 

But no, the Christian god did not do this, instead choosing to make a universe in which sin, pain and suffering are a major facet of life.

Therefore the Christian god is, for lack of a more accurate description, a sadistic fuck for having not chosen a possible and plausible option which was better than the one we find ourselves in.

Finally, we are led to one of two conclusions. The Christian god does not exist because he would not have created this universe, or the god the Christians worship does not have the properties (all good, all knowing, all powerful, etc) that they claim he does.

Either way, fuck him, we’re better off without him.

Searching for jobs

As a recently unemployed person, I have needed to find ways to search for the largest number of jobs, while not having to sift through too much cruft. When looking at various job search sites, it can be difficult to use the same search queries on each.

The solution? RSS feeds and Yahoo Pipes.

Yahoo Pipes is a mature web aggregation and editing suite that allows you to gather information from all over the web, modify it, and then output it again. We will be gathering job listings from job search sites via RSS, filtering the feeds, then outputting the collection in a single RSS feed.

After creating a new pipe (you will need a yahoo account), you will have your pipe fetch job listings from two sites, craigslist and indeed.com. I have created an example pipe so that you can follow along through the process.

Craigslist’s RSS setup allows you to grab the RSS feeds from any of the job subcategories, or even from the main job category for your area. I chose to use the main job category. The address for the Kansas City job listings is kansascity.craigslist.org/jjj/. To get the RSS feed address, just add the text “index.rss” to the end. You now have kansascity.craigslist.org/jjj/index.rss to add to the pipe.

The Yahoo pipes interface uses a modular design that allows you to drag individual modules into the editing area as you need them and any number of times that you need them. To add the RSS feed, you will need to drag the “fetch site feed” module from the left column into the editing area.

Once the module has been added, paste the RSS feed address into the first text box. If at any point you want to see what is coming out of any individual module, you can click on the module and the debug box at the bottom of the page will update with that module’s output.

Head on over to indeed.com where you will get your second RSS feed.

First, search for jobs that fit your needs. On the results page, a link to the RSS feed for jobs matching your search will appear in the far right column. Copy the linked address, and paste it into a second “fetch site feed” module in the pipe.

Now that our pipe is fetching possible job listings, we need to filter the feeds to pare down the options to just the ones that interest us. To filter the craigslist feed, add the “Filter” module under the “Operators” section.

To connect modules, click and drag from the output dot on the bottom of the “Fetch Feed” module and release on the imput dot on the top of the “Filter” module.

Notice that I only “piped” the craigslist feed into the new filter module, but not the Indeed feed. That is because this filter module only permits certain RSS entries that have keywords that match the jobs I want. The craigslist feed needs to be filtered this way because it has all job listings, but the Indeed feed contains only what we searched for and doesn’t need to be filtered again.

Once the craigslist feed is properly filtered, you need to combine the two feeds together so that you can work with all of the job listings at the same time. This is accomplished with the “union” module as shown.

Next, you need to remove any unwanted job listings with another filter.

 

Be careful with this filter. Only add keywords that ONLY appear in job listings that you know you dont’ want or you could be cutting out good job opportunities. Notice that this filter is set to “block” items and not “permit”.

Next, you need to have three “unique” modules to strip out repeat items based on title, hyperlink, and job description.

Lastly, to sort the output into chronological order, you need to add the “Sort” module and set it to sort on item.pubDate in descending order.

The pipe has now been designed and only needs to be saved and run before you can add it to your favorite RSS reader. My favorite is google reader, though there are many options. You’ll find the save button at the top of the page. Wait for the pipe to be saved, then click the link at the top of the page to run the pipe.

The webpage will open a new tab or window with the pipe’s dashboard. This is where you can see the results of your pipe, and find the output RSS feed. The RSS feed link is located just above the output list. Copy the RSS link into your favorite RSS reader and you’re done.

You have now condensed multiple job search sites into one convenient location!