How to Email Yourself Your IP Address

Absinthe, Programming, Website Development

I’ve used the instructions here to set up a script that emails my desktop’s IP address to me.

Their instructions are five years old, so I had to make some additions:

  • In Gmail, you need to enable Access to Less Secure Apps.
  • I had to add ‘touch ip.txt’ to their bash script right before ‘read ip1 < ip.txt’, otherwise the script just hung at that line forever.
  • sometimes returns nothing for IP. This makes the routine think your IP has changed (into nothing). To avoid this, I put the call to inside a while loop that tries to call again until it gets a response.

I need to email myself my IP because, otherwise, my ISP might change my IP address (a la dynamic IP), and then I wouldn’t know where to find my website anymore.

Since now I will always be able to find my home IP, I can always access my website from anywhere in the world.

My script:


SUBJ=”some subject”


touch ip.txt
read ip1 < ip.txt

while [ “$ip2” = “” ]
ip2=$(wget -qO-

if [ “$ip1” = “$ip2” ]
echo “$ip2” > ip.txt
echo “$ip2” | mail -s $SUBJ $EMAIL


How to Set up an Apache Server on Linux

Programming, Website Development

I’m going to set up Apache on my desktop. It’s going to be a pain in the ass. I might as well document the experience here.

What is Apache?

Apache is a web server program. Following the butler-and-house metaphor from my post on website ownership, Apache is the hollow shell of the butler. When you write a program to control the butler (your website), you will store them on the Apache server.

If I understand correctly, installing and configuring Apache on my computer will allow me to use my desktop as a website server. I will still need to buy a domain name in order to make that website accessible from the Internet.

Getting Apache

The first step should be downloading and installing Apache. According to Andy Kahn, this is as simple as going to and downloading the source distribution file.

Andy’s instructions are about 12 years old, and it looks like the Apache website has evolved significantly since his heyday. The homepage is an extremely noisy mess of ‘Latest News’es and ‘Latest Activity’es and what-have-you-es.

Hidden away in the upper-right-hand corner is a promising button called Download. Eureka!

Not quite. Rather than the big shiny ‘Download’ button I was hoping to find, the Download page is a list of mirrors. Annoying… but at the top of the page they list a recommended mirror, so let’s click on that.

Uh oh. That takes you to a huge list of directories. The page explains that these “contain current software releases from the Apache Software Foundation projects.” All of them do? How many versions of Apache do you need?

This is getting too painful. Trying a different approach…

Getting Apache, Take 2

So instead of trying to be smart about things, I’ve decided to ask Google to do my thinking for me. Googling “how to set up ubuntu desktop as a web server” led me to a very promising guide.

Following their instructions exactly… works! It’s nice when things work. I ignored the section on phpMyAdmin because I want to learn to use MySQL.

In Summary

I now have a working Apache server on my desktop. Stay tuned to see what I end up doing with it…


I found some more useful instructions. This describes some security measures that might be worth employing, as well as how to give you user account permission to write into the website without sudo-ing in every time.

I’m now running a website that is accessible over the Internet. Cool.

The only problem now is that I still don’t have a domain name. You can still find my website online, though, but only if you know that my IP address is (and only as long as the remains my IP address – ISPs change your address periodically).

I’ll work on setting up some work-around for this. If I can manage it, then I’ll have a working and useful website for free!

Top Programming Languages

Programming, Website Development

We were shown this neat list in class today. It ranks programming languages by their popularity. If you’re wondering what languages to add to your resume, this might be a good place to start.

C is still king, which I was glad to learn. Java is in close second, which is all the more incentive for me to finally get around to learning it. JavaScript was chosen “Programming Language of the Year” for 2014, since it showed the most positive growth last year.

How Websites Work

Website Development

After an enlightening conversation with an anonymous benefactor, I feel obligated to summarize my newfound understanding of how website ownership works. I’ll write this as a high-level walk-through from the point of view of somebody trying to create a new website.

Buying an Internet Property

The first thing you need is a domain name. That’s the address of the ‘house’ where your website will live. You need to buy this from the domain name ‘police’. They call themselves ICANN, and they are an international organization that regulates domain names. You can imagine the shenanigans that might arise if nobody was making sure domain names were only used once at a time. You might go ahead and buy a ‘house’, only to find that somebody else is already living there.

In practice, many (if not most) domain names have already been bought up in bulk by companies such as GoDaddy. Think of these as landlords. You will probably end up buying or renting your address from one of these companies, who will in turn inform the ICANN that your website is now ‘living’ at that domain name.

Managing Your Internet Property

You just bought an empty house. Now you had better put something there! Your domain name is like the street address of the house, and typing the domain name into your browser is like driving to that address. At this point, visitors would arrive and find only an empty house. Things would be rather boring.

You need to ensure that somebody is home to answer the door when people come a-knockin’. Since you can’t do the job yourself, you need to hire a ‘butler’. When people visit your domain name, the butler will answer on your behalf. It will greet your visitors, and guide them through the house.

Visitors can ask the butler to show them a room of the house, and it will, if you have instructed it to do so. Visitors can deliver messages to your butler, and it will write them down and pass them along to you, if you have instructed it to do so. Visitors can ask the butler to show them a picture of a cat wearing a hat made of bread, and it will, if you have instructed it to do so, and if you have such a picture somewhere in the house.

The butler is controlled by a computer program that you will create. It has access to any files you have given it. You need a computer, known as a server, to run your butler.

You can use a personal computer as your server, if you like. However, whenever your computer is off, the butler will be asleep. Visitors may come to the house and knock on the door, but nobody will answer. This is known as the server being ‘down’.

The other option is to rent a server from some company that will ‘host’ your website. Again, GoDaddy is one of the major players in this business. When you rent a server to host your website, you’re ensuring the butler is always ready to welcome your guests.

Everything Else

So now you have hired a butler. It will answer whenever someone comes to visit your website. The final step is to decide what your butler will do with the visitors once they enter your website.

You give your butler instructions by writing them in files, and then storing those files on the server. Anytime a visitor arrives at your website, the server will read those files, run the program they describe, and relay the output to your visitor’s browser.

You also need to fill the rooms of your butler’s house with any images, videos, or other documents that your butler will need. These data files are also stored on the server, and the butler will access them when your instruct it to do so.

The butler program, in combination with your data files, form the heart and soul of your website. From this point onwards, website design is a matter of choosing what data to store on your website, and when and how your butler will relay that information to your visitors. This can get as complicated as you like, and I won’t say anything else on the matter for now.


A website has an ‘address’, called a domain name. Visitors come to your website by typing the domain name into their browsers. You need to buy a domain name on which to locate your website, just like you need to buy a plot of land on which to locate a home or business.

The website you build will have two parts: a ‘butler’ program designed to meet and greet visitors, and a ‘house’ filled with data files needed for the operation of your website.

Finally, you need a physical computer to run the butler program and store your data files. This computer is called a server. You can use your own computer as a server, or you can rent a server from a website hosting company.