Skip to content

Instantly share code, notes, and snippets.

View avafloww's full-sized avatar

Ava Chaney avafloww

View GitHub Profile
@avafloww
avafloww / PhpJava.java
Last active June 13, 2024 07:36
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@avafloww
avafloww / mysqlfix.sh
Last active August 29, 2015 14:07 — forked from handerson/mysqlfix.sh
MySQL CLI utilities from MySQL Workbench on OS X
#MySQL Client
sudo ln -s /Applications/MySQLWorkbench.app/Contents/MacOS/mysql /usr/bin/mysql
#MySQL Dump
sudo ln -s /Applications/MySQLWorkbench.app/Contents/MacOS/mysqldump /usr/bin/mysqldump
#How to fix the "Library not loaded: libmysqlclient.18.dylib (LoadError)" error
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
#!/bin/bash
## Get the right md5sum tool
if hash md5 2>/dev/null; then
MD5SUM="md5 -q"
else
MD5SUM="md5sum -b"
fi
## Validate arguments
@avafloww
avafloww / MetaTestPlugin.java
Last active July 24, 2020 05:18
Entity metadata memory leak test plugin
package com.forairan.metatest;
import java.lang.reflect.Field;
import java.util.Map;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_7_R3.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
package com.forairan.bukkit.test.conversationcrash;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.conversations.ConversationAbandonedListener;
import org.bukkit.conversations.ConversationContext;
import org.bukkit.conversations.ConversationFactory;
import org.bukkit.conversations.NullConversationPrefix;
import org.bukkit.conversations.Prompt;
import org.bukkit.event.EventHandler;
@avafloww
avafloww / gist:8834021
Created February 5, 2014 21:56
HashMap/ConcurrentHashMap Performance Comparison
Testing HashMap with 100 objects...
.containsKey() - 6418 ns / 0.006418 ms
.get() - 10793 ns / 0.010793 ms
.put() - 9043 ns / 0.009043 ms
.remove() - 8751 ns / 0.008751 ms
Testing ConcurrentHashMap with 100 objects...
.containsKey() - 2625 ns / 0.002625 ms
.get() - 2334 ns / 0.002334 ms
.put() - 4667 ns / 0.004667 ms
.remove() - 15460 ns / 0.015460 ms
package com.forairan.mapstudio.world;
import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.generator.ChunkGenerator;
public class VoidGenerator extends ChunkGenerator {
@Override
package me.gusta.potato;
public class PotatoManager {
public List<Potato> potatoes = new ArrayList<Potato>();
public static void newPotato() {
Potato potato = new Potato();
potato.setHealth(20);
potato.setType(PotatoType.POTATO);
potato.potato(potato.getPotato());