In my previous post, I talked a little bit about options for being able to SSH into your home machine from anywhere. In this post, we’ll get into the details of my specific configuration, using the free ddclient tool for Linux, and a subdomain of a paid domain name with Namecheap.
On our paid domain, which we will call “mydomain.net”, we’re going to add a subdomain that will point to our Linux box. That way, we can just SSH to “dynamic.mydomain.net” to reach our Linux box from outside our home network.
You could make “mydomain.net” itself be your dynamic DNS URL if you really wanted to, but the point here is to re-use a domain you’re already paying for to host a website, as opposed to relying on free services.
Go into Namecheap (or whatever you’re using), and drill down into the settings for mydomain.net. Go to Show All Records, and add an A record for 127.0.0.1. Yes, that’s localhost. It’s just a placeholder for now—when we’re all done it’ll be continuously updated to our home machine’s real IP.
Next, apt-get install ddclient. ddclient is a simple command-line tool that will update the subdomain you just set up every so often, with your home machine’s current IP address. That way, the subdomain will always point to the right place. It was originally written for the popular DynDNS service I mentioned before, but now works with anything, including Namecheap.
We’ll need to configure ddclient now, so edit its config file:
sudo nano /etc/ddclient.conf
# Configuration file for ddclient generated by debconf # # /etc/ddclient.conf protocol=namecheap use=web, web=checkip.dyndns.org/ server=dynamicdns.park-your-domain.com login=mydomain.net password='your_password_here' dynamic
sudo ddclient --debug --verbose
service ddclient status
I am currently able to SSH into my home machine, from anywhere, on any device that I authorize to connect with a proper SSH keypair. In my next few posts, I’m going to share how I’m doing that.
To start, you’ll need a static URL that always points to your home machine, since your IP address at home won’t always necessarily be the same, and won’t be easy to memorize. To do this, you’ll need some sort of service to host your static URL, and a piece of software installed on your system that constantly updates what IP the static URL points to.
Back in the day, there was a highly popular free service called DynDNS. Apparently it’s no longer free.
For a while I was using a free service called No-IP, since they have a native Linux client. I eventually got tired of it, since it expires if your IP address doesn’t change for 30 days and you have to go into their web interface and renew manually.
In the next post, I’ll show you how to use ddclient to set up dynamic DNS, with a subdomain of a paid domain name on Namecheap. I’m sure this will work with any domain registrar, but I happen to use Namecheap. I will never give GoDaddy or 1&1 my money again.
I just came across a clever way to quickly find out which user is running your web server. In this case it’s done with PHP, but I’m sure it can be adapted for Ruby etc:
<?php echo `whoami`; ?>
hdparm is a command line tool to find the actual read/write speeds of hard disk. To find the read write speeds of a drive, simply exexute the following command in terminal:
sudo hdparm -tT /dev/sdathe -t flag is for read timings and -T is for write timings.
/dev/sda is the disk on which the read/write timing measurements are to be performed.
In case hdparm is not installed, you can install it via command (in debian based distros):
sudo apt-get install hdparm
I’ll have to try this!
Last week I heard an awesome story about an indie game studio called Greenheart Games, who released a game called Game Dev Tycoon. It runs on Windows, Mac, and Linux, and costs $8.
In the game, you run a game development studio, and try to grow and make money.
There was an interesting twist with the release of this game. Immediately after releasing it, the developers put a cracked copy onto BitTorrent themselves, pretending to be a release from a cracking team, etc. Only, the cracked version is rigged so that your company never really makes money, due to PIRACY.
The game apparently collects anonymous usage data, and they found that over 90% of the game’s users were playing the cracked version.
I was so impressed with their anti-piracy statement, being almost like an art project in itself, PLUS their support for Linux, that I had to give them my $8.
The second time I ran the game, I got a very warm in-game email from the developers, explaining how it’s their first game and how awesome I am for purchasing the game legitimately. I like these guys, and I want them to succeed.
Note that when I first tried to run the game on my Xubuntu 12.10 box, I got this error:
error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
You’ll need to install a library to fix that:
sudo apt-get install ia32-libs-gtk
Hey, sorry I didn’t notice your message before now… Tumblr’s messaging system leaves much to be desired :) I’m on Xubuntu 12.10 still, but I should still be able to help you.
The official Flash for Linux was discontinued a while ago, so there haven’t been new versions for a while, and there won’t be any unless Adobe decides to support Linux again (unlikely). So, the official Flash for Linux is never going to be the latest version. Flash support for Linux lives on as the built-in Flash capability for Chrome, so in order for you to have the latest Flash on Linux, you basically have to be using the latest Chrome.
If you were using Firefox, that may be why it didn’t work—as far as I know, Firefox for Linux relies on the official (and outdated) Flash for Linux (I may be wrong). However, you mentioned that it didn’t work in Chrome either. These two posts I made on fixing Chrome’s built-in Flash might help you:
http://from-mac-to-xubuntu.tumblr.com/post/42270974583/how-to-fix-couldnt-load-plugin-in-chrome-for-linux
And then this update:
http://from-mac-to-xubuntu.tumblr.com/post/43394220513/how-to-really-fix-chromes-flash-for-linux
If you fiddle around in chome://plugins as I mention in those posts, you should definitely have working Flash on Linux, even outside of Youtube. Let me know if you’re still having trouble, even send me some screenshots if you’d like.
This is an issue that had plagued me for years before I even tried to fix it, back from when I would dual boot Mac OS X and Windows so I could play games. My click in Windows would be off by a few hours, but in OSX it would be fine.
This problem is caused by the fact that Windows saves the time as your local time zone’s time, whereas Linux and OSX work off of GMT.
There are two ways to fix this—you can tweak Windows to stick to Linux’s time, or you can tweak Linux to stick to Windows’ time.
Since Linux is our primary OS here, we’re going to do our tweaking on the Windows end so it stays true to the time we set in Linux.
Boot into Windows, then open regedit.exe. If you’re not familiar with it already, you can usually just type “regedit” into Start -> Run, or in the Start Menu’s search box, depending on which version of Windows you’re using.
Once in Regedit, navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
In the right-hand pane of TimeZoneInformation, right click in the white space around the registry entries, and select New -> DWORD (32-bit) Value. Give it the name RealTimeIsUniversal. Double click it to edit it, and set the Value to 1.
Now all you have to do is reboot. When next you boot back into Windows, the time will be correct.
This might be obvious for some server admins out there, but here’s how to create soft links in your home folder pointing to config files you edit frequently, but don’t want to bother remembering the path to:
ln -s /etc/mysql/my.cnf ~/my.cnf
ln -s /etc/apache2/sites-available/default ~/sites-available-default
In this case, those are my mySQL config file, and my Apache VirtualHosts file. Now from within your home folder, you can just go:
nano sites-available-default
Beats scrolling through your command history, anyway.
I’d suggest Aptana Studio as a Dreamweaver Alternative. Not sure exactly what functionality in Dreamweaver you were using it for, but Aptana’s pretty complete and polished as an IDE. It also runs on Windows and OSX, fyi.
Also available for Linux are Eclipse (which Aptana is based on), NetBeans, and Geany (Linux only). Personally I do my web development in Sublime Text 2, but that’s just a text editor and not a full IDE.
The other day I discovered Boris, a REPL for PHP.
If you don’t know already, REPL stands for Read, Evaluate, Print, Loop. It’s a script that serves as a console environment for you to play with and test code. If you’ve used the IRB console in Ruby, or the Scala REPL, you’ll already be very familiar with this concept.
Among some, especially academic types, PHP has a reputation for being less elegant than other languages, and that’s putting it politely. However, PHP is fun to work with, and it’s been paying my bills for three years, so I’m always looking for ways to make it more civilized.
You can download it from GitHub:
https://github.com/d11wtq/boris
From there, the “boris” executable is in the bin/ folder. You may want to put this executable into your PATH at some point, but for now you can just run ./boris to run it.
Any statements you type into the console will be evaluated, and the results are printed onto the screen. Also, variables and changes you make within the environment are persistent for as long as that same console instance is running. You can include libraries and everything, so if you need to test code that relies on a framework, that’s no problem.