Skip to content

Instantly share code, notes, and snippets.

View hube12's full-sized avatar
💭
Currently working and handling side projects, contact me on Discord Neil#4879

Neil hube12

💭
Currently working and handling side projects, contact me on Discord Neil#4879
View GitHub Profile
@hube12
hube12 / bot.js
Created October 2, 2018 21:54
quick amz tlg bot
process.env.NTBA_FIX_319 = 1;
const TelegramBot = require('node-telegram-bot-api');
const rp = require('request-promise');
const cheerio = require('cheerio');
// replace the value below with the Telegram token you receive from @BotFather
const token = 'my awesome token';
// Create a bot that uses 'polling' to fetch new updates
const bot = new TelegramBot(token, {
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public class FortressGen {
private static final Random rand = new Random();
@hube12
hube12 / xpbot
Last active June 14, 2019 17:11
const Discord = require('discord.js');
const client = new Discord.Client();
const auth = require('./auth.json');
const xp = require('./xp.json');
const fs = require('fs');
var messageCounter = 0;
client.on('ready', () => {
console.log('Ready!');
console.log(client.guilds.map(g => g.name).join("\n"));
/*
* Decompiled with CFR 0.146.
*/
package net.minecraft.world.level.biome;
import net.minecraft.util.LinearCongruentialGenerator;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.biome.BiomeZoomer;
@hube12
hube12 / cl
Last active October 9, 2019 22:04
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <time.h>
#ifdef __linux
#include <unistd.h>
#endif
#include <errno.h>
#define min(a, b) ((a) < (b) ? (a) : (b))
@hube12
hube12 / ford
Created November 7, 2019 10:57
# -*- coding: utf-8 -*-
from util_gro_tp2 import *
from numpy import minimum
def flot_max(G, source, puits, debug=False) :
#
# calcul du flot max pour le graphe G
#
if not type(G) == GrapheOrienteValue :
download msys2 here : https://www.msys2.org/
then run
pacman -Syuu
pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain \
git subversion mercurial \
mingw-w64-i686-cmake mingw-w64-x86_64-cmake
pacman -Syuu mingw64/mingw-w64-x86_64-opencl-headers
then
git clone https://github.com/hube12/GPUDUNGEONS
#include <jrand.cl>
inline uint next(unsigned long* seed, int bits) {
*seed = (*seed * 0x5DEECE66DUL + 0xBUL) & ((1UL << 48) - 1);
return *seed >> (48 - bits);
}
__kernel void start(ulong offset, ulong stride, __global ulong *seeds, __global ushort *ret) {
size_t id = get_global_id(0);
uchar max_count = 0;

Seed Cracking

Part 1: A little explanation about Java Random

  • java.util.Random, An instance of this class is used to generate a stream of pseudorandom numbers. The class uses a 48-bit seed, which is modified using a linear congruential formula. (See Donald Knuth, The Art of Computer Programming, Volume 2, Section 3.2.1.)

  • This class has 6 nifty functions:

    • nextBoolean()
    • nextDouble()
  • nextFloat()

#include <stdio.h>
#include <NTL/ZZ.h>
#include <NTL/vec_double.h>
#include <NTL/vec_ZZ.h>
#include <NTL/mat_ZZ.h>
#include <NTL/mat_RR.h>
#include <NTL/LLL.h>
#include <iostream>