Skip to content

Instantly share code, notes, and snippets.

View perky's full-sized avatar

Luke perky

View GitHub Profile
@perky
perky / ProFi.lua
Created May 30, 2012 20:32
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
@perky
perky / day03.zig
Last active December 14, 2023 15:31
Advent of Code 2023
const std = @import("std");
const LineParser = @import("LineParser.zig");
const fs = @import("fs.zig");
const raylib = @import("raylib.zig");
const c = raylib.c;
const Map = struct {
cells: CellArray,
symbol_indices: IndicesArray,
numbers: NumbersArray,
@perky
perky / day01.zig
Last active December 12, 2023 16:48
Advent of Code 2023
const std = @import("std");
const c = @cImport({
@cInclude("raylib.h");
});
const word_numbers = [_][]const u8{
"one",
"two",
"three",
"four",
@perky
perky / anytype_antics.zig
Created April 29, 2023 19:34
Exploring different ways of using "anytype" in Zig for both static and runtime dispatch.
//! ==============
//! Anytype Antics.
//! ==============
const std = @import("std");
const debug = std.debug;
const builtin = std.builtin;
const trait = std.meta.trait;
fn print(string: []const u8) void { debug.print("{s}\n", .{string}); }
const DONT_COMPILE = false;
@perky
perky / mario_state_machine.zig
Last active April 23, 2023 21:38
Mario State Machine. Showcases the usefulness of switches and tagged unions in Zig.
//! ======
//! file: mario_state_machine.zig
//! This is an example of a Mario/Powerup state machine.
//! It showcases the usefulness of switches and tagged unions in Zig.
//! See state machine diagram:
//! https://external-preview.redd.it/TgwKB-bdEWJase06sIDXmVtaGaP7AZTD9YKn0x4yUWo.png?auto=webp&s=c0318b178038bd83212392c8fdd16e1a4b1a0049
//! ======
/// This is a tagged union.
/// See tagged union doc:
@perky
perky / BindComponentAttribute.cs
Created April 16, 2019 12:31
A little script for Unity that helps binding references to other components in the scene.
using UnityEngine;
using System.Linq;
using System;
using System.Reflection;
public class BindComponent : PropertyAttribute
{
public enum FindMode
{
InSelf, // Find the component on the calling GameObject.
@perky
perky / gist:4413516
Last active March 16, 2019 22:18
Caused by: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.remove(Unknown Source) Line 9: potionKey.remove();
private void cureAllPotions(World world, EntityPlayer entityPlayer) {
List<PotionEffect> activePotions = new ArrayList(entityPlayer.getActivePotionEffects());
for(PotionEffect potionEffect : activePotions) {
entityPlayer.removePotionEffect(potionEffect.getPotionID());
}
}
using UnityEngine;
using Bolt;
public class LobbyMenu : GlobalEventListener
{
[SerializeField] string _gameplayScene;
[SerializeField] ushort _port = 27000;
[SerializeField] ushort _broadcastPort = 27001;
bool _bClientLANInit;

Useful Unreal Engine Stuff

Commands

command description
FREEZERENDERING This commands freezes the culling state and lets you fly around to see what is actually being rendered.
stat initviews stats relevant to culling.

Marketplace

https://www.unrealengine.com/marketplace/instance-tool

import processing.video.*;
import oscP5.*;
class Preset
{
public void activate(PImage src, PImage dst) {}
}
Capture video;
//Movie video;