Friday, March 17, 2006

William Orbit - Hello Waveforms

Holy crap is this CD good. Unbelieveable.

This thing fits a niche in my music taste that's been empty for so long I'd forgotten about it.

Electronic/Jazz/Techno sweetness.

Benny Benassi - Hypnotica

I picked Hypnotica earlier today.

Even though I only paid $10 for it, I feel like I should have paid a quarter of that.

Only because half the songs sounded exactly like the other half.

And all the songs were twice as long as they should have been.

BURN! (I guess... It's really just sad.)

Check your balance from your phone!

So I'd been thinking about this one for a while and when I finally got around to doing it, it was easier than I thought.

Being the linux head that I am, I already had the scripts to accomplish most of what I needed, so a short script later I could check my bank account from my phone!

1. The basic idea is that you notify your computer via e-mail that you would like your bank balance.
2. Your computer checks its e-mail every minute or so, and catches your request.
3. Your computer logs into your banking site, and finds your balance.
4. Your computer SMS's your balance to your phone, and goes back to sleep.

Hokai! So! Here's the earth... First you need to get a free pop3 mailbox for your linux box. I used fetchmail because it's fucking easy to set up. If you get a pop3 account that doesn't require SSL encryption it's even easier to set up. But be mindful of what data you send over your phone and e-mail... The other easy part of this is that you don't have to set up sendmail or postfix, since you're only picking up the mail from your pop3 account, not sending. We're using google's SMS engine for that!

I'm using washington mutual who has a pretty good (and VERY up-to-date) website which displays my account info on the first page after logging in (good cuz I'm lazy!).

