Archive for the ‘Computer’ Category

WiFi and can I haz?

So, at an undisclosed location, we are attempting to get internet at two locations without paying for two connections. Location one is at the lowest elevation. Location two is higher, but about 700-800 feet away.  In the middle is a building, higher than both with clear line of sight to both.

Stage 1; We has DSLs.

At location one, we have a DSL circuit. Originally, this was just a DSL modem with no Wi-Fi at all.

DIY WIFI ReflectorsDIY Reflectors

I already had an integrated DSL/WiFi AP/Router deal that I had gotten for free from AT&T/SBC when I lived in Houston. I had been trying to figure out something useful to do with it for months; alas I had not arrived at a productive endeavor.

We swapped the DSL modem for this, and after spending some time on hold with Windstream, we were able to get the correct usernames and passwords, and we were good to go.  I was relieved, as Alltel (the company Windstream used to be known as) and Bellsouth (now AT&T) used to use different provisioning, and the Bellsouth modems weren’t always configurable.  (PPPoA vs PPPoE and different VPI/VCI settings)

With that working, and the WiFi AP on the closest end of the house to where we wanted to be, we moved on to stage 2 of our cunning plan.

Stage 2; or We setup the fails.

Stage 2 involved rounding up all the available linksys hardware we had stolen, borrowed, replaced, mis-placed and broken.  We came up with 2 WRT54 (one v6 and one v8) and my original BEFW11S4 . So armed with these, we flashed both of the WRT’s to DD-WRT for maximum flexibility. The BEFW is not compatible and as such is just stock as God intended it to be. We configured the first WRT as a repeater bridge and placed it in the furthermost window of the middle building. We tried to get signal from location 1. No dice. As it was now dark, we concluded the evening.

On day two, armed with cardboard, a razor blade, packing tape and some aluminum foil; we exploited a reflector template found on the internet. I made some very crude reflectors and we installed them, and was able to get about a 13-17% signal from location 1. This is from approximately 450 feet.  The 2wire DSL modem has no external antennas,  and we didn’t want to kill the signal inside the building, so we couldn’t put any sort of reflector on it.

With the ability to sometimes access the internet over the link, we moved on. We placed the BEFW11S4 router at the other end of the middle building closest to location 2. We disabled the DHCP server on this unit, and basically disabled the router part, and had it just act as a WAP.  This unit was connected via ethernet to the WRT box.

Stage 3; Marginal Hacks and Me!

With this in hand, we head back to location 2, and found that we could access the wireless signal of the BEFW11S4 pretty well, but it wasn’t strong throughout the building. Still armed with the 2nd WRT, we configured it as a repeater bridge, having it connect to the BEFW11S4 and rebroadcast the signal through out the house. This works pretty well. Again, the signal from building to building is somewhat low, but we may implement some sort of reflectors there.  This shot is only about 200 feet or so, but we have some limited tree coverage and other factors.

Stage 4; The future!

The remaining issue is to improve out long haul connectivity back to location one. Pictured above is the 2nd rendition of the reflectors, created with some heavier gauge sheet metal, and cardboard templates. These templates are more accurate than the first version, and will hopefully give us a bit better signal to location 1.  If not, I am considering doing a Helix style directional antenna or something similar.

Stay tuned for more updates on this.

Funny stuff

Got this voice mail the other day from Fox. While the message itself is mildly humorous, Google’s transcription of the message is epically bad. I actually donated the message to Google so they could use it to improve. No, really I did.

Here’s the message.

Here’s the transcript. I was really hoping the embed feature would have the transcript in it, so it would highlight as it plays.. but no such luck. You’ll just have to imagine it.

WTF

LOL.

Rate me, bitches!

