Skip to content

Instantly share code, notes, and snippets.

View donalmacc's full-sized avatar

Donal Mac Carthy donalmacc

View GitHub Profile
terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = "~> 2.0"
}
}
}
# Set the variable value in *.tfvars file
@donalmacc
donalmacc / server.py
Last active August 29, 2015 14:04
simple printing server
from socket import *
host = "localhost"
port = 50000
buf = 1024
addr = (host,port)
# Create socket and bind to address
UDPSock = socket(AF_INET,SOCK_DGRAM)
UDPSock.bind(addr)
print "Listening"
@donalmacc
donalmacc / hello.cpp
Created May 21, 2014 14:58
invsqrt vs fastinvsqrt
#include "glm.h"
#include<vector>
#include <iostream>
#include<Windows.h>
double PCFreq = 0.0;
__int64 CounterStart = 0;
void StartCounter()
{
LARGE_INTEGER li;
@donalmacc
donalmacc / premake4.lua
Created April 10, 2014 14:24
Premake4 script to generate a solution for Lua 5.2.3 from the source found on 10/04/2014.
solution "Lua"
configurations { "Release", "Debug"}
os.chdir("src")
-- The static Lua library
project "Lua51"
bindir = "bin"
libdir = "lib"
kind "StaticLib"
@donalmacc
donalmacc / premake4.lua
Created March 17, 2014 02:52
Simple Premake4 script that gets my SDL2 and glew libraries and creates a project.
-- Simple Premake script to get all C/C++ files
solution "SolutionName"
configurations { "Debug", "Release" }
project "ProjectName"
kind "ConsoleApp"
language "C++"
files { "**.h", "**.cpp"}
links{ "SDL2", "glew32", "glew32s"}
@donalmacc
donalmacc / threadedInput.py
Created October 4, 2013 16:36
Input threaded.
import time
from threading import *
key = "lol"
def getInput():
global key
lock = Lock()
while True:
with lock:
key = raw_input()
bool keys[255];
// constructor
EventHandler::EventHandler()
{
for(int i = 0; i < 255; i++)
keys[i] = false;
}
EventHandler::keyPressed(unsigned char key)
@donalmacc
donalmacc / rgb.cpp
Created November 22, 2012 23:38
RGB from Grayscale Image
//Create an RGB image from a grayscale image. Grayscale is grayScaleImage
result_image = cvCreateImage(cvGetSize(grayScaleImage),IPL_DEPTH_8U, 3);
cvMerge(grayScaleImage, grayScaleImage, grayScaleImage, NULL, result_image);
@donalmacc
donalmacc / setup.sh
Created November 1, 2012 11:04
Set up ubuntu machines for development
sudo sh
apt-get update
apt-get install python2.7
apt-get install python-numpy
apt-get install python-opencv
apt-get install eclipse-platform
apt-get install eclipse-cdt
apt-get install g++
apt-get install clang
apt-get install git
@donalmacc
donalmacc / box2dModifyingGravity.cpp
Created August 19, 2012 23:12
Shows a simple modification of gravity in Box2D
#ifndef FOOTEST_H
#define FOOTEST_H
class FooTest : public Test
{
public:
// List of shapes
b2Body *dynamicBody; // The players shape
b2Body* lowerground; // The horizontal platform
b2Body* sideground; // The vertical platform