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
@oodavid
oodavid / README.md
Last active April 6, 2024 18:45 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@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 {
@mebens
mebens / gist:4218802
Created December 5, 2012 19:36
Simple glow/bloom GLSL shader for Love2D
// adapted from http://www.youtube.com/watch?v=qNM0k522R7o
extern vec2 size;
extern int samples = 5; // pixels per axis; higher = bigger glow, worse performance
extern float quality = 2.5; // lower = smaller glow, better quality
vec4 effect(vec4 colour, Image tex, vec2 tc, vec2 sc)
{
vec4 source = Texel(tex, tc);
vec4 sum = vec4(0);
@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);
@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
@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))
@ruby0x1
ruby0x1 / tilt.shift.glsl
Last active February 19, 2024 02:46
Tilt shift shader, modified from something @grapefrukt gave me
// Modified version of a tilt shift shader from Martin Jonasson (http://grapefrukt.com/)
// Read http://notes.underscorediscovery.com/ for context on shaders and this file
// License : MIT
uniform sampler2D tex0;
varying vec2 tcoord;
varying vec4 color;
/*
Take note that blurring in a single pass (the two for loops below) is more expensive than separating
@mitchwongho
mitchwongho / Docker
Last active November 29, 2023 06:36
Docker 'run' command to start an interactive BaSH session
# Assuming an Ubuntu Docker image
$ docker run -it <image> /bin/bash
@jangeador
jangeador / get_or_create.py
Last active December 6, 2023 04:57
A function that creates unique objects based on models
def get_or_create(session, model, **kwargs):
'''
Creates an object or returns the object if exists
credit to Kevin @ StackOverflow
from: http://stackoverflow.com/questions/2546207/does-sqlalchemy-have-an-equivalent-of-djangos-get-or-create
'''
instance = session.query(model).filter_by(**kwargs).first()
if instance:
return instance
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