You know at the bottom of those emails from your tech support people, where it asks you to take a survey and you might win something? Yeah, they use those ratings for something. I wrote a little script so I could cut and paste my most recent ratings and see my average.  We’re expected to stay above a 9.0. I’m just on the edge. I got rep bombed with some 1′s. :(

 $ ./rate.pl -n
Sean's Hack-O-Matic Rating Hack! HUZZAH!
#       Rating  Total   Avg
========================================
1:      10      10      10.00
2:      10      20      10.00
3:      10      30      10.00
4:      10      40      10.00
5:      9       49      9.80
6:      1       50      8.33
7:      10      60      8.57
8:      10      70      8.75
9:      9       79      8.78
10:     1       80      8.00
11:     9       89      8.09
12:     10      99      8.25
13:     10      109     8.38
14:     8       117     8.36
15:     10      127     8.47
16:     10      137     8.56
17:     10      147     8.65
18:     9       156     8.67
19:     9       165     8.68
20:     10      175     8.75
21:     10      185     8.81
22:     10      195     8.86
23:     5       200     8.70
24:     10      210     8.75
25:     8       218     8.72
26:     10      228     8.77
27:     10      238     8.81
28:     10      248     8.86
29:     10      258     8.90
30:     9       267     8.90
31:     8       275     8.87
32:     10      285     8.91
33:     10      295     8.94
34:     10      305     8.97
35:     10      315     9.00
36:     10      325     9.03
37:     10      335     9.05
38:     10      345     9.08
39:     10      355     9.10
40:     10      365     9.12
41:     4       369     9.00
42:     10      379     9.02
43:     10      389     9.05
44:     10      399     9.07
45:     5       404     8.98
46:     10      414     9.00
47:     10      424     9.02
48:     10      434     9.04
49:     6       440     8.98
50:     8       448     8.96
51:     10      458     8.98
Rating Average: 8.98

Here’s the code, just for those who are curious:

#!/usr/bin/perl

use Getopt::Std;
getopts('hn');

if ($opt_n) { $nolog = 1; }
if ($opt_h) { print "USAGE: $0 [-n]\n\t-n = no logging\n"; exit; }

# Eat it, Yoshi!
@ratings = `cat ./rate.txt`;
$history = "history.txt";
# Setup variables
$total = 0;
$rate_total = 0;

print "Sean's Hack-O-Matic Rating Hack! HUZZAH!\n";
print "#\tRating\tTotal\tAvg\n";
print "========================================\n";

foreach $line (@ratings)
{
        chomp $line;

        # If a blank line or a comment (#) skip the line
        if ($line eq "" || substr($line,0,1) eq "#") { $currentline++; next; }

        # DURTY DURTY
        ($spam, $ham) = split/Rating: /,$line;
        ($rating, $spam) = split/\]/,$ham;

        # NO NUMBER? NO CARE!
        if (!$rating) { next; }

        # If ticket had multiple ratings, let's not cheat ourselves. Conquer and divide... (and average!)
        if ($rating =~ ",") {

                @multirating = split/\,/,$rating;
                foreach $mr (@multirating) {
                        # For each rating, you need to increment your count to keep the average correct.
                        $total++;
                        # Add the new to the existing
                        $rate_total = $rate_total + $mr;
                        $current_average = sprintf("%.2f",$rate_total / $total);
                        print "$total:\t$mr\t$rate_total\t$current_average\n";
                }

        } else {
                # Incremement for the average.
                $total++;
                # Add the new to the existing
                $rate_total = $rate_total + $rating;
                $current_average = sprintf("%.2f",$rate_total / $total);
                print "$total:\t$rating\t$rate_total\t$current_average\n";
        }
}

# Average the totals, round to 2 decimal places
$avg = sprintf("%.2f",$rate_total / $total);

print "Rating Average: $avg\n";

# Log it for historical tracking.
if ($nolog) {
        print "Logging disabled\n";
} else {
        &HistoryLog("$avg");
}

sub HistoryLog
{
    my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

    open (LOGFILE, ">>$history");

    printf LOGFILE "%02d/%02d/%04d %02d:%02d:%02d => %s\n",
    $mon+1, $mday, $year+1900, $hour, $min, $sec, $_[0];

    close(LOGFILE);
}

