Life goes on.

Had a really nice day off. Jack and I put up a contest on Clocktower to come up with a design for a T-Shirt with the winner receiving a T-Shirt. We have only had a couple entries as of yet but they are looking promising. The contest duration is 3 weeks(from September 29th) followed by voting by our users on the CTG T-Shirt Design! I’m really excited about this. Apparently Justin has a neighbor that has access to all the equipment for silk screening and is willing to do the shirts for us. Here’s hoping it all goes to plan and we end up shipping a lucky winner a shirt in a month or so. Have a good one.

Working out

I guess I like to be absent quite often. Anyways, I’ve started working out been doing so for the last couple weeks. I feel good afterwards like I’m making a positive difference in my life. Starting out slow, some benching, curls, situps, squats general kind of stuff. I’ve been trying to do about everything I can with the equipment I have; a weight bench, ~100lbs in weights and 2 5KG dumbells. I’ll try to not make my next post so long after this one. Have a good one.

Own3d Live Check 2.0

When I was working on Clocktowergaming v2 I decided it was necessary to revamp the Own3d Live Check script I had written so it would use GD to generate the online/offline images.  This allows me to make the script generate different sized images based on the URI. I went with 3 different sized images, 115×30, 90×20 and 45×10.  The last image size is the same size as the images I used with the old script.  Anyways here is the code.

<?php
	//This script is designed to take a users own3d.tv user id and display their
	//status as online or offline as a PNG image drawn with GD.  The script takes
	//two inputs in the URI; stream and size.  Valid values for the stream variable
	//are the users own3d.tv user id number and values for size are small, medium and large.
	//examples include;
	//
	//livecheck.php?stream=38853&size=small will produce an online/offline for TheRainMan from solomid
	//as a 45x10 pixel image
	//
	//livecheck.php?stream=38728&size=large will produce an online/offline for saintvicious from clgaming
	//as a 115x30 pixel image

	//set header to read as a png image
	header('Content-Type: image/png');
	//set the uri to $myQryStr
	$myQryStr = $_SERVER['QUERY_STRING'];
	//parse the $myQryStr variable
	parse_str($myQryStr);
	//setting the url for the own3d status request
	$request =  'http://api.own3d.tv/liveCheck.php?live_id=';
	//setup the size of the image based on the $size parameter in the URI, also drawing a rectangle the size
	//of the image so the background will be transparent
	if ($size == medium) {
		$im = imagecreatetruecolor(90, 20);
		//set the image dimensions to a variable for the transparent rectangle
		$rx = 90;
		$ry = 20;
		//turn off alpha blending
		imagealphablending($im,false);
		//set the variable bgColor to transparent
		$bgColor = ImageColorAllocateAlpha($im, 255, 255, 255, 127);
		//fill the image with a transparent rectangle
		imagefilledrectangle($im, 0, 0 , $rx, $ry, $bgColor);
		//re-enable alpha blending
		imagealphablending($im, true);
		$fontsize = '13';
		$x = '9';
		$y = '16';
	} elseif ($size == large) {
		$im = imagecreatetruecolor(115, 30);
		$rx = 115;
		$ry = 30;
		imagealphablending($im,false);
		$bgColor = ImageColorAllocateAlpha($im, 255, 255, 255, 127);
		imagefilledrectangle($im, 0, 0 , $rx, $ry, $bgColor);
		imagealphablending($im, true);
		$fontsize = '16';
		$x = '10';
		$y = '20';
	} else {
		$im = imagecreatetruecolor(45, 10);
		$rx = 45;
		$ry = 10;
		imagealphablending($im,false);
		$bgColor = ImageColorAllocateAlpha($im, 255, 255, 255, 127);
		imagefilledrectangle($im, 0, 0 , $rx, $ry, $bgColor);
		imagealphablending($im, true);
		$fontsize = '7';
		$x = '3';
		$y = '9';
	}
	//setting more variables; colors, text, font
	$green = imagecolorallocate($im, 0, 204, 0);
	$red = imagecolorallocate($im, 255, 0, 0);
	$onlinetext = 'ONLINE';
	$offlinetext = 'OFFLINE';
	$font = '/arial.ttf';

	//curl session to grab the status from the own3d api
    $session = curl_init($request.$stream);
	curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($session);
    curl_close($session);

	//if statement to parse the status from the APIs response
	if (preg_match("/true/",$response, $result)) {
		//create the online image with GD

		imagettftext($im, $fontsize, 0, $x, $y, $green, $font, $onlinetext);

		imagealphablending($im, false);

		imagesavealpha($im, true);

		imagepng($im);

		imagedestroy($im);

	} else {
		//create the offline image with GD
		imagettftext($im, $fontsize, 0, $x, $y, $red, $font, $offlinetext);

		imagealphablending($im, false);

		imagesavealpha($im, true);

		imagepng($im);

		imagedestroy($im);
	}
