12 Hour Game Jam

31 July, 2016

undefined

Yesterday I participated in my first ever game Jam in a team of 3 with Natasha Op't Land and Caleb Op't Land. The game jam was hosted by the University of Wollongong. For this game jam we had 12 hours to create A game fitting the theme that was announced on the day. The theme was: "Less is more, More is better".

We spent the first hour brainstorming and sketching out ideas for our game that could fit this theme. We came up with an idea to create a puzzle/maze like game from a top down perspective. But the unique aspect of our game was the decision to have 2 different realms co-exist on top of each other. The two realms would be the 'Overworld' and 'Underworld'.

undefined

Our plan was to create the Overworld in such a way that it appeared very minimal and simplistic, while the underworld would be busy and chaotic. So one realm would be less while the other is more. We decided that all of the hazards and traps in the maze would only be visible from the Underworld while the Overworld would appear as a simple, safe, peaceful place. The image below shows a comparison of the same level as viewed from the Overworld and Underworld. The player is able to switch between realms but can only stay in the Underworld for A limited amount of time.

undefined

Once we had decided on the game we were going to make and a few of the core mechanics we we were about an hour into the game jam. So with 11 hours left we were able to start building the game. Natasha began to design the look and feel of the game and would later create most of the graphics and spritesheets. Caleb began to create some level designs on paper that he would later make into real levels in the game. While I began to create a basic tile-map system that allowed us to have both realms co-exist with only one visible at any given time.

undefined

Once we had the tile-map system working Caleb was able to quickly recreate his sketches into real levels. And we could begin adding elements to the levels. By the end we had 4 different obstacles for the player to face as they progressed through the 8 levels Caleb managed to create. We had boxes to block the players movement, Lava that would kill the player, Portals that would send the player back to the beginning of the level and finally spike balls that would roll around the level and kill the player.

undefined

Towards the end of the jam to all of our surprise we actually had a little time left to go back and fix a few smaller issues that we had ignored in order to get the game to a state where it is complete. All in all I am very surprised in what we were able to achieve in only 12 hours and had a great time at the game jam. Thank to everyone at the University of Wollongong that made the jam happen!

You can play the game in your browser here: http://nathankewley.info/games/2016-UOW-Winter-Game-Jam/

You can download the source for the game here: https://github.com/NathanKewley/2016_UOW_Winter_Game_Jam

Skateboard LED Mod

02 June, 2016

So I recently got into skateboarding and bought myself a skateboard. Having an obsession with LED's and pretty lights I decided that it would be awesome if my skateboard lit up and illuminated the ground below where I'm skating. I decided to use silicon to glue some LED strips to the bottom of my board. I used silicon in case I have the need to remove the LED to try prevent damage to the paint... possibly a little overboard on the quantity.

undefined

undefined

I put 2 strips of the LED's along the base of the board and used a 9v battery for testing. To provide a more permanent power supply I opted for 8AA batteries providing 12 vaults. I encased these under the board along with a simple switch to join/break the circuit.

undefined

undefined

365 AD Group Licensing

27 May, 2016

small script I wrote to set users 365 licenses based on Active Directory group membership, only tested in a hybrid environment.

function grantGroupLicense($group, $license){
    $members = Get-ADGroupMember $group -Recursive
    
    foreach($member in $members){
        $adUser = get-aduser $member.samaccountname | select userprincipalname
        $msolUser = Get-MsolUser -UserPrincipalName $adUser.userPrincipalName
        grantLicense $msolUser $license
    }

    function checkLicense($user, $license){
        foreach($lic in $user.licenses){
            if($lic.AccountSku.SkuPartNumber -eq $license){return $true}
        }
        return $false
    }

    function grantLicense($msolUser, $license){
        if(-not(checkLicense $msolUser $license)){
            try{
                set-msolUserLicense -userprincipalname $msolUser.userPrincipalName -AddLicenses $license -ErrorAction Stop
                write-host $msolUser.userPrincipalName Has been given $license -ForegroundColor green
            }catch{
                write-host $msolUser.userPrincipalName could not be given $license -ForegroundColor red
            }
        }else{
            write-host $msolUser.userPrincipalName already has $license -ForegroundColor green
        }
    }
}

Usage:
grantGroupLicense <AD-Group-Name> <License SkuPartNumber>

eg:
grantGroupLicense FG-MSVisio_Users VISIOCLIENT
grantGroupLicense FG-MSProject_Users PROJECTCLIENT

 

 

PowerShell Mindflash Administration

04 April, 2016

Having a position where part of my job is to administrate users within Mindflash I am frequently completing the following tasks on Mindflash:
• Creating Users
• Enrolling users in courses
• Resetting user passwords

Often these tasks need to be completed for either an individual user or a batch of users at any given time. While Mindflash provides some bulk administration options through their web portal I found it a little limiting and a little clunky to use.

So naturally been a fan on the command line and primarily a Linux user I thought it would be great to be able to administer Mindflash users from a command line, In this case PowerShell. I have created Get-MindflashUser, A PowerShell cmdlet that hooks into the Mindflash API allowing for administration of users.

Get-MindflashUser allows you to complete all of the following tasks without ever leaving the PowerShell window.
• Get a list of all Mindflash users
• Get a list of all Mindflash courses
• Get a list of all users in a specific course
• Get a specific users details
• Get a specific users details including course enrolment details
• Get course progress for a given user and course
• Invite users to a course
• Reset user password
• Create new users

In addition to all of this, you would obviously be able to use Get-MindflashUser within you own scripts to automate repetitive tasks or generate reports.

Some Examples of Use
Resetting a users password

get-MindflashUser -email user@email.com -resetPassword true -newPassword P@ssword21 –Key <yourAPIKeyHere>

Creating a new user

get-MindflashUser -email user@email.com -first michael -last cho -newUser true -newPassword P@ssword21 –Key <yourAPIKeyHere>

There are more examples of user provided in the header of the script. If you find this script useful in any way please let me know by email at Nathan.kewley@gmail.com. Additionally if you find any issues or bugs in the script please shout out so I can resolve them.

 

Download Get-MindflashUser.ps1

 

Creative Commons License
Get-MindflashUser by Nathan Kewley is licensed under a Creative Commons Attribution 4.0 International License

 

Playing around with IIS and Powershell

01 April, 2016

Playing around with IIS, .NET and PowerShell, more specifically how to execute PowerShell from a form on a webpage. It turns out actually invoking some PowerShell on server side via a client request is quite easy. Here I am hoping to show an example of the minimum code required to achieve this.

We will create a simple interface like the one below. The button to run code will invoke a PowerShell command on the server. The result of the PowerShell command will be appended to the text box below the button.

undefined

The command I am using for testing this with is:

$(Get-WmiObject Win32_Computersystem).name

This command will query the pc for its hostname and return it. So after pressing the button the server will run this command and print the result in the text box. The webpage should now look like this.

undefined

Only 2 files are required to achieve this, I have chosen to use C# to create this. The .html file required is:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="powerWeb.test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
    <head id="Head1" runat="server">
        <title>c# iis powersehll</title>
    </head>

    <body>
        <form id="form1" runat="server">
            <asp:Button ID="resetButton" runat="server" Width="308" Text="Run Code" onClick="runCode" /><br />

            <!-- Holds the result of the command -->
            <asp:TextBox ID="response" TextMode="MultiLine" Width="600" Height="200" runat="server"></asp:TextBox><br />
        </form>
    </body>
</html>

And the .aspx.cs file required that goes along with the html is is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Management.Automation;

namespace powerWeb
{
    public partial class test : System.Web.UI.Page
    {
        //function that runs when the button is pressed
        protected void runCode(object sender, EventArgs e)
        {
            //create the powershell instance and give it the command we will be executing
            var shell = PowerShell.Create();

            //build out query string
            string query = "$(Get-WmiObject Win32_Computersystem).name";

            //add the command specified from the gui
            shell.Commands.AddScript(query);

            //execute the command and store resutls in results
            var results = shell.Invoke();

            //for each item in the results we append it ot the response text box on the webpage
            foreach (PSObject result in results)
            {
                response.Text = Server.HtmlEncode(result.BaseObject.ToString());
            }
        }

    }
}

Note that you may need to use package manager to install 'System.Management.Automation' as detailed here: https://www.nuget.org/packages/System.Management.Automation

 

Like stated before the point of this is to provide a minimum example of how to execute PowerShell from IIS and .NET. I plan to expand on this concept to allow some PowerShell to ad automation. So I might get around to posting more on here if I have success with this.

Building a Crappy Rest API in PHP

01 April, 2016

So I got bored and decided it would be a good idea to build a Rest API for my website crappypuns.com. Having only briefly worked with Rest API’s once before I have no doubt that the API I have ended up building is not the best. It is however a simple to implement and understand API so could serve as a good starting point for working with or building API’s. The API and documentation for it are available at http://crappypuns.com/about.php.

The process for creating the API was surprisingly easy and required only two PHP files to create as there are only two commands exposed, one to query for puns and the other to query for images. Each query supports a common parameter ‘limit’ which specifies how many results should be returned up to a maximum of 20.

For the sake of simplicity I will focus only on http://crappypuns.com/api/api_pun.php which is the API link to get jokes. You can choose how many jokes you want returned from the server using the limit parameter like: http://crappypuns.com/api/api_pun.php?limit=10 will return 10 puns in JSON format.

The code that runs on the server when the API call is made is as follows (with minor tweaks for security).

<?php               
        //This is the function that will query the database for the puns
        function getPuns($connect, $limit){                                            
                //Get the amount of jokes required randomly from the database using fake sql parametrs for this example  
                $joke = mysqli_query($connect, "SELECT `punField`,`punIdField` FROM punTable ORDER BY RAND() LIMIT $limit");
                                                                      
                //fetch each result that was returned               
                while($row = mysqli_fetch_assoc($joke)){                 
                        //Append the data to $output               
                        $output[]=$row;                   
                }                                  
                //return the puns pulled from the databse       
                return $output;                    
        }                                             
                                                    
        //See if a limit parameter is set. If not set the limit to 1       
        if (isset($_GET['limit'])){                       
                $limit = $_GET['limit'];               
        }else{$limit = 1;}                      
                                                               
        //make sure limit does not exceed max of 20           
        if($limit > 20){$limit = 20;}                       
                                                         
        //Establish a connection to the database     
        $connect = mysqli_connect('server', 'usrname', 'password', 'database');
        
        //Get the punss from the database                                 
        $jokes = getPuns($connect, $limit);                         
                                                                               
        //Return the results in json format                                 
        print(json_encode($jokes, JSON_UNESCAPED_SLASHES));                  
?> 

I think this is probably the most simple an API can get. Ideally you would expand on this by having some form of security in place like a validation key required to make requests. Maybe a limit on how many requests a client can make in a given time frame.

Newer posts → Home ← Older posts