Nerds at play, disregard.

Saving this for later.. read part of this, and it seems interesting, but I have no time for jibber jabber, and work is calling my name, so I’m using this as my bookmark.

It’s Orgasmatron 5.1: The Ultimate Asterisk Kitchen Sink

Asterisk + Google Voice + A whole bunch of other stuff. May be useful in my quest for global domination.

Edit: and while i’m here, I found this in a google search for a cheat command to update all the SERIAL numbers in my DNS zone files..

http://www.commandlinefu.com/

The command, by the way is:

sed -i ‘s/20[0-1][0-9]\{7\}/’`date +%Y%m%d%I`’/g’ *

Exit, stage left..

We’re about 2 weeks away from my “not so triumphant” departure from Texas. I gave notice at my job yesterday, and I was worried that they might not even accept it, telling me instead to “holla back.”

So when I arrived today and my supervisor said he wanted to speak to me before I even clocked in, I got a little nervous. However, he just wanted to know if there was anything the company could do to keep me there, etc. It was nice change of pace. I apologized and politely declined. Later, the evening supervisor asked me similar questions.

It’s nice to feel appreciated, especially in a company where you feel like you can just get lost. (See my last post where I said that no one would notice if I didn’t show up.)

So anyway, yeah..

Tonight I have begun migrating the server that hosts this site among others to a new IP address. This is more fun than I care to mention. I think I will skip it, as my wrists hurt.. I have been ignoring my RSI, and I will pay for it, I’m sure.

Frontpage can DIAF.

If you are still using Frontpage in 2010, please set your computer on fire. Seriously.

All day, people email in with problems with Frontpage Extensions under cPanel.. they have no idea that this support is largely a hack. They don’t know that we are praying for it to be removed in the next version.

The fact of the matter is, the functionality barely works, and our troubleshooting is limited to remove and reinstall. Most of the time we get lucky and this works.

Sometimes, not so much. Frontpage Extensions haven’t been updated since 2002. There’s a reason for this, and it’s not because Microsoft got it perfect. Just sayin’.

OMG WALL HAX

So, I was trying to figure out who filled up /home today. Believe it or not, running `du -h –max-depth=1` on a 1TB drive under heavy use takes a while. Luckily, on a cPanel server, there is a .ftpquota file in each user’s home directory. This is not updated in real time, but it’s generally close enough.  So I cheated and wrote this little hack.

#!/usr/bin/perl
@files = `ls /var/cpanel/users`;
foreach $user (@files) {
        chomp $user;
        $quotafile = "/home/$user/.ftpquota";
        if (-e $quotafile) {
                $quota = `cat $quotafile`;
                chomp $quota;
                ($spam, $ham) = split/ /,$quota;
                $gb = sprintf("%.2f",$ham / 1024 / 1024 / 1024);
                if ($gb < 1) { next; }
                print "$user: $gb\n";
        }
}

Let me know if you’ve got a better way to do this.  I’m interested to learn new dirty hacks.

Oh, and by the way, one user was consuming 863GB.

WordPress htaccess and password protected directories..

This is a response i sent to a customer.

Hello,

The solution to this problem is multi-layered.

First, edit /home/xxxx/public_html/.htaccess, and make the Rewrite Rules look like such. You’ll see the addition below RewriteBase.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/secure/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Save this.

Then, in /home/xxxx/public_html/secure/.htaccess, add the following line.

ErrorDocument 401 /401.html

Save this as well.

Finally, in /home/xxxx/public_html/, create 401.html. It can be blank for this to work, but it’s recommend you put something in there as good practice..

Something like this:

<html>
<head>
<title>AUTHENTICATION REQUIRED</title>
</head>
<body>
<h1>AUTHENTICATION REQUIRED</h1>
<p>If you have been granted access, please login with your supplied credentials.</p>
</body>
</html>

Also, make sure your directories are set 755, and not 777.

Please let us know if we can further assist.