Skip to content

Instantly share code, notes, and snippets.

View Byteflux's full-sized avatar
☂️

Matthew Harris Byteflux

☂️
View GitHub Profile
@Byteflux
Byteflux / README.md
Last active November 1, 2021 17:26
Install Docker Engine on Debian and Ubuntu

Install Docker Engine on Debian and Ubuntu

$ curl -sL https://git.io/JPaRT | sudo sh
@Byteflux
Byteflux / life.py
Created July 16, 2021 01:03
Conway's Game of Life (in Python)
#!/usr/bin/env python3
"""Conway's Game of Life"""
STEPS = 100
STEPS_PER_SECOND = 3
# Pulsar
SEED = ('0 0 0 0 0 0 0 0 0 0 0 0 0 0 0',
'0 0 0 1 1 1 0 0 0 1 1 1 0 0 0',
<repositories>
<repository>
<id>byteflux</id>
<url>https://repo.byteflux.net/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.byteflux</groupId>
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index b5f318c00..f3c73b0de 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -215,11 +215,12 @@ public class PaperCommand extends Command {
}
private void dumpHeap(CommandSender sender) {
- File file = new File(new File(new File("."), "dumps"),
- "heap-dump-" + DateTimeFormatter.ofPattern("yyyy-MM-dd_HH.mm.ss").format(LocalDateTime.now()) + "-server.hprof");
diff --git a/pom.xml b/pom.xml
index 4bfafb88..89a147c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,7 +101,7 @@
</relocation>
<relocation>
<pattern>org.apache.commons</pattern>
- <shadedPattern>me.glaremasters.guilds.libs.commons-io</shadedPattern>
+ <shadedPattern>me.glaremasters.guilds.libs.commonsio</shadedPattern>
@Byteflux
Byteflux / Library.java
Last active June 7, 2019 19:32
LibraryLoader example
package net.byteflux.core.library;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import static java.util.Objects.requireNonNull;
func getFlags(desiredHeap int64) string {
asKb := desiredHeap / units.KiB
// the following is specific to OpenJ9 and is based on Aikar's flags:
// https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/
// The equivalent of -XX:G1NewSizePercent/-XX:G1MaxNewSizePercent in OpenJ9's gencon policy is -Xmns/-Xmnx.
// We have to manually compute these values ourselves. By default, the gencon policy assumes 25% of Xms, which is
// simply not sufficient for Minecraft (and Aikar can tell you).
xmns := asKb / 2
@Byteflux
Byteflux / clean-gists.php
Last active October 25, 2018 10:21
Gist Cleaner Script
<?php
// Your GitHub username goes here.
$user = $_ENV['GITHUB_USER'] ?? '';
// If using 2FA, you must create a Personal Access Token at https://github.com/settings/tokens
// The access token can be used in place of the password and should be revoked when no longer needed.
$password = $_ENV['GITHUB_PASSWORD'] ?? '';
// This is the base URL to the GitHub API.
@Byteflux
Byteflux / ip2asn.php
Last active September 24, 2021 03:40
<?php
// ip2asn.php?ip=IP_OR_HOSTNAME : Returns a comma-separated list of matching ASNs
// ip2asn.php?asn=AS_NUMBER : Returns the organization name
// ip2asn.php?update=1&token=SECRET_TOKEN : Updates the local database (setup cron to run once a day)
$SECRET_TOKEN = 'ChangeMe';
$TMP_DIR = '/tmp/ip2asn';
$DATA_DIR = '/var/lib/ip2asn';
@Byteflux
Byteflux / uuidconvert.py
Last active August 29, 2015 13:59
python uuidconvert.py <worldpath>
import sys
import os
import math
import urllib2
import json
import time
import shutil
import uuid
from nbt import nbt # pip install nbt