Skip to content

Instantly share code, notes, and snippets.

@Barteks2x
Barteks2x / build.gradle
Created January 18, 2015 03:12
build.gradle for Craftbukkit/Spigot 1.8
apply plugin: 'java'
//this is the same ad Maven groupID
//usually it refers to domain name you own. If your domain is tutorial.bukkit.com then your droupID is com.bukkit.tutorial
group = 'com.tutorial'
//the same as Maven artifactID. This will be used as base for jar name. Usually the same as plugin name
archivesBaseName = 'Tutorial'
//Plugin version. "-SNAPSHOT" at the end is reserved for development versions.
version = '1.0-SNAPSHOT'
@Barteks2x
Barteks2x / CubeProviderDebug.java
Last active October 13, 2020 23:00
Simple GUI for TWM that shows loaded columns around player. Useful for debugging.
package dbg;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ChunkProviderClient;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.player.EntityPlayer;
@Barteks2x
Barteks2x / radiocmd
Last active March 6, 2016 03:39
A simple linux "play and record" online radio command that uses mplayer. You may want to create "radio" (sh) with this: screen -A -m -d -S "radio" "radiocmd" so that it starts that in a screen session. In this example it plays radiozet.
#!/bin/bash
mkdir ~/radio || true
#change to other online radio?
RADIO_NAME=radiozet
NAME=~/radio/$RADIO_NAME-$(date).mp3
LINK_TO_RADIO=http://radiozetmp3-07.eurozet.pl:8400/
mplayer $LINK_TO_RADIO -dumpstream -dumpfile "$NAME" -vc dummy -vo null &
sleep 2
mplayer -vo null "$NAME"
@Barteks2x
Barteks2x / arduino-multitasking-bare-minimum.ino
Created September 17, 2016 18:43
Bare minimum preemptive multitasking code for arduino
typedef struct {
uint8_t taskStatus = 0;
uint16_t R_SP;
} Regs;
const size_t MAX_TASKS = 2;
Regs tasks[MAX_TASKS];
uint8_t currentTask = 0;
void setup() {
@Barteks2x
Barteks2x / build.gradle.kts
Created November 20, 2016 14:33
Forge MDK buildscript in kotlin for gradle 3.2 (using forge 1.11-13.19.0.2153)
import net.minecraftforge.gradle.user.patcherUser.forge.ForgeExtension
import net.minecraftforge.gradle.user.patcherUser.forge.ForgePlugin
import org.gradle.api.JavaVersion
import org.gradle.api.plugins.JavaPluginConvention
import org.gradle.language.jvm.tasks.ProcessResources
import org.gradle.script.lang.kotlin.*
// Gradle repositories and dependencies
buildscript {
repositories {
@Barteks2x
Barteks2x / build.gradle.kts
Created November 20, 2016 18:24
CubicChunks gradle buildscript in kotlin
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.minecraftforge.gradle.user.ReobfMappingType
import net.minecraftforge.gradle.user.ReobfTaskFactory
import net.minecraftforge.gradle.user.patcherUser.forge.ForgeExtension
import net.minecraftforge.gradle.user.patcherUser.forge.ForgePlugin
import nl.javadude.gradle.plugins.license.LicenseExtension
import nl.javadude.gradle.plugins.license.LicensePlugin
import org.ajoberstar.grgit.Grgit
import org.ajoberstar.grgit.operation.DescribeOp
/*
* This file is part of Cubic Chunks Mod, licensed under the MIT License (MIT).
*
* Copyright (c) 2015 contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
package cubicchunks.worldgen.gui;
import com.google.common.base.Converter;
import java.util.HashSet;
import java.util.Set;
import java.util.function.DoubleUnaryOperator;
import javax.annotation.ParametersAreNonnullByDefault;
@Barteks2x
Barteks2x / run-prime.py
Created March 31, 2017 09:31
A way to make running things with nvidia GPU with nouuveau easier on Cinnamon. These files go into /usr/share/nemo/actions/
#!/usr/bin/env python
import errno
import os
import sys
from gi.repository import Gio
os.environ["DRI_PRIME"] = "1"
arg, *rest = sys.argv[1:]
if not os.path.isfile(arg):
@Barteks2x
Barteks2x / D.java
Last active May 9, 2017 19:16
A hacky piece of code to allow effective debug mode without debug mode in Minecraft/Forge, and without the restrictions of hotswapping. And the slowness and bugginess of DCEVM. And I know the naming is nowhere near standard. This is intentional.
package DEBUG;
import static org.apache.commons.io.FileUtils.listFiles;
import static org.lwjgl.input.Keyboard.KEY_D;
import static org.lwjgl.input.Keyboard.KEY_LCONTROL;
import static org.lwjgl.input.Keyboard.KEY_RCONTROL;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;