Skip to content

Instantly share code, notes, and snippets.

@opatut
opatut / antialiasing_test.cpp
Created March 26, 2011 11:35
SFML Antialiasing test
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <iostream>
int main() {
sf::RenderWindow app(sf::VideoMode(800,600,32), "lol", sf::Style::Close, sf::ContextSettings(24,8,4));
std::cout << "Antialiasing level: " << app.GetSettings().AntialiasingLevel << std::endl;
while(app.IsOpened()) {
@opatut
opatut / mygui_skin_generator.py
Created April 24, 2011 20:42
MyGUI Skin Layout Generator
#!/usr/bin/python
'''
Description:
This script generates the different BasisSkin tags for a MyGUI skin
definintion file. Possible widget layouts are:
- Stretch
- 3 Tiles, vertical
- 3 Tiles, horizontal
- 9 Tiles (center piece and 8 around it)
@opatut
opatut / menu.py
Created April 27, 2011 17:29
lglive setup menu
#!/bin/bash
TARGET=""
COPIED=0
function help_screen {
dialog --stdout --title "Help" --msgbox "This wizard leads you through the process of installing lglive on your machine. Simply follow the steps in the main menu in the order as listed." 8 50
main_menu
}
@opatut
opatut / random_static.cpp
Created June 3, 2011 16:27
c++0x random generator
#include <iostream>
#include <ctime>
#include <random>
class Random {
public:
static void Initialize() {
Generator.seed(time(0));
}
// Shortened version of this:
// http://www.bpfh.net/simes/computing/chroot-break.html
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
@opatut
opatut / love-android-package
Created February 18, 2014 21:31
Android Löve2D debugging helper
#!/bin/bash
GAME=$1
DIR="/sdcard/love"
MIME="application/x-love-game"
INTENT="org.love2d.android/.GameActivity"
if [[ -z "$1" ]]; then
GAME="game.love"
echo "Creating game package at $GAME"
@opatut
opatut / vector.lua
Created March 21, 2014 21:20
vector.lua
local class = require("util/middleclass")
function assert_vector(v)
assert(v ~= nil and v:isInstanceOf(Vector))
end
Vector = class("Vector")
function Vector:initialize(x, y)
self.x = x or 0
# Data mining 2014, practical tutorial 5, example for
# *** Self-Organising Map ***
# Copyright agreement:
# Do whatever you want.
import numpy, scipy, sys, subprocess
iterations = int(sys.argv[2])
# set parameters
@opatut
opatut / easing.js
Last active August 29, 2015 14:25 — forked from frederickk/easing.js
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
* Finally! Someone who understands we don't need to put the
* start, end, duration, etc. into the easing forumlae.
*/
var EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
@opatut
opatut / setup.js
Created November 30, 2015 11:43
Mocha: Cannot combine --delay and --watch and --require hook
// setup.js
console.log('starting timeout');
setTimeout(function() {
console.log('timeout triggered, running suite');
run();
}, 1000);