First lets make the mailwatcher:
$diff=`diff /var/spool/mail/username mailtemp.dat`;
@diff=split(/n/, $diff);
if(@diff[3]!~/^>/ && $diff=~/e-mailaddy/ && $diff=~/wamu/i){
print "$datetsending balance!n";
`cat /var/spool/mail/username > mailtemp.dat`;
`sleep 1m`;

Since I don't know an easy way to read mail besides reading it off of the /var/spool/mail/user I just make a new copy of it each minute so I can only look at the newest e-mails, and it doesn't get activated off of old e-mails. It compairs the new mail to the mail it just gathered from the same place a minute before (~/mailtemp.dat). The diff command will show only the different lines which will show either how the new mail file has more than the old mail file, how the new mail file has been emptied and the old one has more, or that they're the same. I check the beginning of one of the lines to make sure the diff output doesn't have a ">" in the beginning to keep from picking up the old requests when the new mail is emptied. It also makes sure the output has your cell phone's e-mail address in it (represented by e-mailaddy), and looks for the keyword in the output (in my case the keyword is wamu (case-insensitive)).

If those conditions are met, then it runs
curl -s --connect-timeout 15 -m 45 --insecure -L -c cook(cont)
ies -v -d "txtUserID=username&pwdPas(cont)
2.y=0" "
ntityManagement/postlogon.hdlr" 2> /dev/n(cont)
ull > balance.out;
/home/username/ balance.out;
shred balance.out cookies;

Please note that the first 7 lines are all one line. There are no trailing spaces, so you can just delete "(cont)" until the next line rejoins the former. Right, so we're using curl to send post data that logs you into the site, then follows the redirects, and spits out the webpage to balance.out. The website is then parsed by
my $file=shift;
my $html=`cat $file`;
@html=split('<tr', $html);
`curl -s '

Hokai, so you pick up the file, and split it by the table row tags, then grab the portion you want (in this case the third section (remember that's number 2)), then locate the unique tags around your account balance (in this case the "nobr" tags), then I use a simple http GET request sent to google's SMS function to send the balance to your phone (phonenumber) via SMS.

Computers aren't toys...

It annoys me when people treat their computers like toys. Little is more trivial to me than to hear about the new mouse you just bought, and how high your resolution can go. I equate it to "ricing out" a honda. It's pointless. It's stupid to spend so much money making your computer top-of-the-line, when it's only so you can play games on it. Wow, you've got a 3.7 Ghz processor? Who gives a shit. I guarantee 99.99% of all the cycles your computer will be able to complete in its lifetime will be completely and utterly wasted. Useless, pointless diversions that simply mock the power and ability your computer had before these silly "upgrades." There are two things driving the Ghz race: Games, and bloatware (though it should be noted the two are not too dissimilar). Somehow these games we played years ago looked awesome, and today you really need more fps than your eyes can see? And bigger and even more bloated environments so you can look at all the pretty pictures and forget that the gameplay sucks? Shitty games aside, how foolish to use a computer's incredible functionality for simple diversions.

Perhaps it's the staggering functionality that a computer has daunts people to the point that they have no idea what to do with it. (nah, they just want their porn)

With a little bit of programming skill you can make your computer do many things, but if you combine your computer's information processing power with a limitless supply of information (the eeenternet) there really is little that can't be accomplished! To quote Dane Cook, "Dream it, you fucking dreamers!" To use such information processing power for such insignificant tasks should be a crime. Sure I don't mind games, but I also appreciate the computer for its abilities and recognize that any upgrade that only adds speed is weak sauce.

I remember back in the day, my franken-linux box with the 500 Mhz processor and 512 megs of RAM would kill our $30,000+ network in a heartbeat (when powered with linux of course! Just the thought of a 500 running XP makes me want to pull my teeth out with a claw hammer).

The power is there to be used well, not so programmers can do a shitty job of making their apps and just raise the hardware requirements. Weak programmers rely on the brute force processing power to accomplish their tasks in a tolerable amount of time. Good programmers would be able to make their app work on half the hardware.

Your computer can do so much more for you than you think.

Tuesday, March 07, 2006

Don't leave your console unlocked!

Aaaah the console. So raw and powerful. I use it so heavily that I usually get a little bothered by leaving it open when I leave my computer momentarily. I'm not one of those SUDO freaks or "su -c" nazis, so I usually have one of my consoles open as root, or in some cases the scripts I run need to be root, and I don't want to have to worry about changing tail to /sbin/tail for every script I want to write! But, in the immortal words of uncle ben (the spiderman one, not the rice one) with groot power comes great rootsponsability. So leaving an ssh session or a terminal open as root unattended doesn't seem like the smartest thing to do. But the problem is that if you log out (especially in an ssh session) you have to log back in and reestablish the connection before you can continue work.

Enter vlock

vlock will lock out your console and require you to enter either the password of the user logged in, or the root password. Nice, eh? Well, NICE but not particularly pretty...

Enter cmatrix

Yes, a matrix screensaver for your console. Kick ass? Yes. I use 'cmatrix -a -b -u 5' it kicks ass. But if only you could make it a password protected console screensaver...

Enter ; (semi-colon)

By simply adding the alias:
alias 'lock'='cmatrix -a -b -u 5; vlock'

You've got yourself a fully functional password protected console screensaver! Now you're not only secure, you look cool doing it. You can tell all your friends that not only have you found the matrix, you're viewing it over an encrypted SSH tunnel!

Well, now you can leave that terminal open as root, and not worry about who may be taking advantage of it while you're away. Now the tough stuff; how to deal with people asking you what that matrix-y thing is on your screen. You can say you've encrypted your session and that if they look at it funny it will "hack the mainframe" and "port the phone" to call the FBI. Then for effect you can throw some more threatening jargon at them, and hold your coat open to appear larger and repeat the jargon loudly to scare off the lesser user sniffing around your claim...

Sigh. Gone are the days when someone would ask you what you did, you could simply answer "computer stuff," now they're much more "savvy" and prod for further information. I don't like telling people I'm a hacker of any sort because they don't understand my skillset and the knowledge I have. It's your standard "I don't understand anything about what you do except what I read about in the paper" effect, people are dubious about trusting someone who knows more about something than they do; especially when it involves "hacking the internets" Doubleplussigh...

Friday, March 03, 2006

How I Learned to Stop Worrying and Love VNC

We didn't used to have the tools we use for remote desktop management. We used to use VNC. Dun Dun DUNNN! If you're from the linux community you're probably wondering what the big deal is. But if you've used VNC on windows for remote support you'll remember out-of-sync cursors, long delays, and "painting" the screen with your mouse. Man that stuff was frustrating.

When I found VNC was originally a Linux tool, I wasn't surprised. It meant windows VNC was FAR from optimized, and was probably being weighed down with bulky windows BS resulting in the piss-poor performance. I did a little looking around, and found a comment that VNC for Linux was like RDP for Windows in regard to speed and functionality. I was extremely skeptical.

Since I got into linux I never saw the need to use VNC (and I probably would have avoided it like the plague even if I had the need), I used my crappy KVM that worked great if the boxes were turned off, and the KVM was turned off and on, then the boxes were turned on. So for a while things in KVM land were great. Until someone kicked the surge suppressor that powered the KVM and it got out of sync again. Not wanting to reboot my linux box (uptime 141 days and counting) I roughed it, and instead of getting to switch to the box on the first try it would take quite a few tires. But since I didn't switch that much (and REALLY didn't want to have to reboot) I worked through it. Well recently my keyboard cable became loose from the kvm, resulting in me having to go to the back of the PC and unplug and replug the keyboard ps/2 plug after every switch. So, stubbornly, I stayed on the linux box for a few days, then had to go to the windows box for a few more days, and finally got fed up with it. I typed vncserver -name omgwtfbbq -geometry 1280x1024 and picked up a VNC client. I connected and saw it moving quickly, but that was just running X. I reset it to open GNOME and was amazed. It was responsive, there was no painting, and the delay was almost undetectable! Deciding to test the ultimate I opened a video off google video... lossless. Smooth, and beautiful, and over fucking VNC! Heaven.

I was (and still am) ecstatic. VNC doesn't suck, Windows just makes it suck!

Add SMS to your scripts
One line

The phone number must be US with the area code, (555) 555-5555 should be 5555555555 in the URL.
The carrier is the provider, sprint, cingular, etc. Enter it in all caps.
The message must have spaces seperated by "+" and non-letter characters printed as their hex equivalent.
omg my computer is talking to me!
Would be:

One Line

If you want to tie it into a script just cURL it or get() it, and send off your message! I'd even recommend using to shorten specific messages to make the procesing easier.

Oh yeah, were I so inclined I'd post the tinyurl to message obscene things to Jack "Sue it if it moves" Thompson. Fortunately for him, I am not. Though I wouldn't mind it.

OC Asylum, and getting plastered.

A friend of mine is opening up a paintball park called the OC Asylum in Anaheim. I helped them open it up two weeks ago, and we got to play there for a bit a week ago. It's an outdoor, astroturfed, netted soccer field converted to one big airball field (with extra netting of course). After we played (awesome) we went to my friends place to watch movies, drink and hang out. On the way home I saw more cops and more cops pulling people over than I'd seen in about a month. When we got to my friend's place, I prefaced the evening with "I hope you're all comfortable, because the city is crawling with cops, and no one's going anywhere without getting pulled over..." Aaaand so, free to drink it up, knowing we'd be staying over for the night, we proceded to... well, drink up.

We started around 10ish, and by 11:30, we were gone. Not "buzzed" or "interesting" or "drunk" but about as gone as you can be without falling over and vomiting on yourself. It was the drunkest I'd ever been, and it was fun because it was with friends.

The next morning we drove home (sober) and slept until 1pm. It was fun, but I'm not much of a drinker, and couldn't help think it was a bit excessive. In the future I'd think twice before doing it again, but I think I still would (with friends).

That evening we were talking about drinking, and after some thought I found that I don't agree with the idea of "unwinding" with a beer every day after work. Once in a while is one thing, but every day is another. Unwind with some hot cocoa or tea, just don't grow to depend on that slight buzz to get you relaxed for bed.

Traffic school tomorrow

Bugger. I was supposed to have traffic school two weeks ago, but they misscheduled me (and about 5 other people). We all called right then at the same time so they were sure they made the problem. The dude on the phone actually implied that I copied the location down incorrectly. "Well, when our people enter the code, the location automatically comes up, so it would have been hard to tell you the wrong spot." "And yet here I am... Look, no matter how hard it was for your people to tell me the wrong spot, I still wound up writing down the wrong spot while I had the person on the phone. The likelyhood of the person on the phone telling me my code, me repeating it and writing it down, then the person telling me Anaheim, and me repeating it and writing down Westminster is quite slim." So they rescheduled me and the others to tomorrow at Westminster. I must say, I haven't felt discomfort at anything like I have this traffic school for a long time. I've looked forward to teeth-pullings more than I look forward to traffic school. I suppose the more terrible I convince myself it will be, the less likely it will be able to be that terrible. It's a good thing. I'm just suprised at myself for being so fervently negative about this. I don't think I was innocent, and I don't think I should get out of my punishment, but I just really really don't want to go. Bah. I just have an odd feeling about it. I'm sure it will be fine.

Drawing is cool

(keeping with my poor title selection)
I've been making an effort to draw more for about a month, but I've actually started drawing more since two days ago. It feels good to see what I can do. I'm *yet again* reminded of the power and control I have over the Fisher Space Pen, my drawing impliment of choice. I'd recommend to anyone who sketches in pencil to try the space pen, they're available at office supply stores all over. I've owned 7 I think. Anyways, I've got a few sketches I quite like, and I'd quite like to post them on here. Just gotta pick up a scanner, or mooch usage off my sister's scanner or the one at work.

I found that if I though about drawing enough, I'd get an image stuck in my head of something that would be awesome to draw. It's incredibly cathartic to actually capture it on paper.

Fear not citizens; pictures shall follow!

Linux is cool

You know what my one-liner is called? An active blocking, intrusion preventing, adaptive firewall. Rather, that's what it's called when it's stuck inside a fancy looking piece of network hardware and charge thousands of dollars for it. It amazes me that people really don't seem to grasp that Linux can do pretty much anything you want. A bit ago the company was looking at these "tunneling" boxes; expensive hardware which allows encrypted access to the network with a very light client. I, of course, knew BS when I saw it, and about an hour later had the ssh server available to the world, and a document on establishing a port-forwarding puTTY (SSH) tunnel. You connect via puTTY, log in, and then RDP to localhost:forwardedport to get to the terminal server, or set your mail server to localhost:forwardedport to use your outlook when away from the office, all encrypted though an SSH tunnel, all with existing technology, on existing hardware, and freely available software. Beautiful.

(man, that was a terrible title)

awk '/Failed password/ {if ($9=="invalid") print $13; else print $11}'
/var/log/secure|cut -b 8-|sort|uniq -c|sort -nr|awk '{if ($1>10) print $2}'|
xargs -i iptables -A INPUT -s {} -j DROP

(all one line)

Read the security logs, find IPs with more than 10 failed login attempts, and drop all future traffic from the punkasses!

Man I love iptables. I spent such a long time avoiding learning them because I had a perception that they were complex. They're bloody easy!


Renewed exaspiration at existencial junk.
...Just kidding.
I've decided that being prepaired (with tools) doesn't necessarily mean carrying everything you could possibly need around. Why carry tools around when you can simply make them more available? The 99 cent store has pocket knives and multi tools, flashlights, LEDs, etc. all for 99 cents. Sure they're crap, but a crappy tool in the hand is worth two awesome ones at home... Anyways, buy 3 sets of tools and keep the sets at home, in the car, and at work. You don't have to carry all of it around, but it's still readily available if you forget what you usually carry.

I seem to be getting tired of my music. What I usually listen to isn't affecting me as it used to. Truthfully, though, I haven't been giving it the undevided attention it problably deserves. I need to devote some time to it.

Every once in a while I really just step back and marvel at all the functionality linux has. I learned by messing around with Macromedia flash that powerful tool sare hard to control (read the "hole hog" section of "in the beginning there was the command line"). I was reading the steps involved in moving a shape across teh screen and was simply dumbfounded at how complex they seemed to make this simple task. After learning more I realized that this program was capable of very complex actions and activities, and that with out those complexities it would be a simple tool with simple functions. The exact same can be said about Linux. if you can dream it, you can do it. It may take some research and learning to accomplish it, but it can be done. This is where Lunux/Unix deviates from other OS's on a philisophical level. Ease of use comes at the cost of function. I wrote a one-line bash script that parsed the ssecurity logs, found IPs that had more than 10 failed login attempts, and blocked them. Doing something similar in windows would be extremely difficult, and require substantial programming prowess. Yet Linux/Unix has these small, single-function tools ready for use, and provides a means for combining them to increase their abilities. Macs are like shopping at Target for furniture; you have a selection of furniture ready made and functional. Windows is like shopping at Ikea for furniture; you may have to work to get it functional, but it's not really that hard (plus more selection). Linux is like being handed tools and pointed at a tree. It takes skills and knowledge to get your furniture, but you have the option of making whatever you want, however you want, from beginning to end.

There are countless projects that attempt to make Linux more user-friendly, but it's not in Linux's nature to be that way. So they will always fail on some level, to some degree. A tiger doesn't change its stripes. Especially when it's been bred to be a tiger's tiger.