Skip to content

Instantly share code, notes, and snippets.

@garzaa
garzaa / priestbot.py
Created September 2, 2023 21:39
A Discord bot that you can anonymously confess your sins to. It posts them in a channel of your choice.
import discord
from email.message import Message
import random
import re
from datetime import datetime
TOKEN = "REDACTED_STRING"
confession_channel_id = 000000
url_regex = r"\b((?:https?://)?(?:(?:www\.)?(?:[\da-z\.-]+)\.(?:[a-z]{2,6})|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:(?:[0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,7}:|(?:[0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|(?:[0-9a-fA-F]{1,4}:){1,5}(?::[0-9a-fA-F]{1,4}){1,2}|(?:[0-9a-fA-F]{1,4}:){1,4}(?::[0-9a-fA-F]{1,4}){1,3}|(?:[0-9a-fA-F]{1,4}:){1,3}(?::[0-9a-fA-F]{1,4}){1,4}|(?:[0-9a-fA-F]{1,4}:){1,2}(?::[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:(?:(?::[0-9a-fA-F]{1,4}){1,6})|:(?:(?::[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(?::[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(?:ffff(?::0{1,4}){0,1}:){0,1}(?:(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])|(?:[0-9a-fA-F]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(?:25[0-5]|(?:2[0-4]|1{
@garzaa
garzaa / RuleTileCreator.cs
Created July 4, 2022 21:22
Unity Sprite Autotiler
#if UNITY_EDITOR
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.IO;
using UnityEngine;
using System.Linq;
using UnityEngine.Tilemaps;
public class RuleTileCreator : MonoBehaviour {
@garzaa
garzaa / AsyncTexture.cs
Last active December 19, 2021 21:41
Runtime Pixelart Smoothing
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
public class AsyncTexture {
public int width { get; private set; }
public int height { get; private set; }
Color[] pixels;
public AsyncTexture(Color[] pixels, Vector2Int size) {
@garzaa
garzaa / LedgePop.cs
Created July 8, 2020 06:31
celeste-like platformer movement
using UnityEngine;
public class LedgePop : MonoBehaviour {
const float popDistance = 0.10f;
const float castDistance = 0.05f;
const float speedMultiplier = 0.5f;
BoxCollider2D box;
Rigidbody2D rb;
int layerMask;
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using UnityEngine.SceneManagement;
// persistentObject extends Monobehaviour
public class MapFog : PersistentObject {
[SerializeField] Texture2D fog;
[SerializeField] GameObject cameraTarget;
@garzaa
garzaa / ToonMotion.cs
Last active January 7, 2024 05:28 — forked from mnogue/ToonMotion.cs
Split animations down into predefined fps
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ToonMotion : MonoBehaviour {
public int fps = 18;
public List<GameObject> ignoreGameobjects;
float lastUpdateTime = 0f;
@garzaa
garzaa / ellers.js
Created February 3, 2020 02:00
eller's algorithm in javascript, a maze drawing tool
// http://www.neocomputer.org/projects/eller.html
var canvasSize = 800;
var bg = 220;
var fg = 50;
var cellSize = 16;
var lineWeight = 3;
var workingArea = 512;
@garzaa
garzaa / ellers.js
Created February 3, 2020 02:00
eller's algorithm in javascript, a maze drawing tool
// http://www.neocomputer.org/projects/eller.html
var canvasSize = 800;
var bg = 220;
var fg = 50;
var cellSize = 16;
var lineWeight = 3;
var workingArea = 512;
@garzaa
garzaa / Mirror.shader
Created July 1, 2019 18:32
A Fresnel-shaded mirror for Unity.
// based on this asset: https://wiki.unity3d.com/index.php/MirrorReflection4
Shader "FX/Mirror"
{
Properties
{
_MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[HideInInspector] _ReflectionTex ("", 2D) = "white" {}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
[RequireComponent(typeof(LineRenderer))]
public class CircleRenderer : Monobehaviour {
public int segments;
[Range(0, 1)]