Skip to content

Instantly share code, notes, and snippets.

View homelinen's full-sized avatar

Calum Gilchrist homelinen

View GitHub Profile
@homelinen
homelinen / AStar.java
Created November 21, 2012 20:07
My A* Algorithm for AI
package uk.calumgilchrist.ai.pathfinder;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import org.json.simple.JSONArray;
@homelinen
homelinen / gist:4302225
Created December 16, 2012 01:52
My animated objects in Chingu. Bullet doesn't animate, for some reason.
class Bullet < Chingu::GameObject
traits :velocity, :bounding_circle
trait :animation, :delay => 200, :size => [16,16], :width => 16
def initialize(options = {})
super(options.merge(:image => Image["cannon-ball.png"]))
end
def update
@image = self.animation.next if self.animation
@homelinen
homelinen / gist:4311474
Created December 16, 2012 19:07
My Island Code that does not work.
require_relative "island_tiles"
require "chingu"
include Chingu
# An area impassable to ships
# Other things can be built onto it
class Island < GameObjectMap
def initialize(options = {})
super(options)
*.pydevproject
.project
.metadata
bin/**
tmp/**
tmp/**/*
#Back ups
*.tmp
*.bak
@homelinen
homelinen / testDiskSpeed.sh
Created January 3, 2013 13:17
Short script to test read and write on a disk
#!/bin/bash
# Some simple read and write tests using dd
# Write
echo "Write"
dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc
# Read Without Cache
echo "Read w/o Cache"
sudo echo 3 > sudo /proc/sys/vm/drop_caches
@homelinen
homelinen / status.sh
Created January 20, 2013 16:33
My dzen bar for i3.
#!/bin/bash
# ------------------------------------------------------
# file: $HOME/.scripts/dzenstat.sh
# author: Ramon Solis - http://cyb3rpunk.wordpress.com
# modified: June 2011
# vim:fenc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=sh:
# ------------------------------------------------------
# -------------------------
@homelinen
homelinen / z-notation-parser.c
Last active December 11, 2015 12:09
First attempt at a Z-Notation parser. Decided to go with Java instead.
#include <stdlib.h>
#include <stdio.h>
#define LBR '{'
#define RBR '}'
#define INTEGER 1
#define SET 5
#define PAIR 6
#define TREE 7
@homelinen
homelinen / readitlater.rb
Last active December 12, 2015 07:08 — forked from StarWhite/readitlater.rb
Earthquake plugin to post urls to Pocket.
# earthquake.gem plugin
# post url to Pocket
require 'open-uri'
Earthquake.init do
_ = config[:ril] ||= {}
_[:apikey] ||= 'your-consumer-key'
# Sign Up for the Pocket API
# https://getpocket.com/developer/apps/new
@homelinen
homelinen / malloc.c
Created February 24, 2013 15:07
Very Simple Malloc
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "malloc.h"
#include "chunk.h"
/* Globals */
Chunk* chunks;
@homelinen
homelinen / wireless-status.sh
Created February 27, 2013 16:12
Simple bash script to get wireless information from wicd.
#!/bin/bash
#
# Possible Implementation for testing the wireless signal
# Outputs:
# {essid} {quality}
wicd-cli --wireless -d | grep -P -i "essid|quality" | cut -d " " -f 2 | awk '!/0$/{printf "%s ",$0}/0$/'