Skip to content

Instantly share code, notes, and snippets.

View RichardB01's full-sized avatar
Drinking coffee and coding!

Richard Bamford RichardB01

Drinking coffee and coding!
  • England
  • 09:35 (UTC)
View GitHub Profile
@RichardB01
RichardB01 / conwaysgameoflife
Created September 11, 2013 10:16
Conways GOL WIP
// Conways game of life.
// init array
var arr = [];
for (var x = 1; x < 11; x++)
{
arr[x] = [];
for (var y = 1; y < 11; y++)
{
arr[x][y] = new Rect((x-1)*32, (y-1)*32, 32, 32).fill("black");
@RichardB01
RichardB01 / loopingImages.cs
Created March 24, 2013 14:25
How to loop through an image and get the values of each pixel FAST!
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Threading;
using System.IO;
namespace Gignus
{
class Program
{
@RichardB01
RichardB01 / timelapse.sh
Created March 20, 2013 07:15
Simple .sh to create image files of your desktop and place them in the current working directory every 60 seconds. Macs.
while true ; do sleep 60 && echo `date`‘ Capturing screenshot…’ && screencapture -C -m -t jpg -x -f cap.`date +%s`.jpg ; done
@RichardB01
RichardB01 / gist:4349283
Created December 20, 2012 22:49
reddit reddit reddit
-- sb_row.lua
---- Scoreboard player score row, based on sandbox version
include("sb_info.lua")
local GetTranslation = LANG.GetTranslation
local GetPTranslation = LANG.GetParamTranslation
@RichardB01
RichardB01 / randstrgen.py
Created May 20, 2012 10:11
Python random string generator
from random import choice
import string
chars = string.letters + string.digits # Python 2
chars = string.ascii_letters + string.digits # Python 3
rand_name = lambda x: ''.join(choice(chars) for i in range(x))
@RichardB01
RichardB01 / utilx.lua
Created April 24, 2012 19:03
UtilX - A collab lua gmod function library.
-----------------------------------
-- utilx
-- A project stared by Gbps
-- expanded with community input
-----------------------------------
utilx = {}
utilx.Version = 1.0
--------------------
@RichardB01
RichardB01 / tracing.lua
Created April 22, 2012 20:09
Just a simple set of functions for 2D tracing.
function PointWithinShape(shape, tx, ty)
if #shape == 0 then
return false
elseif #shape == 1 then
return shape[1].x == tx and shape[1].y == ty
elseif #shape == 2 then
return PointWithinLine(shape, tx, ty)
else
return CrossingsMultiplyTest(shape, tx, ty)
end