Skip to content

Instantly share code, notes, and snippets.

Avatar

Joey Twister915

View GitHub Profile
View topk.rs
use std::marker::PhantomData;
pub enum TopK<I, E, K, F, const N: usize> {
// this TopK has just been created and no data has been computed
// this is the initial state
Prepared {
itr: I,
f: F,
_k: PhantomData<K>,
},
View generics.go
package main
import (
"context"
"sync"
)
type fanOutResult[K any, R any] struct {
Key K
Result R
View notabs.java
package net.cogzmc.core.effect.npc;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketAdapter;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.comphenix.protocol.wrappers.WrappedWatchableObject;
import com.google.common.collect.ImmutableSet;
import lombok.*;
@Twister915
Twister915 / tmgapi.go
Last active Aug 29, 2015
The code that powers https://tmg.pw
View tmgapi.go
package main
import (
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
_ "github.com/go-sql-driver/mysql"
"github.com/spf13/viper"
"fmt"
"github.com/gin-gonic/gin"
"net/http"
View keybase.md

Keybase proof

I hereby claim:

  • I am Twister915 on github.
  • I am twister915 (https://keybase.io/twister915) on keybase.
  • I have a public key whose fingerprint is A5AC 6BDF 416E CB5F F1F4 EFFE A712 40A0 57DD 27C2

To claim this, I am signing this object:

@Twister915
Twister915 / pom.xml
Last active Aug 29, 2015
Checks a list of servers (specified in a strange JSON format, checkout masscan for more details) for offline/online mode. Prints all online servers to stdout
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.twister915.scanner</groupId>
<artifactId>OfflineModeScanner</artifactId>
<version>1.0-SNAPSHOT</version>
@Twister915
Twister915 / gist:2135ee1c4bf976739dbb
Created Oct 23, 2014
The assignment said to make at least three comments.
View gist:2135ee1c4bf976739dbb
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public final class DigitToolsApplication extends Application {
public static void main(String[] args) {
new DigitToolsApplication().run();
}
@Twister915
Twister915 / LolCommand.java
Last active Aug 29, 2015
Converts ores and squashes ingots into blocks, based strictly on bukkit stuff from line 22 down
View LolCommand.java
package com.nebulas.dev;
import net.cogzmc.core.modular.command.CommandException;
import net.cogzmc.core.modular.command.ModuleCommand;
import net.cogzmc.core.player.CPlayer;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
@Twister915
Twister915 / gist:5b2b78a8614b2507aaf4
Created Jul 29, 2014
ShareX - Puu.sh custom uploader
View gist:5b2b78a8614b2507aaf4
{
"Name": "Puush",
"RequestType": "POST",
"RequestURL": "https://puush.me/api/up",
"FileFormName": "f",
"Arguments": {
"k": "YOUR API KEY HERE",
"z": "poop"
},
"ResponseType": "Text",
@Twister915
Twister915 / TimeUtils.java
Created Jul 3, 2014
Here, have some cool code. Converts timespecs in the format of (3s4m24d4w) into seconds. Useful for punishment plugins!
View TimeUtils.java
package net.cogzmc.core.util;
import java.util.HashMap;
import java.util.Map;
public final class TimeUtils {
private static final Map<Character, Double> TIMEMAP = new HashMap<>();
static {
TIMEMAP.put('s', 1D);