Skip to content

Instantly share code, notes, and snippets.

Jamie Mansfield jamierocks

Block or report user

Report or block jamierocks

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View MaterialColor.java
package com.unascribed.materialpicker;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public enum MaterialColor {
RED("Red",
0xFF_F44336,
@falkreon
falkreon / InvertedNormalRandom.java
Last active Aug 22, 2017
Selecting unusually-distributed pseudorandom numbers
View InvertedNormalRandom.java
/**
* Creates a random number from (-1..1), exclusive, distributed in an inverse-bell-curve fashion. That is, numbers
* closer to -1 or 1 are exponentially more likely to appear than numbers closer to 0.
*/
public static double invertedNormalRandom(Random r) {
/*
* Implementation note: log10 reaches y=0 at x=1, and reaches y=1 at x=10, so it's really important, if we
* want to get good numbers out of it, to feed it numbers in the range of 1..10. So we multiply by 9 and add 1.
*/
double a = Math.log10((r.nextDouble()*9)+1);
@Deamon5550
Deamon5550 / Summary.md
Last active Aug 14, 2016
Sponge Event Benchmarking
View Summary.md

All Tests were performed with 20 warmup iterations of 10000 cycles and 40 benchmarking iterations of 50000 cycles. Times are all in milliseconds.

These arguments were choosen such that the GC pauses would be long, but infrequent. VM arguments: -verbose:gc -Xbatch -XX:CICompilerCount=1 -XX:-TieredCompilation -Xmx10G -Xms10G -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:InitiatingHeapOccupancyPercent=80

Guava:

View ip2asn.php
<?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';
@matthewprenger
matthewprenger / 01-mapping_update_instructions.txt
Last active Feb 20, 2017
Place the new methods.csv and fields.csv in the root of your project (TEMPORARILY, Don't commit these to git!) and add this to the end of your build.gradle and run 'gradle updateMappings`. Updated sources will be placed in src_remapped/main/java. You should do a diff to ensure that they are correct and then replace src/main/java with them.
View 01-mapping_update_instructions.txt
Important note: Your code must compile on the old mappings, and the obfSourceJar must be enabled (it is by default)
1. Download a copy of the new methods.csv and fields.csv from http://export.mcpbot.bspk.rs/ to the root of your project.
2. Add the following gradle script to your build.gradle.
3. Run 'gradle(w) updateMappings'.
4. Do a diff between src/main/java/ and src_remapped/main/java/ to make sure everything looks right.
5. replace src/main/java/* with src_remapped/main/java/*
@unascribed
unascribed / BrokenHash.java
Last active May 2, 2019
How to generate a (correct) Minecraft-style hex digest. Tested.
View BrokenHash.java
package com.unascribed.brokenhash;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.nio.charset.StandardCharsets;
/**
* Generates a broken Minecraft-style twos-complement signed
View orthodoxc++.md

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

@Vazkii
Vazkii / LiMI.java
Created Dec 7, 2015
LiMI - Lightweight Mod Indicator
View LiMI.java
package vazkii.limi;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@AbrarSyed
AbrarSyed / build.gradle
Last active Jun 17, 2018
A custom script to build custom MCP snapshots.
View build.gradle
apply plugin: "java"
apply plugin: "maven"
// edit this area only.
// the build.gradle would have the patttern minecraft { mappings = "channel_dlVersion" }
ext.channel = "SomeRandomName"
ext.dlVersion = "custom"
ext.mcVersion = "1.7.10" // the targetted MC version
group = "de.oceanlabs.mcp"
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active Jun 18, 2019
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel9k

Powerlevel9k

You can’t perform that action at this time.