Skip to content

Instantly share code, notes, and snippets.

View ChristianGreiner's full-sized avatar
👋
Hello World

Christian Greiner ChristianGreiner

👋
Hello World
View GitHub Profile
@MikeGringauz
MikeGringauz / Spaceship.cs
Last active August 22, 2016 14:18
TinyTween engine adopted to Duality 2D game engine with sample Spaceship component demo.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Duality;
using Duality.Components.Physics;
using Duality.Components.Renderers;
using Duality.Input;
using TinyTween;
@mfep
mfep / Controller2D.cs
Created August 30, 2016 22:10
character controller for Duality2D
using System;
using System.Collections.Generic;
using System.Linq;
using Duality;
using Duality.Components.Renderers;
using Duality.Components.Physics;
namespace TilemapJam
{
@waylaidwanderer
waylaidwanderer / install_mono.sh
Created April 15, 2013 07:11
Simple bash script to install the latest build of Mono
#!/bin/bash
echo Checking for prerequisites. Please enter password if prompted.
sudo apt-get update
sudo apt-get install libpng3 libpng3-dev libtool libtiff4 libtiff4-dev libexif12 libexif-dev libgif4 libgif-dev libpango1.0-dev libatk1.0-dev bison automake autoconf make gcc gtk-sharp2 build-essential xorg-dev libfreetype6 libfontconfig libfontconfig-dev gettext libglib2.0-dev git mono-complete libjpeg-dev
echo Downloading latest build of mono...
git clone git://github.com/mono/mono.git
@andrewelkins
andrewelkins / install-docker-on-linux-mint-18.sh
Last active February 2, 2020 21:53
Install Docker on Linux Mint 18
##########################################
# To run:
# curl -sSL https://gist.githubusercontent.com/andrewelkins/1adc587feb610f586f8f40b50b7efc3a/install-docker-on-linux-mint-18.sh | bash -x
##########################################
# Kernel version http://stackoverflow.com/a/4024263
versionlte() {
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
}
versionlt() {
@atorkhov
atorkhov / gist:5403562
Created April 17, 2013 11:31
PIL word wrap
# http://tanner-tech.googlecode.com/svn-history/r197/trunk/NewWorldMap/cardgen/eniCards.py
import Image, ImageDraw, ImageFont
# load an existing image
photo = Image.open("lyn.jpg")
photoSize = photo.size
# create a new, empty image
card = Image.new('RGB', (600, 600), color=(255,255,255))
@vonWolfehaus
vonWolfehaus / circleVsRect.js
Last active October 18, 2021 00:11
Circle to rectangle collision detection
// limits value to the range min..max
function clamp(val, min, max) {
return Math.max(min, Math.min(max, val))
}
// Find the closest point to the circle within the rectangle
// Assumes axis alignment! ie rect must not be rotated
var closestX = clamp(circle.X, rectangle.x, rectangle.x + rectangle.width);
var closestY = clamp(circle.Y, rectangle.y, rectangle.y + rectangle.height);
Texture2D[] layers;
Texture2D compiledTexture = new Texture2D(layers[0].width, layers[0].height);
foreach(Texture2D layer in layers){
Color[] baseColors = compiledTexture.GetPixels();
Color[] layerColors = layer.GetPixels();
for(int p = 0; p < baseColors.Length; p++){
@iiAtlas
iiAtlas / AtlasCanvas.java
Created November 21, 2012 01:42
Simple Double-Buffered, Delta Based Canvas [Java]
package com.atlas.fps;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;
import javax.swing.JFrame;
public class AtlasFPSLimiter extends Canvas implements Runnable {
@prabindh
prabindh / dirlist_creator.py
Created May 4, 2019 02:56
Create directory listing tree in python and output in JSON
import os
import json
def path_to_dict(path):
d = {'name': os.path.basename(path)}
if os.path.isdir(path):
d['type'] = "directory"
d['children'] = [path_to_dict(os.path.join(path,x)) for x in os.listdir\
(path)]
else:
@kundancool
kundancool / Adaway.sh
Last active November 15, 2023 00:48
AdAway for Linux
#!/bin/sh
#==================================================
# AdAway implementation in shell
#==================================================
#
TMP_WORK_PATH="/tmp/.AdAway"
count=0
host_sources="https://hosts-file.net/ad_servers.txt
https://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext