As a distraction from all the Calculus I had to do this weekend, here is my weekend art project Super Mario Bros Blocks
Author: Chris Carey
-
Fixing TinyUmbrella 4.1.4 on Mac OS X Error
If you are having errors with TinyUmbrella on Mac OS X
Something is wrong:
You don’t have admin privileges or
You have something running on port 80 or
Your hosts file is not modifiable
Please check Anti-Virus software or shutdown Skype/Teamviewer/etc as these apps block access to port 80.Try this method:
[bash]
cd Umbrella.app/Contents/Resources/Java
sudo java -jar umbrella.jar
[/bash]The previous commands will run TinyUmbrella as root which is what the application is expecting.
Running the Umbrella.app by double-clicking it, or even via the Terminal with sudo open Umbrella.app, it will run the java app as the non-privileged user which is what is causing the error.
-
Tricking out your AppleTV running Linux
Upset that your old AppleTV is left in the dust following the release of the new $99 AppleTV? Get Linux installed on that thing, and make it useful again!
After getting Debian successfully installed on the AppleTV, I wondered exactly how many services can run on it without overloading it. So far, the following services are running:
- Netatalk / avahi-daemon
- Samba
- GKrellMd
- OpenVPN
- Apache 2 + PHP5
- Asterisk 1.6 + Cepstral TTS + Lobstertech VoiceChanger + PHPAGI
- ircd-hybrid – IRC Server
- Nagios 3 with ircd-hybrid integration
Netatalk / avahi-daemon
This allows the AppleTV to show up on the network as a Macintosh OS X shared drive. We could easily plug in a USB external drive and this extra drive would also be shared on the network. If you want more information on configuring Netatalk on Linux, check my earlier blog posts on the subject.
Samba
This allows the AppleTV to show up on the network as a Windows shared drive.
GKrellMd
My favorite little monitoring app for Gnome, GKrellM allows you to monitor the server in real time from a little desktop widget.
OpenVPN
A simple VPN server which allows you to tunnel home from work or coffee shops.
Apache 2 + PHP5
A standard Apache 2+PHP5 install is running on this machine. Here is a screenshot of the default page I created for it:
In order to conserve memory, decrease some Apache config values:
[code]
<IfModule mpm_prefork_module>
StartServers 1
MinSpareServers 1
MaxSpareServers 5
MaxClients 50
MaxRequestsPerChild 0
</IfModule>
[/code]WebDAV is enabled so I am able to quickly and easily edit this site using Coda.
Asterisk 1.6 + Cepstral TTS + Lobstertech VoiceChanger + PHPAGI
This AppleTV runs my VoIP phone server. Phone service is through Flowroute. If you call my phone number, it speaks out text to the caller using Cepstral TTS. Anyone placing calls using this phone system can spoof any outgoing number or change their voice with the help of the Lobstertech VoiceChanger module. Incoming spoofed CallerID numbers are “unmasked” and the true number is revealed. The main phone script is written with PHP code using PHPAGI. Surprisingly, the AppleTV CPU handles the Text to Speech very well and I don’t notice any CPU strain. Very flexible and fun phone system.
Here is a sample of what the code looks like:
[php]
function doMainMenu() {global $debug;
global $fh;
global $agi;$count = 0;
while ($count < 5) {
// Say Main Menu Script
$result = $agi->swift_get_data(‘Press 1 to ring the house phones or press 0 to leave a voice message.’);// Capture which keys were pressed
$keys = $result[‘result’];
$key = $keys[0];
if ($debug) fwrite($fh, "Key Press:[". $keys[‘data’] . "]\n");// Do something, based on which keys they pressed
if ($key == "1") doRingHousePhones();
elseif ($key == "0") doGoToVoicemail();
elseif ($key == "*") doLoginToVoicemail();
else {
$agi->swift("You didnt pick any options.");
}
$count++;
}$agi->swift("Goodbye.");
}
[/php]ircd-hybrid
The IRC server is used for Nagios 3 logging at the moment
Nagios 3 with ircd-hybrid integration
This is the newest addition, and a very sweet setup at that. Nagios 3 is an open source monitoring software. It monitors all of my equipment and servers and the services which are running on them. If CPU gets a little hot, or hard drive starts filling up, or website stops responding, it sends email/SMS notifications, and also sends a color coded notification to #nagios on the IRC server. Nagios uses Apache for the web front end.
General AppleTV tweaks
It turned out that the swap partition that I created was only 25MB or was only showing up as 25MB. This is a problem since this AppleTV only has 256MB of internal RAM. I ended up setting up a loopback swap file which basically allows you to have a ‘file’ on your main partition which will behave as a partition. This 512MB file is mounted as the swap for the system and is working perfectly.
[bash]
dd if=/dev/zero of=swapfile bs=1k seek=512k count=1
mkswap swapfile
losetup -f
losetup /dev/loop0 swapfile
swapon /dev/loop0
[/bash]You can verify that it worked with either of these:
[bash]
cat /proc/meminfo | grep -i swap
free
[/bash]Here is a screenshot of ‘top’ running on the AppleTV with all of these services running:
Check out the load average! This machine is simply kickin’ back!
If anyone is interested in more detail how any of these services are configured or if you have any suggestions on what other services should be added to this project, drop me a comment.
-
Running Debian on AppleTV
I decided to install the latest Debian to my old AppleTV in order to use it as a server in the house. It has 160GB hard drive, 256MB RAM and a 1GHz processor. I think it could work well for NAS and VPN.
I pulled the drive out of the AppleTV and hooked it up to my mac with a USB to IDE converter cable (All of this work is done on the Mac running Ubuntu under VMWare). It would be a little easier simply having a Linux machine handy. Then we wouldn’t have to deal with the virtual machine and host OS fighting for the USB devices. Anyway, you just need that AppleTV drive plugged into a Linux host to do these commands:
I used this method to prepare the drive:
http://code.google.com/p/atv-bootloader/wiki/PartitioningLinuxThen booted up a Debian installer with VMWare, and installed Debian to partition #4 on the drive with partition #5 as swap. Do NOT install GRUB to the MBR, the recovery files that are placed in the two AppleTV partitions will search for menu.lst and boot that grub. You may need to install (create) menu.lst by hand, especially if your particular distro uses GRUB2 like the latest version of Debian does.
Here is a copy of the /boot/grub/menu.lst which I created by hand:
[bash]
default 0
title DebianTV
root (hd0,3)
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/hda4 ro quiet processor.max_cstate=2
initrd /boot/initrd.img-2.6.26-2-686
boot
[/bash]After the OS install is finished, I sync and remove the drive from my Linux machine. Put the drive back in the AppleTV and booted it up. The AppleTV should boot straight to linux.
-
Netatalk with Debian or Ubuntu
By default, it is compiled without SSL support. Mac clients will not be able to connect. Here is how you get Netatalk working on Debian or Ubuntu the clean way, with custom compiled packages.
[bash]
apt-get source netatalk
apt-get install devscripts fakeroot libssl-dev cracklib2-dev
apt-get build-dep netatalk
cd netatalk-2.0.3
DEB_BUILD_OPTIONS=ssl debuild
dpkg -i ../netatalk*.deb
[/bash]If you get an error message about keysigning (when building), this command may help:
[bash]
DEB_BUILD_OPTIONS=ssl dpkg-buildpackage -us -uc
[/bash]http://www.blackmac.de/archives/58-Make-Netatalk-talk-to-Leopard-Mac-OS-X-10.5.html
-
UtahFM hits the App Store!
-
passfail.pl – Prevent password entry in IRSSI
Here is a little irssi script that will help prevent you entering your passwords into IRSSI
Click here to download the script: passfail.pl
Instructions are inside the file and below:
[perl]
use strict;
use Digest::MD5 qw(md5 md5_hex md5_base64);
use vars qw($VERSION %IRSSI);#——————————————————————————
# passfail.pl – Help prevent you entering your passwords into IRC by mistake
#
# Copyright (C) 2010 Christopher Carey
# http://chriscarey.com
#
#——————————————————————————
# INSTALL:
#
# Stick the script passfail.pl into your .irssi/scripts/ directory.
# Symlink it into the autorun directory so it will run every time the
# application starts.
#
# cp passfail.pl .irssi/scripts/
# cd .irssi/scripts/
# ln -s passfail.pl autorun/
#
#——————————————————————————
# USAGE:
#
# Passfail has three basic commands: add, remove, show, and clearall.
#
# /passfail add <password>
#
# The previous command will add the password into the list of protected words.
# That password, if entered in the chat window, will not be sent to channel.
#
# /passfail remove <password>
#
# The previous command will remove the password from the list of protected words.
# If you type the password, it will be sent to channel.
#
# /passfail show
#
# The previous command will show the saved password hashes
#
# /passfail clearall
#
# The previous command will clear the list of protected words (start over).
#
#——————————————————————————
#
# TESTING:
#
# Test and configure on the (status) window, and not in a channel with users in it!
#
#——————————————————————————
#
# OTHER NOTES:
#
# You can manually load or unload the script with the following commands:
#
# /script load passfail.pl
# /script unload passfail
#
#$VERSION = ‘20100804’;
%IRSSI = (
authors => ‘Chris Carey’,
contact => ‘chris@chriscarey.com’,
name => ‘passfail’,
description => ‘Prevent your password(s) from going over the wire accidentally’,
license => ‘BSD’,
url => ‘none’,
modules => ‘Digest::MD5’
);my @password_md5s;
sub settings_register () {
# register the irssi settings (with defaults)
Irssi::settings_add_str("passfail", "passfail_hashes", "");
}sub event_send_text () {
my ($line, $server_rec, $wi_item_rec) = @_;
# convert the input line to an array of strings
my @linearray = split(/ /, $line);
my @linearray_md5 = map { md5_hex($_) => $_ } @linearray;# md5_hex each of the linearray elements
my %linearray_md5 = ();
map { $linearray_md5{$_} = 1 } @linearray_md5;# compare each item in the array against the password hashes
my @intersection = grep { $linearray_md5{$_} } @password_md5s;
my $intersection_size = @intersection;# compare the input to the array of password hashes
if ($intersection_size gt 0) {
# user entered password
Irssi::print("passfail.pl blocking password entry");
} else {
# user did not enter password
return;
}
Irssi::signal_stop();
}sub display_hashes {
foreach(@password_md5s) {
Irssi::print($_);
}
}sub settings_load {
# convert the comma separated hash list into an array
@password_md5s = split(‘,’, Irssi::settings_get_str(‘passfail_hashes’));
Irssi::print(scalar(@password_md5s)." password(s) loaded");
}sub settings_save {
# convert the array to a comma seperated hash list and store it
my $hashes = join(‘,’, @password_md5s);
Irssi::settings_set_str(‘passfail_hashes’, $hashes);
Irssi::print(scalar(@password_md5s)." password(s) saved");
}sub cmd_passfail {
# user typed the command /passfailmy $usage = "/passfail [add|remove|show|clearall] <password>";
my ($arguments, $server, $witem) = @_;
my @foo = split(/ /, $arguments);
my $cmd = @foo[0];
my $pw = @foo[1];
my $pw_md5 = md5_hex($pw);# sanity check on inputs
if (!$arguments) {
Irssi::print($usage);
return;
}
if (length($cmd) eq 0 || length($pw eq 0)) {
Irssi::print($usage);
return;
}# switch based on which command was specified
if ($cmd eq "add") {
# add password
if (grep(/$pw_md5/, @password_md5s)) {
Irssi::print("Password already exists");
} else {
Irssi::print("Adding new password…");
push(@password_md5s, $pw_md5);
&settings_save();
}
} elsif ($cmd eq "remove") {
# remove password
Irssi::print("Removing password…");
@password_md5s = grep { $_ ne $pw_md5 } @password_md5s;
&settings_save();} elsif ($cmd eq "show") {
# display hashes
&display_hashes();} elsif ($cmd eq "clearall") {
# clear all passwords
Irssi::print("Clearing all passwords…");
splice(@password_md5s);
&settings_save();} else {
# invalid input, show usage
Irssi::print($usage);
}
}# program start
settings_register();
settings_load();
Irssi::signal_add_first(‘send text’, "event_send_text");
Irssi::command_bind("passfail", "cmd_passfail");[/perl]
-
Cydia crashing on launch. How to fix
Delete all files except ‘partial’ in /root/private/var/lib/apt/lists
Delete all files in /private/var/lib/dpkg/updates -
Wireless on Dell Mini 10v with Ubuntu 10.04 Netbook Remix
Here are the commands to get wireless working:
[bash]
#!/bin/bash
sudo aptitude update
sudo aptitude install bcmwl-kernel-source
[/bash] -
Slackers (2002)
My butt on the big screen in the feature film Slackers (2002)
I was able to be an extra in the feature film Slackers. Here I am, the only one in the shot riding a 36 inch Coker wheel. It was a lot of fun unicycling with the folks from Harvey Mudd College where a number of the people were other extras were from.