Skip to content

Instantly share code, notes, and snippets.

View nea89o's full-sized avatar
💜
Hey everyone!

Linnea Gräf nea89o

💜
Hey everyone!
  • Germany
  • 06:56 (UTC +02:00)
  • X @nea89o
View GitHub Profile
@nea89o
nea89o / BlackgroundRemover.kt
Created February 14, 2024 15:57
Replaces black backgrounds with transparent ones. Essentially scales the transparency with the respective brightness of the each pixel.
import java.awt.Color
import java.awt.image.BufferedImage
import java.io.File
import javax.imageio.ImageIO
import kotlin.system.exitProcess
fun main(args: Array<String>) {
var inf: File? = null
var outf: File? = null
import com.google.gson.*
import com.google.gson.annotations.SerializedName
import com.google.gson.reflect.TypeToken
import com.google.gson.stream.JsonReader
import com.google.gson.stream.JsonToken
import com.google.gson.stream.JsonWriter
import kotlin.reflect.*
import kotlin.reflect.full.isSubtypeOf
import kotlin.reflect.full.memberProperties
@nea89o
nea89o / LoreRenderer.kt
Created March 31, 2023 01:26
reimplementation of the minecraft 1.8.9 font renderer
import java.awt.Graphics2D
import java.awt.image.BufferedImage
import java.io.File
import java.util.*
import javax.imageio.ImageIO
/**
* Copyright 2022 Linnea Gräf
*

How to use

Copy the other file in this gist into your $GRADLE_USER_HOME/init.d (usually this is: ~/.gradle/init.d/installMinecraft.init.gradle.kts) and replace the installation path with the correct path. From now on, every mod project that uses forgegradle or loom (and a roughly standard project layout) should have the task ./gradlew installToMinecraft available (also available in your IDE), which will install that jar. in projects with multiple subprojects, you might want to use a fully qualified task path: Either ./gradlew :installToMinecraft for installing the root project, or ./gradlew :forge-1.8.9:installToMinecraft to install a subproject (for example for multi-version projects).

// ==UserScript==
// @name Replace imgur links in the Abishirt vote with images
// @version 1
// @grant none
// @run-at document-end
// @include https://civs.cs.cornell.edu/cgi-bin/*
// ==/UserScript==
console.log("Replacing imgur links with embeded images");
function mutate(el){
el.innerHTML = el.innerHTML.replace(/https:\/\/imgur\.com\/([a-z0-9]+)/i, "<img src=\"https://i.imgur.com/$1.png\" height=200/>https://imgur.com/$1")
import java.io.Closeable
import java.util.*
class ResourceContext {
private val toClose = mutableListOf<Closeable>()
fun <A : Closeable> open(thing: A): A {
toClose.add(thing)
return thing
}
@nea89o
nea89o / Futter.java
Created October 23, 2018 12:47
Komposition created by romangraef - https://repl.it/@romangraef/Komposition
class Futter {
String name;
float mass;
public Futter(String name) {
this.name = name;
this.mass = 100f;
}
public String toString(){
import asyncio
from discord import Embed, Color, Message, Member, Reaction
from discord.ext.commands import Bot, Context as CommandContext, command, group, Group, has_permissions
YES_REACTION = "\U00002705"
NO_REACTION = "\U0000274c"
async def create_action_poll(ctx: CommandContext, description, callback):
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <limits.h>
#define MAX_NUM_LEN 12
#define HOTSTREAK 3
#define MAX_WINS 16
import { Client as RPCClient } from 'discord-rpc';
const client = new RPCClient({ transport: 'ipc' });
const scopes = ['rpc', 'rpc.api', 'messages.read'];
const clientId = '312256871174111233';
client.on('ready', () => {
console.log('Logged in as', client.application.name);
console.log('Authed for user', client.user.username);