Skip to content

Instantly share code, notes, and snippets.

View nathanfranke's full-sized avatar
💻

Nathan Franke nathanfranke

💻
View GitHub Profile
@nathanfranke
nathanfranke / README.md
Created October 25, 2022 08:34
Physical measuring examples in standalone data URLs

Usage:

Triple click a URL, copy (CTRL+C), new tab (CTRL+T), paste (CTRL+V), and submit (Enter).

Example URL
1×1in Grid data:text/html,<style>body { background-image: repeating-linear-gradient(black, transparent 1px 100%), repeating-linear-gradient(90deg, black, transparent 1px 100%); background-size: 1in 1in; }</style>
1×1cm Grid data:text/html,<style>body { background-image: repeating-linear-gradient(black, transparent 1px 100%), repeating-linear-gradient(90deg, black, transparent 1px 100%); background-size: 1cm 1cm; }</style>
Credit/Debit Card data:text/html,<div style="background: black; color: white; width: 85.6mm; height: 53.98mm;">Credit/Debit Card (85.6mm x 53.98mm)</div>
US Banknote data:text/html,US Banknote (6.14in x 2.61in)
@nathanfranke
nathanfranke / Potion.java
Created March 25, 2022 23:12
minecraft paper create potion item
final ItemStack item = new ItemStack(Material.POTION);
final PotionMeta meta = (PotionMeta)item.getItemMeta();
meta.setBasePotionData(new PotionData(PotionType.MUNDANE));
item.setItemMeta(meta);
player.getInventory().setItem(0, item);
@nathanfranke
nathanfranke / SidebarPlugin.kt
Last active March 1, 2022 14:32
All Zeros Sidebar in Paper 1.18.2 (1.8 Compatible)
package me.nathanfranke.sidebarplugin
import net.kyori.adventure.text.Component
import net.kyori.adventure.text.format.NamedTextColor
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer
import org.bukkit.ChatColor
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent
@nathanfranke
nathanfranke / NickPlugin.kt
Created February 27, 2022 09:37
Seamless Name, UUID, and Skin Disguise on Paper 1.18 (ProtocolLib)
package me.nathanfranke.nickplugin
import com.comphenix.protocol.PacketType
import com.comphenix.protocol.ProtocolLibrary
import com.comphenix.protocol.events.PacketAdapter
import com.comphenix.protocol.events.PacketContainer
import com.comphenix.protocol.events.PacketEvent
import com.comphenix.protocol.wrappers.EnumWrappers
import com.comphenix.protocol.wrappers.PlayerInfoData
import com.comphenix.protocol.wrappers.WrappedChatComponent
@nathanfranke
nathanfranke / Example.kt
Last active February 17, 2022 20:15
Kyori Adventure complex localization with arguments (e.g. plural, grammar)
@Suppress("UNUSED")
class MyPlugin : JavaPlugin(), Listener {
override fun onEnable() {
super.onEnable()
server.pluginManager.registerEvents(this, this)
}
@EventHandler
fun onPlayerJoin(event: PlayerJoinEvent) {
for (i in 1..5) {
@nathanfranke
nathanfranke / PKGBUILD
Created November 3, 2021 09:03
VCS PKGBUILD that doesn't change pkgver
_pkgver() {
(cd YOUR_GIT_REPOSITORY &>/dev/null && git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g') || echo latest
}
pkgname=YOUR_PACKAGE
pkgver=$(_pkgver)
pkgrel=1
...
source=('YOUR_GIT_REPOSITORY::git+https://github.com/example/example.git')
sha256sums=('SKIP')
@nathanfranke
nathanfranke / sh
Created May 5, 2021 05:57
Minecraft: Filter Matrix AC trial message with grep
java -Dterminal.jline=false -Dterminal.ansi=true -jar Paper-*.jar nogui | grep --color=never --invert --extended-regexp '^.{0,3}\[[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2} INFO\]: '"$(printf \\e)"'\[[0-9;]*m\[Matrix\] '"$(printf \\e)"'\[[0-9;]*m\(!\) You are currently using free\(trial\) version of Matrix!'"$(printf \\e)"'\[[0-9;]*m$'