Skip to content

Instantly share code, notes, and snippets.

View TuxCoding's full-sized avatar

Alex (TuxCoding) TuxCoding

  • [::1]
View GitHub Profile
@TuxCoding
TuxCoding / area-of-ring.rkt
Created October 18, 2016 17:36
First Racket program to calculate the content size of a ring
;; area-of-ring: number number -> number
;; Determines the area of a ring
;; with outer radius outer and an inner radius inner
;; Example: (area-of-ring 5 3) is
;; roughly 50.26544
(define (area-of-ring outer inner)
(- (area-of-circle outer)
(area-of-circle inner)))
;;Tests
@TuxCoding
TuxCoding / scan.sh
Created October 15, 2016 09:46
Scans the network for mac adresses
nmap -sP -n 192.168.0.0/24
public class AnnotationHelper {
private static final String ANNOTATIONS = "annotations";
public static final String ANNOTATION_DATA = "annotationData";
public static boolean isJDK7OrLower() {
boolean jdk7OrLower = true;
try {
Class.class.getDeclaredField(ANNOTATIONS);
} catch (NoSuchFieldException e) {
//Willfully ignore all exceptions
@TuxCoding
TuxCoding / minecraft-ping.java
Created September 22, 2016 11:42
Get the minecraft ping of a Player object in a Bukkit/MCPC server
public class MinecraftPing {
//this value updates every 40 Ticks => 2 Seconds. So you proparly want to add a scheduled task for it.
public int getReflectionPing(Player player) {
try {
if (getHandleMethod == null) {
getHandleMethod = player.getClass().getDeclaredMethod("getHandle");
//disable java security check. This will speed it a little
getHandleMethod.setAccessible(true);
}
@TuxCoding
TuxCoding / devBukkit-update-template.txt
Created September 20, 2016 10:47
https://dev.bukkit.org/ update template. Replace all VERSION tags
=== Changelog VERSION ===
====== ++Added++ ======
*
====== Changed/Fixed ======
*
@TuxCoding
TuxCoding / Spigot-update-template.txt
Created September 20, 2016 10:45
Spigot update template. Using BB-Code because it's copyable into a .txt file. Replace all VERSION tags
[B][SIZE=5][COLOR=rgb(0, 89, 179)]VERSION[/COLOR][/SIZE][/B]
[SIZE=4][B][COLOR=rgb(0, 179, 0)][U]Added[/U][/COLOR][/B][/SIZE]
[LIST]
[*]
[/LIST]
[B][U]Changes/Fixes[/U][/B]
[LIST]
[*]
#!/usr/bin/python3
from pysimplesoap.client import SoapClient
location = 'http://fritz.box:49000/igdupnp/control/WANCommonIFC1'
namespace = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1'
action = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1#'
debug = False # display http/soap requests and responses
client = SoapClient(location, action, namespace, trace=debug)
@TuxCoding
TuxCoding / spigot-bungee-auto-update.sh
Last active April 9, 2018 21:30
Auto updates spigot and BungeeCord based on the latest version from Jenkins
#!/bin/sh
cd /home/minecraft
mkdir tempdl
cd tempdl
wget https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/artifact/paperclip.jar #Download the latest version of Spigot
wget https://ci.aquifermc.org/job/Waterfall/lastSuccessfulBuild/artifact/Waterfall-Proxy/bootstrap/target/Waterfall.jar #Download the latest version of BungeeCord
#Copy the .jars to the server folders
cp paperclip.jar /home/minecraft/paperclip.jar
@TuxCoding
TuxCoding / bungee-sqlite.md
Last active December 12, 2021 04:18
Add SQLite support to your BungeeCord server.
  1. Download the SQLite driver .jar from here: https://bitbucket.org/xerial/sqlite-jdbc/downloads
  2. Open your BungeeCord/Waterfall jar with any archiver program
  3. Open the SQLite driver with any archiver program
  4. Copy the contents (the "org"-folder) from the SQLite driver to BungeeCord
  5. Now just use the SQLite settings in the ChangeSkin config.
@TuxCoding
TuxCoding / minecraft-offline-uuid.php
Last active May 7, 2024 10:10
Generate an offline minecraft UUID v3 based on the case sensitive player name
<?
/**
* Generates a offline-mode player UUID.
*
* @param $username string
* @return string
*/
public static function constructOfflinePlayerUuid($username) {
//extracted from the java code:
//new GameProfile(UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(Charsets.UTF_8)), name));