I’m going to briefly explain how to setup a new Raspberry Pi as a basic desktop computer with file sharing and screen sharing so that Macs can connect to it. This will be useful for quickly transferring files over, and taking control of the Pi remotely. I will be assuming that you have basic command line knowledge (running commands, installing packages, editing text files), and some Mac knowledge. I am not going to be too paranoid about security as I only intend on using my Pi on my home network, but if your Pi is going to be Internet-facing, you may want to read up elsewhere on securing your Pi.
Tonight, I was finally fed up with my Terminal window taking nearly 10 seconds to show the initial prompt. I regularly use Terminal to SSH into other computers and to commit and pull code changes in git repositories. The delay was annoying so I looked for help.
Luckily, other people on the Internet have noticed the same issue so it wasn’t hard to find a solution. The first one I came across was on this blog post on OSXDaily. Initially, I was a little skeptical of log files having anything to do with the Terminal startup time, but other Google results also came up with the same solution.
The solution is to remove the
*.asl (Apple System Log) files from the
/private/var/log/asl/ folder. The Terminal command to remove those log files is:
sudo rm -rf /private/var/log/asl/*.asl
This is obviously a short term solution, as new log files will presumably accumulate over time again. I found additional information on SuperUser and ProposedSolution that you can check out, if you are looking for a deeper explanation and/or a long-term solution.
Recently I’ve been needing an easy way to paste two versions of a text, and get the differences between the texts, specifically changes within a line (most diff programs only show which lines have changed). After some searching, DiffMerge came up as one of the best free diff programs that would work on the Mac. DiffMerge is great in many aspects, however, it lacked the interface to paste in text to diff right off the start.
I set out using Mac’s Automator tool to create an application to prompt the user for two texts, create the temporary files, then pass it into DiffMerge.
I came up with the following workflow:
- Get value of a pseudo-variable – random identifier
- Set the value of the random identifier into a variable so the same identifier can be referenced later (subsequent steps refer to this value as just the “identifier”)
- Ask for base text
- Store base text in a temporary file (using the identifier as part of the filename)
- Ask for new text
- Store new text in a temporary file (using the identifier as part of the filename)
- Get value of the identifier
- Run a custom shell script to open up diffmerge with the files created in the steps above. Passing in the identifier as an argument of the shell script allows us to figure out the name of the temporary files. The shell script also removes the temporary files when DiffMerge is closed.
The result was quite successful. Here is what DiffMerge looks like after pasting in two SQL dumps into the Automator application. Notice the temporary filename.
Many times, computers programs are born out of necessity to reduce repetitive or menial tasks. For Mac users, Automator’s a nifty tool that can help with that.
If you have used Automator for anything cool, let me know in the comments!
I regularly have to SSH into my servers, and on most of the ones I connect to the SSH server is running on a non-standard port for obvious security reasons. I used to include the port number manually in the SSH command, for example:
ssh seymour.dennistt.com -p 922
This worked… as long as I remembered to type the port number in, which was probably less than half the time on the first go. So I finally got tired of having to retype the command with the port number in it. Luckily you can create a SSH client configuration file which will remember this for you, and even give you a shortcut.
My old desktops run Lubuntu (Ubuntu but lightweight!) 11.10, which just became part of the official Ubuntu release. Life is a lot zippier in Lubuntu compared to Ubuntu when you’re on Pentium III and Celeron machines.
I wanted to be able to login to these computers remotely with a GUI, sort of like Microsoft’s Remote Desktop but Linux style. I didn’t want VNC because I wanted to be able to create a new login session instead of using the main console. Luckily XDMCP does exactly that and most of it is built into Ubuntu.
Following one question previously posted on AskUbuntu, I proceeded to add the following snippet to /etc/lightdm/lightdm.conf:
Then following the procedures posted by David Winter, I opened Terminal on my Mac, and typed in:
/usr/X11R6/bin/X -query 192.168.0.1 (replace 192.168.0.1 with the IP address of your Lubuntu computer). After a few moments the Ubuntu login screen showed up. Perfect!
I made myself an alias so that I wouldn’t have to remember the complicated command line. In ~/.bash_profile, I added:
alias xdmcp="/usr/X11R6/bin/X -query"
So now I can start a XDMCP session by typing in