Skip to content

Instantly share code, notes, and snippets.

View MrPowerGamerBR's full-sized avatar
:shipit:
We facepalm, we shrug and we hack around it and never look back.

MrPowerGamerBR MrPowerGamerBR

:shipit:
We facepalm, we shrug and we hack around it and never look back.
View GitHub Profile
@MrPowerGamerBR
MrPowerGamerBR / CustomContentEntryRoute.kt
Last active March 13, 2025 04:25
SneakySims' The Sims 1 Skin Renderer (frontend & backend)
package net.sneakysims.website.routes
import io.ktor.server.application.*
import io.ktor.server.html.*
import io.ktor.server.response.*
import io.ktor.server.util.*
import kotlinx.serialization.json.Json
import net.perfectdreams.sequins.ktor.BaseRoute
import net.sneakysims.sneakylib.cmx.CMX
import net.sneakysims.sneakylib.skn.SKN
@MrPowerGamerBR
MrPowerGamerBR / BinaryUtils.kt
Created February 22, 2025 13:37
FAR 1a (The Sims 1) and FAR 1b (The Sims Online) reader/writer
package net.perfectdreams.simslib.utils
object BinaryUtils {
/**
* Extracts two bytes from a UShort [value]
*
* @param value the input
* @return a list containing two UBytes
*/
fun shortToUBytes(value: UShort): List<UByte> {
@MrPowerGamerBR
MrPowerGamerBR / ByteArrayReader.kt
Created February 17, 2025 21:08
The Sims 1 FAR Read/Writer in Kotlin
package net.perfectdreams.simslib.utils
/**
* A reader that reads a ByteArray, similar to Java's ByteBuffer
*
* We don't use kotlinx.io's Buffer because it doesn't support rewinding
*/
class ByteArrayReader(val byteArray: ByteArray) {
var position = 0
import java.io.BufferedInputStream
import java.io.BufferedOutputStream
import java.io.File
import java.io.FileOutputStream
import java.util.*
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
private fun extractFolder(zipFile: String, extractFolder: String) {
try {
@MrPowerGamerBR
MrPowerGamerBR / BlockPacketAdapter.kt
Last active June 5, 2023 10:05
Example of how to replace blocks in 1.18 chunk data, single block change and multi block change packets.
package net.perfectdreams.dreamcustomitems.blocks
import com.comphenix.packetwrapper.WrapperPlayServerBlockChange
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.events.*
import com.comphenix.protocol.wrappers.WrappedBlockData
import com.viaversion.viaversion.api.minecraft.chunks.PaletteType
import com.viaversion.viaversion.api.type.types.version.ChunkSectionType1_18
import io.netty.buffer.Unpooled
import net.minecraft.core.Registry
@MrPowerGamerBR
MrPowerGamerBR / paper.yml
Created February 28, 2021 14:31
SparklyPower Config 24/02/2021
# This is the main configuration file for Paper.
# As you can see, there's tons to configure. Some options may impact gameplay, so use
# with caution, and make sure you know what each option does before configuring.
#
# If you need help with the configuration or have any questions related to Paper,
# join us in our Discord or IRC channel.
#
# Discord: https://discord.gg/papermc
# IRC: #paper @ irc.esper.net ( https://webchat.esper.net/?channels=paper )
# Website: https://papermc.io/
@MrPowerGamerBR
MrPowerGamerBR / patch-proxmox-to-allow-cloning-of-bind-mounts.md
Last active February 15, 2021 23:37
Patch Proxmox to allow cloning of bind mounts

This is a workaround, I don't really like but it works

To allow cloning templates with bind mounts (Useful if you have folders that are shared, so you know that the folder will be accessible in clones), open /usr/share/perl5/PVE/API2/LXC.pm and find this part of the code (in my current version, it is line 1413)

		foreach my $opt (keys %$src_conf) {
		    next if $opt =~ m/^unused\d+$/;

		    my $value = $src_conf->{$opt};
// Extracts PiP tracking information to a CSV file
//
// Works with Vegas 17
//
// Based on this script: https://www.vegascreativesoftware.info/us/forum/beta-pin-image-video-to-motion-track--112837/?page=2
// With the help of this documentation: https://walkedby.com/other/VEGASScriptAPI.html
//
// How to Use: (Remember, this is a very hacky script!)
// 1. Select all the relevant track events
// 2. Run the script
// Extracts PiP tracking information to a CSV file
//
// Works with Vegas 17
//
// Based on this script: https://www.vegascreativesoftware.info/us/forum/beta-pin-image-video-to-motion-track--112837/?page=2
// With the help of this documentation: https://walkedby.com/other/VEGASScriptAPI.html
//
// How to Use: (Remember, this is a very hacky script!)
// 1. Select the track event
// 2. Run the script
@MrPowerGamerBR
MrPowerGamerBR / setup_sdn_internet.sh
Created November 8, 2020 11:30
Setups Internet Networking on a VXLAN network in Proxmox
# Setups routing for Internet on a SDN network (Proxmox)
SDN_IP_RANGE='10.0.3.0/24'
echo "Removing old up/down scripts..."
rm /etc/network/if-up.d/enable_sdn_internet.sh
rm /etc/network/if-post-down.d/disable_sdn_internet.sh
echo "Creating new up/down scripts..."