Skip to content

Instantly share code, notes, and snippets.

internal abstract class AssetBase : IAsset {
protected string _fileName;
protected string _canonicalName;
protected string _filePath;
private Guid _id;
public AssetType assetType {
get {
return getAssetType();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class Map {
private Tile.TileTypes[,] _tileTypesLayout;
private int _width, _height;
private int _offsetX, _offsetY;
extern crate discord;
extern crate time;
extern crate rand;
use discord::{Discord, State};
use discord::model::{Event, Member};
use std::env;
use time::{SteadyTime, Duration};
use rand::Rng;
@aschuhardt
aschuhardt / Program.cs
Created February 23, 2018 16:50
Creates wavy text using Reddit's markup.
using System;
using System.Linq;
using System.Text;
namespace WavyText
{
class Program
{
private enum Direction
{
@aschuhardt
aschuhardt / ElasticBuffer.cs
Created April 26, 2020 05:28
A resizable buffer object that exposes its underlying array. This is handy for buffering vertex data directly from where it's stored in memory (i.e. without the additional copy operation that calling List<T>.ToArray() implies).
/// <summary>
/// A resizable buffer object with its underlying array exposed
/// </summary>
public class ElasticBuffer<T> : ICollection<T>
{
private int _capacity = 1, _count = 0;
private T[] _buffer;
public ElasticBuffer()
{
@aschuhardt
aschuhardt / launch_ftb.sh
Created September 23, 2020 20:04
script to set up automatic reboots for minecraft server in a screen session
launch_dir="$HOME/rev3"
launch_script="$launch_dir/LaunchServer.sh"
session_name="ftb-server-$(date '+%s')"
command_prefix="screen -S $session_name -p 0 -X stuff"
crontab_file="/tmp/.cronjobs-$(date '+%s')"
echo "Launch directory: $launch_dir"
echo "Launch script: $launch_script"
echo "Session name: $session_name"
@aschuhardt
aschuhardt / kill_ftb.sh
Created September 23, 2020 20:05
script to kill a minecraft server that was launched with launch_ftb.sh
if [ ! -f /tmp/ftb-session-name ]; then
echo "No session found! Was the server launched?"
exit 1
fi
command_prefix="screen -S $session_name -p 0 -X stuff "
crontab_file="/tmp/.cronjobs-$(date '+%s')"
session_name="$(cat /tmp/ftb-session-name)"
# dump existing cron jobs to file
@aschuhardt
aschuhardt / pattern.h
Last active May 30, 2023 08:28
Playdate pattern definitions in a single-header C library
/*
* This is a collection of Playdate patterns compiled into a header-only library
* for use in C SDK projects.
*
* The pattern definitions listed here are copied directly from Ivan Sergeev's
* 'gfxp' library, which can be found here: https://github.com/ivansergeev/gfxp
*
*
* USAGE:
*
@aschuhardt
aschuhardt / blocklist.json
Last active December 19, 2022 02:54
Mastodon Blocklist
[
{
"domain": "pleroma.rareome.ga",
"reasons": [
"security-risk",
"hate speech",
"abuse"
]
},
{
@aschuhardt
aschuhardt / transform_tilesets.ps1
Created May 9, 2023 23:08
A Powershell script that transforms a set of 128x96px tiles by converting black and magenta to transparent, then adding extra spacing between each tile
# I'm an ImageMagick newbie and don't know/care enough to make this performant
# I made this for working with this isometric walls pack: https://screamingbrainstudios.itch.io/isowallpack
foreach ($name in Get-ChildItem -Recurse -Filter *.png | ForEach-Object FullName) {
# convert magenta and black to transparent
mogrify -transparent "rgb(255,0,255)" $name;
mogrify -transparent "rgb(0,0,0)" $name;
# add 64px of spacing along the X-axis, and 32px along the Y-axis
convert $name -background None `