Skip to content

Instantly share code, notes, and snippets.

View ErisianArchitect's full-sized avatar

Null ErisianArchitect

  • USA
View GitHub Profile
#ifndef NBT_TAGS_HEADER_FILE
#define NBT_TAGS_HEADER_FILE
// https://minecraft.fandom.com/wiki/NBT_format
#include <string>
#include <string_view>
#include <vector>
#include <variant>
#include <cstdint>
@ErisianArchitect
ErisianArchitect / config.ini
Last active June 25, 2022 05:24
Checks your lotto numbers against all lotto numbers for powerball.
[SETTINGS]
readmethod = LINE
filename = numbers.txt
<ui name="main" script="main.ui.py">
<frame position="20x20">
<label text="Just a sample UI XML file."/>
<button text="Example Button" onclick="exampleBtn()"/>
</frame>
</ui>
#Testing out decorators
class decor:
def __init__(self, value_):
self.v = value_
def __call__(self, f):
def wrapped_(*args):
if 'n' in globals():
tmp = globals()['n']
#html.py
#Joins strings a and b if b is not None
def join(a,b=None):
if b != None:
return str.format("{}{}",a,b)
return ''.join(a)
def attribjoin(attribs):
if type(attribs) == dict:
#There is definitely a better way to write this class
#Basically just like a dict, except you can use instance.attribute
#rather than instance["attribute"]
class Settings:
def __init__(self, **kwargs):
for key in kwargs:
setattr(self,key,kwargs[key])
def __setitem__(self,key,value):
setattr(self,key,value)
@ErisianArchitect
ErisianArchitect / Bresenham.cs
Created September 1, 2012 01:54
Bresenham Line 2D
public static void DoLine(int startX, int startY, int endX, int endY, Action<int, int> callback)
{
int dx, dy;
int sx, sy;
int accum;//accumilator
dx = endX - startX;//Start X subtracted from End X
dy = endY - startY;
sx = ((dx) < 0 ? -1 : ((dx) > 0 ? 1 : 0));//if dx is less than 0, sx = -1; otherwise if dx is greater than 0, sx = 1; otherwise sx = 0
@ErisianArchitect
ErisianArchitect / Bresenham.cs
Created September 1, 2012 01:51
Bresenham Line 3D
public static void DoLine(int startX, int startY, int startZ, int endX, int endY, int endZ, Action<int, int, int> callback)
{
int dx, dy, dz;
int sx, sy, sz;
int accum, accum2;//accumilator
dx = endX - startX;//Start X subtracted from End X
dy = endY - startY;
dz = endZ - startZ;
@ErisianArchitect
ErisianArchitect / ArrayHelper.cs
Created July 12, 2012 23:21
Array Helper class
public sealed class ArrayHelper
{
internal static Random rand = new Random();
public static void Swap<T>(ref T[] source, int sourceIndex, int swapIndex)
{
if (source != null && sourceIndex >= 0 && sourceIndex < source.Length && swapIndex >= 0 && swapIndex < source.Length && swapIndex != sourceIndex)
{
T tmp = source[sourceIndex];
@ErisianArchitect
ErisianArchitect / Grades.cs
Created June 11, 2012 22:00
Rhymey's homework
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClassGrades
{
class Program
{