Skip to content

Instantly share code, notes, and snippets.

View Cybermaxke's full-sized avatar
🍪
Searching cookies...

Seppe Volkaerts Cybermaxke

🍪
Searching cookies...
View GitHub Profile
@Cybermaxke
Cybermaxke / VelocityEventCoroutines.kt
Last active October 27, 2022 18:27
Velocity Event Coroutines - Use kotlin coroutines inside your velocity event handlers.
import com.velocitypowered.api.event.EventTask
import kotlin.coroutines.Continuation
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext
import kotlin.coroutines.startCoroutine
fun suspended(fn: suspend () -> Unit): EventTask {
return EventTask.withContinuation { continuation ->
val completion = object : Continuation<Unit> {
override val context: CoroutineContext
import RPi.GPIO as gpio
import time
try:
# Change to board mode
gpio.setmode(gpio.BCM)
# The sensor is attached to pin 18 and 17
triggerPin = 17
echoPin = 18
@Cybermaxke
Cybermaxke / Utf8YamlConfiguration
Created April 10, 2015 15:49
Utf-8 Yaml Configuration
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
@Cybermaxke
Cybermaxke / TitleProvider
Last active August 29, 2015 14:18
Modify the title of the inventory that is send to the client.
package title;
import org.bukkit.entity.Player;
public interface TitleProvider {
Title provideFor(Player player);
}
@Cybermaxke
Cybermaxke / InventoryTitleHelper
Last active October 13, 2023 09:38
[CraftBukkit/Spigot] Send a new title of the currently opened inventory.
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import static com.google.common.base.Preconditions.checkNotNull;