Skip to content

Instantly share code, notes, and snippets.

View JohnnyJayJay's full-sized avatar
🏔️
Now on Codeberg

Johnny JohnnyJayJay

🏔️
Now on Codeberg
View GitHub Profile
@JohnnyJayJay
JohnnyJayJay / CustomHeads.java
Last active March 6, 2023 05:39
code to get custom heads in minecraft in any version
// Comment the line below in if you use compatre
//import com.github.johnnyjayjay.compatre.NmsDependent;
import net.minecraft.server.v1_8_R3.MojangsonParser;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
@JohnnyJayJay
JohnnyJayJay / commands.clj
Last active June 29, 2020 12:55
A simple and generic command handler for clojure apps using core.match pattern matching.
(ns commands.core
(:require [clojure.string :refer [split]]
[clojure.core.match :refer [match]]))
(defmacro defcommand
"Defines a command function that takes a context argument and any number of additional arguments.
If the `name` symbol does not have explicit label metadata attached to it, the name of the symbol will be used as the label.
The `context-binding` can be any valid `let` binding form. It will be bound to the context argument at execution time.
The `patterns` are a variable number of [[clojure.core.match/match]] matching forms that represent the different arguments that
can be passed to this command."
def add_adjacent_tiles(grid, room, x, y):
room.append((x, y))
grid[x][y] = 'C'
adjacent_tile_positions = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
for (x, y) in adjacent_tile_positions:
if x < len(grid) and y < len(grid[x]) and grid[x][y] == 'R':
add_adjacent_tiles(grid, room, x, y)
return tiles
def group_tiles_to_rooms(grid):
@JohnnyJayJay
JohnnyJayJay / DurationFormatter.java
Created May 13, 2020 19:06
util for simple duration formatting
import java.time.Duration;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
/**
* @author Johnny_JayJay (https://www.github.com/JohnnyJayJay)
*/
public final class DurationFormatter {

Git

Git ist ein Version Control System (VCS). Es wird verwendet, um mehrere Versionen eines Projekts zu handhaben, speichern und zu vereinen.

Vokabular

Begriff Bedeutung
repository Ber Ort, wo das Projekt und alle seine commits gespeichert werden
stage Dateien hinzufügen, die für einen commit berücksichtigt werden sollen
@JohnnyJayJay
JohnnyJayJay / rsa.py
Last active September 23, 2019 20:22
RSA key generation and en-/decryption implementation
import random
import string
def crypt(key, str):
x, n = key
return string.join([chr(c) for c in map(lambda element: (element ** x) % n, [ord(c) for c in str])])
def get_primes(r):
primes = []
for possible_prime in r:
def extended_euclidian(a, b):
if b == 0:
return a, 1, 0
gcd, s, t = extended_euclidian(b, a % b)
s, t = t, s - int(a / b) * t
return gcd, s, t
print("Alphabet length:")
length = int(input())
print("Key:")
@JohnnyJayJay
JohnnyJayJay / main.py
Created September 2, 2019 17:15
vigenere cipher hacking script
import math
def duplicates(vigenere):
strings = []
duplicates = set()
for index in range(len(vigenere)):
string = ""
for i in range(3):
if index + i < len(vigenere):
string += vigenere[index + i]
import java.util.*;
import org.bukkit.command.*;
public final class DelegatingCommand implements CommandExecutor {
private final Map<String, ? extends CommandExecutor> children;
private final CommandExecutor defaultCase;
public DelegatingCommand(Map<String, ? extends CommandExecutor> children) {
this((s, c, l, a) -> false, children);
@JohnnyJayJay
JohnnyJayJay / EventExpecter.java
Last active July 9, 2019 17:47
modified event waiter from jda-utilities for jda 4 alpha
import net.dv8tion.jda.api.events.GenericEvent;
import net.dv8tion.jda.api.hooks.EventListener;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;