Skip to content

Instantly share code, notes, and snippets.

View varrix's full-sized avatar

Logan Speck varrix

  • Ontario, Canada
  • 12:19 (UTC -04:00)
View GitHub Profile
@varrix
varrix / APPROVAL.md
Created September 12, 2014 20:56
My thoughts on sponge's package/plugin approval process.

Package Approval Process:

The package approval process, or otherwise known as the plugin approval process describes the process in which a package/plugin is submitted, reviewed, and released (aka- available for download).

My Proposal:

I see the best approach to be a mixed approach.

We must ensure we have a number of things cleared in order to have a successful approval process.

  1. Protect against malicious code first and foremost
@varrix
varrix / config.conf
Last active August 29, 2015 14:22
Cortex config.conf (HOCON) default configuration.
### Cortex Configuration ###
# Author - Logan Speck (Wingz/varrix)
# Contact - Twitter: @itswingz | Sponge: wingz
# Libraries - PaginatedLists by mmonkey (https://forums.spongepowered.org/t/paginated-lists-a-library-for-plugin-developers/6964)
# Description - Cortex is a standalone modification viewer, spoofer, tracker, and logger.
### Variable Legend ###
# ${<COLOR/STYLE>} - this allows you to specify any color or style, example: "${RED}Red text!" You can also
# use number-codes if you would like using the same format as declaration (-> ${6}Gold text!)
@varrix
varrix / metadata.conf
Created June 3, 2015 08:58
Metadata configuration file (HOCON) for the Sponge plugin `Cortex`.
# Whether or not to report missing metadata.
# Permission node = `metamods.admin.report` / `metamods.admin.*` / `metamods.*`
reportMissingMetadata = true
# Whether or not to inform the querier of the missing data.
missingMetadataVerbosity = false
# The message to display when there's no metadata defined.
missingMetadataMessage = "${RED}Sorry, it seems that data on the requested mod cannot be found."
@varrix
varrix / HoconFile.java
Last active September 25, 2015 03:52
HoconFile (verbose version)
package <your-package-name>;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
import org.slf4j.Logger;
import java.io.File;
import java.io.IOException;
@varrix
varrix / HoconFile.java
Created June 11, 2015 23:45
HoconFile (non-verbose version)
package ca.loganspeck.cortex.storage;
import com.google.common.base.Preconditions;
import ninja.leaping.configurate.ConfigurationNode;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
import ninja.leaping.configurate.loader.ConfigurationLoader;
import java.io.File;
import java.io.IOException;
@varrix
varrix / HoconFile-Example.java
Created June 11, 2015 23:54
HoconFile example!
private void initConfig() {
// construct our HoconFile object usin
File folder = new File("config", "cortex");
// Params: 1-Super folder of plugin, 2-file name, 3-logger instance
HoconFile config = new HoconFile(folder, "config", logger);
// Optionally can drop the 3rd param (only available for the verbose version)
// if using verbose version, you can toggle verbosity (great for debugging a single file- not recommended for use on ALL files)
config.setVerbose(true);
@varrix
varrix / apache.conf
Created July 5, 2015 21:54
Default apache.conf for phpyMyAdmin. Source: http://stackoverflow.com/a/19817403
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options Indexes FollowSymLinks
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off

firewalld

Permanently add service: firewall-cmd --permanent --add-service=http (Must restart service to take effect!)

Other

@varrix
varrix / UUIDs.java
Last active December 15, 2016 05:47
/**
* Retrieve a UUID safely from a {@link String}.
*
* @param string The {@link String} to deserialize into an {@link UUID} object.
* @return {@link Optional#empty()} if the provided {@link String} is illegal, otherwise an {@link Optional}
* containing the deserialized {@link UUID} object.
*/
public static Optional<UUID> getUUID(String string) {
if (string.contains("-")) {
try {
@varrix
varrix / SimpleEscape.java
Created April 10, 2016 19:53
Simple no-dependency character sequence matching using quotations in Java. Source: http://stackoverflow.com/a/1473198
public static void main(String[] args) {
String line = "/cmd \"test\"";
Pattern p = Pattern.compile("\"([^\"]*)\"");
Matcher m = p.matcher(line);
while (m.find()) {
System.out.println(m.group(1));
}
}