Skip to content

Instantly share code, notes, and snippets.

View Twister915's full-sized avatar

Joey Twister915

View GitHub Profile
@Twister915
Twister915 / topk.rs
Last active April 21, 2022 07:30
topk
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>,
},
package main
import (
"context"
"sync"
)
type fanOutResult[K any, R any] struct {
Key K
Result R
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 August 29, 2015 14:27
The code that powers https://tmg.pw
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"

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 August 29, 2015 14:24
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
<?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 October 23, 2014 13:56
The assignment said to make at least three comments.
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 August 29, 2015 14:05
Converts ores and squashes ingots into blocks, based strictly on bukkit stuff from line 22 down
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 July 29, 2014 20:39
ShareX - Puu.sh custom uploader
{
"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 July 3, 2014 04:45
Here, have some cool code. Converts timespecs in the format of (3s4m24d4w) into seconds. Useful for punishment plugins!
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);