?>

This script is a bit more complicated than the previous one so I tried to comment it as best as I could. The script basically does the same thing as the previous one, just with a few more options and I also got GD to output the image with a transparent background(you have no idea how much googling that took).  Feel free to use in your own projects, the only external file needed is a font which you can set where the script looks for the font by changing the $font variable.  Have a good one.

Automotive Maintenance and jobs FTW

The other day my friend Justin discovered he was barred from having a license and decided to let me use his car for the duration of his bar. Today after work I went to my local O’Reillys Auto Parts store and purchased a set of spark plugs, spark plug wires, set of headlights and a pair of battery terminals for his car. I also went to Wal-Mart and bought an oil change, an air filter, a radio wiring harness and mounting kit.  The factory radio that was in the car was an am/fm cassette player and the cassette player didn’t work so I couldn’t even use a tape adapter.  He and I installed these parts(except the oil change, too hot to be under the damn thing) and it made a pretty decent difference in the power and hopefully the fuel economy.    The sound is definitely better, yay for CD’s and aux in for my cell phone.  Always a good time working on a car with good friends.

Yesterday Justin and I went out applying for jobs.  I like my current job but it doesn’t provide me with enough hours, I’m looking more for something to supplement this job than replace it. We both applied at the Iowa State Fairgrounds for security during the fair, Justin however applied for that and general employment at the fairgrounds.  He also applied where I work.  After we went applying for jobs it was off to see his sister, fun times.

Y’all have a good night.

The Playstation 3

Sony’s Playstation 3 is an interesting piece of hardware. It has a fairly powerful processor called the Cell Broadband Engine, composed of a full fledged 3.2GHz PowerPC core and 7 SPE cores at 3.2 GHz.  The SPEs are not full fledged processors but can be programmed to do various tasks; model physics, run AI and so on. PS3s also contain 256MB of XDR DRAM, which is an evolution of Rambus’s RDRAM and 256MB of GDDR 3 for the “Reality Synthesizer” or RSX, a modified nVidia 7800GT.  All this power and its relegated to playing video games, until the security was broken.

The PS3 security was broken via the combined efforts of geohot and fail0verflow.  The break was the (pseudo)random number generator Sony used for the private encryption keys.  Knowing it was pseudo random the private keys were calculated and developers could sign their software so the PS3 thought it was a legitimate retail package.  Unfortunately for the Playstation 3 scene, the encryption keys are something Sony can change via a firmware update so the last exploitable firmware version is 3.55.

A couple of months ago I set out on a mission to acquire a Playstation 3 that was capable of running custom firmware.  It was kind of a pain to find a PS3 with Firmware 3.55 but I finally found one in a semi-local shop called Gamers.  $240 and 10 minutes later I had a proper PS3.  First thing I did was installed Kmeaw custom firmware.  This firmware has the ability to install signed and unsigned packages and run backup managers. It has other capability but nothing of real use to the normal user.  There are a few downsides to the custom firmware for the PS3. There is no Playstation Network access and a few newer games are signed with keys we don’t have.  For me this isn’t a real big deal, online play isn’t a deal breaker for me and I use it more for a media player.

One of the main reasons I actually wanted a PS3 other than a fun to hack was for a media player on my HDTV.  I bought a 36″ 1080i tube television from craigslist and didn’t have any way to play HD content on it.  The PS3 functions exceptionally well as a media player the only real draw back being that it doesn’t play MKV files.  You can get around this by running PS3 Media Server on your PC containing the media.

With the Playstation 3 being based on a PowerPC architecture there are distributions of Linux that are available for it.  Originally PS3s were able to run Linux out of the box until firmware 3.15 which removed the “OtherOS” ability because of security concerns.  Now a days with a custom firmware you can restore this lost functionality.  I didn’t choose to go the full route for OtherOS because some of the firmwares that are modified specifically to run OtherOS don’t have that great of game compatibility.  Instead I chose to use a homebrew package called BootOS which installs a bootloader on your Playstation 3 and when activated using the LV2 Patcher V9 you can install and run Linux on your PS3.  I installed Red Ribbon Linux Now I don’t really have much of a use for Linux on the PS3 at the moment as drivers for full RSX functionality haven’t been coded yet, but they are being worked on. For me the main point of installing Linux was just the geek/coolness factor.  That might change if drivers for the RSX are released as there is a PowerPC port of MythTV and I’d imagine it wouldn’t take much to port XBMC to PPC if there isn’t already one.

