Skip to content

Instantly share code, notes, and snippets.

@bradur
bradur / MeshCombiner.cs
Created April 16, 2020 13:48
Unity C# Script for combining meshes
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class MeshCombiner : MonoBehaviour {
private List<MeshFilter> meshFilters;
private CombineInstance[] combineInstances;
@bradur
bradur / ImageCompositionTool.py
Created March 17, 2018 16:34
Use python to synchronize and combine two sets of timelapses and zoom in a portion of the other timelapse (webcam).
import os
import datetime
import PIL
from PIL import Image
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
class ImageCompositionTool(object):
@bradur
bradur / download.py
Created September 17, 2017 10:13
Download Minecraft Realms world backup with python3.
import requests
import json
import urllib.request
import datetime
# import username, password, etc from config.py file that looks like this:
"""
config = {
"user": "minecraft account",
"password": "minecraft account password",
import pygame
import random
from pygame.locals import KEYDOWN, K_LEFT, K_RIGHT, K_UP, K_DOWN, QUIT
# init pygame, with white background 500x500 pixels in size
pygame.init()
screen = pygame.display.set_mode((500, 500))
background = pygame.Surface((500, 500))
background.fill((255, 255, 255))
@bradur
bradur / pygamesprite.py
Last active January 15, 2018 06:35
Quick display of the pygame sprite class in action.
import pygame
from pygame.locals import MOUSEBUTTONDOWN, QUIT
# create a Card class that inherits the Sprite class
class Card(pygame.sprite.Sprite):
def __init__(self, image, rect, name):
# here we call the init function of the pygame.sprite.Sprite class.
# this means we can use all sprite class functions:
# http://www.pygame.org/docs/ref/sprite.html
@bradur
bradur / gist:6510655
Created September 10, 2013 14:56
Who Wants To Be A Millionaire? Broadcast on ITV November 20, 2000
Complete this phrase. As sick as a...
Penguin
Parrot
Puffin
Partridge
Parrot
Which legal document states a person's wishes regarding the disposal of their property after death?
Will
Shall
@bradur
bradur / gist:6510645
Last active December 22, 2015 18:09
Who Wants To Be A Millionaire? Broadcast on ITV November 20, 2000
qa = [
{
"question": "Complete this phrase. As sick as a...",
"choices": ["Penguin", "Parrot", "Puffin", "Partridge"],
"answer": "Parrot"
},
{
"question": "Which legal document states a person's wishes regarding the disposal of their property after death?",
"choices": ["Will", "Shall", "Would", "Should"],
@bradur
bradur / gist:6073890
Created July 24, 2013 19:48
Quick pixel-by-pixel lighting test in pygame. images for the game: player: http://i.imgur.com/IPVAjsq.png tile: http://i.imgur.com/hqTvoIt.png put them in the same folder as the script and run, should work!
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import QUIT, KEYDOWN, K_ESCAPE, K_RETURN
import os
class Game(object):
def __init__(self):
pygame.mixer.pre_init(44100, -16, 2, 2048) # sounds
pygame.init()
@bradur
bradur / pygame lighting mini
Created July 24, 2013 19:48
Quick pixel-by-pixel lighting test in pygame. images for the game: player: http://i.imgur.com/IPVAjsq.png tile: http://i.imgur.com/hqTvoIt.png put them in the same folder as the script and run, should work!
import pygame
from pygame.locals import QUIT, KEYDOWN, K_ESCAPE, K_LEFT, K_RIGHT, K_DOWN, K_UP
# Game dimensions
screen_width, screen_height = 800, 800
pygame.mixer.pre_init(44100, -16, 2, 2048) # sounds
pygame.init()
pygame.display.set_caption("Lighting test") # Set app name
import pygame
import random
pygame.init()
SCREEN_WIDTH = 400
SCREEN_HEIGHT = 400
SIZE = (SCREEN_WIDTH, SCREEN_HEIGHT)
SCREEN = pygame.display.set_mode(SIZE)
pygame.display.set_caption('Colour Birth')