Thursday, July 27, 2017

Old Tech: Powerbook 520C

So I found this amazing piece of technology and decided to see if it still worked... and it did! It's from 1994, which means I was four years old when someone bought this. The battery has long since swollen, but the rest appears to be in great condition. Although, there is some fading on the bottom left corner.


Check it out, there's a floppy drive! I knew I kept my floppy disks around for a reason.


I can identify a SCSI, headphone, and microphone port, I assume the one left to the SCSI is some kind of a display port, but this is something I think I need a manual for.


A nice swollen battery.


Some stickers for accessibility I assume. Regardless, this thing looks cool.


So you remember when the Apple logo was a rainbow? I do. I was a little kid at the time and disliked those computers being called Macintosh because I don't like mcintosh apples. I prefer golden delicious or honey crisp.


And here is video proof it works! Enjoy the background talk. I wanted to include all the wonderful noises and clicks from the good old days.



I hope someone enjoys this. I did, seeing stuff almost as old as I am in action is interesting to me.

Saturday, July 22, 2017

Tic-Tac-Toe Haskell with Rule-Based AI

So recently I wanted to get back into programming, so I decided to dive in head first with Haskell, as it is one of my favorite languages. The aesthetic of the code with the style works great for me most of the time. After about four projects, I ran out of ideas. There was the obvious "Hello, world!", fibonacci sequence, quick sort, and a binary tree search. While these seemed great, they had no real immediate practical use for me to interact with. So I decided I should make a game. But what game would have seemingly simple enough rules to make a computer based player? Well, my two choices are Blackjack and Tic-Tac-Toe. Now Blackjack is super simple when it comes to a computer looking in, just statistics and seeing who's got the better hand. So Tic-Tac-Toe was the winner.

Now when a game of Tic-Tac-Toe is played perfectly, it's always a draw. Not necessarily fun for people to play, however it's good to know that if I get it perfectly that there is an expected outcome. With that in mind, I set out on my journey and created this monstrosity.

I chose to do rule based analysis simply because I wanted to break down the logic that way. Other methods I read about used minmax, which uses heuristics. My concern was if I mapped out every possibility as a means to the end, it's just simply path finding. I may try to adapt the rules to something a bit closer to real AI at some point in the future.

The way the rule based decisions work are as follows:
  1. Check for a move that it can win
  2. Check for any opponent wins to block
  3. If the center is available, take it
  4. If the center is taken, use the edges, otherwise use the corners
Now if we were to swap the roles, the rule for three and four would probably be different. I just haven't taken the time to work that out because it seemed like more effort than I wanted to do right now. For now, this is it.

Thursday, July 6, 2017

ChocolateyGUI Invalid Path with OneGet

So recently while browsing around some stuff about about Windows 10, I found out about OneGet. This is a package manager manager in Powershell. I think this could be super useful. So one of the package managers I added was Chocolatey. I also wanted to install the GUI for I figure it may be easier to browse packages that way. Upon installation and execution, I got met with a huge error screen along the lines of:

System.IO.InvalidDataException: invalid Chocolatey Path. Check that chocolateyInstall is correct in the app.config

So on and so fourth. After reading through the git page on this error and taking some time to consider the confusion around "how did you install chocolatey?" I realized that specifically it's not actually installed when you just add it to OneGet. So here's the fix. After you add chocolatey, you need to INSTALL it. Just like this:

Install-Package chocolatey

After that, it should run without a hitch. Hope this helps someone out there. Package managers are great, aren't they?

Sunday, May 14, 2017

Kali Live with Persistence and Updating

So recently I was trying to set up Kali Linux on a live USB fully updated. I kept running into a few problems with it that ultimately are based on how the instructions online are worded. After modifying the steps, I managed to create a fully updated Kali Linux live USB and hopefully you can set one up as well by following these instructions.

So the obvious first step is to download the most recent ISO image that you plan on using. At the time of this writing, that would be 2017.1 and I will be using the 64 bit, so my ISO file is named:
kali-linux-2017.1-amd64.iso

Starting from Windows, I use a program called Rufus to create a live USB. It's a very handy program to keep around and my go to for this stuff on Windows. At work, it's gotten disks working with less effort than all the random tools my co-workers download from the random tutorials they read and with no installation required you can keep it on removable medium and have it with you for when you need it. So download that as well, pop your USB drive in and load up Rufus. Then you need to select your ISO file.

After selecting the ISO, the drop down should say something about it being a DD image, and that's exactly what we want. Tell it to start and let the magic happen.


Starting from Linux, we are going to ignore the dd command (dd if=kali-linux-2017.1-amd64.iso of=/dev/sdb bs=512k) because that's both complicated and pointless. A much simpler way to get this done with a LOT less to remember is the cat command. Assuming the drive is /dev/sdb, we simply do: cat kali-linux-2017.1-amd64.iso > /dev/sdb
Simple, easy to remember since it's not using a different syntax style than other bash commands and straight forward. I've also read online that cat is quicker and has less overhead than dd, but I do not know enough about them to confirm or deny these claims. I just think it's a lot easier and gets the job done just as well.

Now with this drive ready to boot from, we shall move on to the next step through Kali because then we know we have the simple and easy tools we need to get the persistence set up. So boot on into Kali and select Live, NOT PERSISTENCE. We need to create the persistence partition. In the actual instructions, they list off some commands than every time I try, they do not work. Even when in Kali Live itself. The commands themselves are a bit beyond my understanding, but that seems to happen every time someone makes a "copy and paste" tutorial because they need to compensate for dynamic possibilities. I, on the other hand, think gparted is a perfectly acceptable solution for today's day in age. If you want to do this via command, I suggest you learn the parted command and do it yourself rather than copy-paste.

So first, press the windows key on your keyboard or bump the top left corner with your mouse. That should bring you to the activities view. Type in "gp" and an icon for gparted should show up, click on that to open it up.

Right click on the empty space and select New. Create an ext3 partition with the label persistence.

Now click on the apply arrow.




Now we are entering the home stretch. The command portion. Open up a terminal, it's the little black icon on the left dock. Enter in these commands:
mount /dev/sdb3 /mnt
echo "/ union" > /mnt/persistence.conf
umount /mnt

Now we reboot the computer to Live with persistence. On some random installation like this, I have run into just a black screen with a pointer. To fix that, I pressed ctrl+alt+f2, which should bring you into TTY2. Then run the command:
kill -9 $(pgrep gnome)
This then dumped me back over to TTY1 and after some time the desktop came back up on TTY3 (ctrl+alt+f3). In the meantime, I just updated on TTY2.

So to finish things off with a clean and easy update:
apt-get update && apt-get upgrade -y

Hopefully this will help anyone struggling with this process. I did notice a lot of people ran into the same problems I did, so now to list off those problems and what caused them for me:

Out of space because updates going into the disk image.
This was caused by booting into persistence and trying to do things before persistence was set up which then lead to an non-bootable USB.

Boots to a black screen with a cursor.
I don't know the cause of it, but killing all gnome related processes seems to correct it. While performing this process 

Could not write files while updating.
This was another case of not having the persistence set up properly.

Saturday, May 13, 2017

Linux ESXi Screen Resolution Will Not Change

I ran into a problem with an ESXi server at work, version 5.5 but I assume the solution will be the same on other versions. The screen resolution would not change. The solution was pretty simple. Edit the virtual machine settings and up the video memory. I found that small increases or using the recommended settings was not enough, so I set it to 32MB and it seemed to work great after that.