The Playstation 3 scene isn’t a very mature one yet although there has been some great progress in the year or so since the security was broken.  There are few groups working on new exploits to obtain the keys for the newer firmwares so new games can be played.  Another group is developing a firmware called JaiCrab DFW which is a custom firmware in the truest sense.  I’m not going to go into depth about what JaiCrab has to offer so click the link and find out.  Things are looking good for the informed Playstation 3 owner.

Well I’d like to hope this post has been informative, thanks for reading. Any thoughts or questions is what the comments section is for.

CTG v2

I accomplished quite a bit on Clocktower v2 yesterday.  I got the shout box fully implemented across the themes, added the team speak viewer to the side of the portal.  For your viewing pleasure is a gallery of the new website.  They are all in the proDark theme, because thats the one I like!

Work, Dreamhost and CTG

Dreamhost isn’t a bad webhost, but it does have its quirks.  For instance today Clocktower Gaming was down for approximately 35 minutes.  I hadn’t changed anything and it was throwing MySQL errors.  I was at work so I didn’t have the chance to put in a support ticket, but this isn’t the first time its happened.  Several times my websites will throw 500 Internal Server Errors and I can’t figure out why.  At first I thought maybe it was something I have done with the php for phpBB, but it started randomly throwing 500 errors on this blog and this is about as plain jane of a wordpress install as it gets.  Maybe I’ll put in a support ticket and see if they have some explanation of why we are getting random errors and such.

Work was interesting tonight, I don’t know if anyone that is reading this has worked in a real restaurant but it was only 100F on the line today. On Monday it was no less than 110F and was up to 115F at a couple times during mid day.  It was pretty busy, the other cook and I rocked out probably 150 meals tonight, went through a prime rib and a half(prime ribs are around 10-14 pounds and are cut into 10 or 12 oz portions) and a whole bag of chicken tenders(10 pounds of 2 ounce tenders). Our boss said we beat the projections for the day by over $200.  I usually enjoy a busy night, makes the workday go a little faster.

I’m probably going to work some more on Clocktower Gaming v2 tomorrow, hopefully get the Own3d live check I posted the 22nd implemented in the 5 themes I have setup.  I’ve actually been looking at another way of checking the status of a stream using jQuery.  It’ll probably be based on this guys work(Thanks the digital gods for the GPL).  I haven’t really looked into what all I can do using jQuery, but I think it’ll allow me to do more than just show the status.  I’m thinking it should allow me to maybe pop up a window displaying the users stream, display how many people are watching the stream that sort of stuff.  I suppose I’ll check into it tomorrow and figure it out.

Well its time to wrap this up, for those of you that are reading, thanks and good night.

Hello thar!

I’m anachr0n and this is my blog.  I’m 26 and I work at a diner as a line cook.  In my spare time I maintain Clocktower Gaming.  Things I enjoy include hacking consoles, tinkering with php, javascript and other web languages, working with my hands, and pretty much anything electronic.  I intend to use this blog to talk about day to day life and post some random bits of code I come up with generally for Clocktower.

The first thing I want to post is a php script I made to call Own3d’s servers using their api and return a users online/offline status as an image.

<?php
    header('Content-Type: image/jpeg');
    $myQryStr = $_SERVER['QUERY_STRING'];
    parse_str($myQryStr);
    $request =  'http://api.own3d.tv/liveCheck.php?live_id=';
    $onlinepath = 'online.jpg';
    $offlinepath = 'offline.jpg';
    $online = imagecreatefromjpeg($onlinepath);
    $offline = imagecreatefromjpeg($offlinepath);

    $session = curl_init($request.$stream);

    curl_setopt($session, CURLOPT_HEADER, false);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($session);
    curl_close($session);

    if (preg_match("/true/",$response, $result)) {
    	imagejpeg($online);
    } else {
    	imagejpeg($offline);
	}
?>

So this isn’t a very complicated script.  In the same directory as the script you need to have an online/offline image set or you can edit the $onlinepath and $offlinepath to where you want the images.  You can call it just like a normal image, just append the users own3d id at the end of the url(ex <img src=”livecheck.php?stream=12345″>). I suppose I could have gotten fancier and just used GD to draw online/offline images but I’m lazy.

League of Legends & Crowd control

Last night a couple of friends and I played some LoL, and our team composition was extremely CC heavy. I played as Udyr, and my team mates were Alistar and Blitzcrank.  It was pretty much infinistun. Blitz would pull one and pop, I’d come in and stun and then Ali would pop and head butt them away from their team.  From there we could just pick apart the rest of their team.  It was fantastic.  Remember friends, clense or Quick Silver Sash is your friend.