Skip to content

Instantly share code, notes, and snippets.

View Techcable's full-sized avatar
🇺🇸
Procrastinating

Techcable

🇺🇸
Procrastinating
View GitHub Profile
public class SquareRoot {
/**
* Estimate the sqrt via {@link #superFastSqrt(float)} then refine the accuracy
* <p/>
* Refines the guess onece, which should be 'good enough'
*
* @param d the number to estimate
*/
public static double fastSqrt(double d) {
return increaseAccuracy(guessSqrt(d), 1);
@Techcable
Techcable / generateJar.sh
Last active February 9, 2016 06:50
Generate Paperclip Jars
#!/bin/bash
# Generates a patched jar for paperclip
if [[ $# < 4 ]]; then
echo "Usage ./generateJar.sh {input jar} {mojang_jar} {source_url} {name}"
exit 1;
fi;
workdir=work/Paperclip
@Techcable
Techcable / BlockHelper.java
Last active March 10, 2016 02:11
Utilities to iterate over adjacent block positions
package net.techcable.tacospigot.utils;
import java.util.AbstractSet;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

Keybase proof

I hereby claim:

  • I am techcable on github.
  • I am techcable (https://keybase.io/techcable) on keybase.
  • I have a public key ASA6f3_nisCa_W6IXCjQZaKyBMWo6eyeF-WYvouotzUV7go

To claim this, I am signing this object:

@Techcable
Techcable / rules.md
Last active March 4, 2016 19:09
Unofficial channel rules for #PaperSpigot, #techcable, #waterfall, and #aquifer

##Rules:

  1. criticism of Tacos will be punsihed harshly
  2. criticism of Clippy will be punished harshly
package net.techcable.utils;
import java.util.EnumMap;
import java.util.OptionalInt;
import com.google.common.collect.ImmutableMap;
import org.bukkit.potion.PotionType;
public class PotionUtils {
@Techcable
Techcable / aquifer.css
Last active March 23, 2016 00:30
Aquifer Jenkins Theme
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,500,300);
@-webkit-keyframes rotating {
from {
-webkit-transform: rotate(0deg)
}
to {
-webkit-transform: rotate(360deg)
}
}
@keyframes rotating {
@Techcable
Techcable / assert-hash.sh
Created April 26, 2016 22:37
A script to verify files match cryptographic hashses
#!/bin/bash
usage() {
echo "Usage: assert-hash [type] file hash"
echo "[type] is the type of hash to use, it is optional, and defaults to sha256"
echo "file is the file to hash"
echo "hash is the hash you want to assert the file has"
}
if [[ $# == 2 ]]; then
@Techcable
Techcable / SimpleFormatter.java
Last active August 21, 2019 15:53
A simple and fast formatter that supports accessing arguments by index: format("This is an {} for {}. What is it? It's an {0}!", "example", "you")
/*
* The MIT License
* Copyright (c) 2016 Techcable
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@Techcable
Techcable / OSAirlines.md
Last active May 14, 2016 00:48
Operating System Joke I found online

If Operating Systems Ran The Airlines...

UNIX Airways

Everyone brings one piece of the plane along when they come to the airport. They all go out on the runway and put the plane together piece by piece, arguing non-stop about what kind of plane they are supposed to be building.

Air DOS

Everybody pushes the airplane until it glides, then they jump on and let the plane coast until it hits the ground again. Then they push again, jump on again, and so on...