Skip to content

Instantly share code, notes, and snippets.

View Kyu's full-sized avatar
😜
I like doing shit

Precious Kyu

😜
I like doing shit
View GitHub Profile
@kupiakos
kupiakos / requirements.txt
Last active January 21, 2018 03:01
/r/upvoteexeggutor full subreddit generator script
Pillow
praw==3.4.0
@jakesherman
jakesherman / try_except.py
Created September 10, 2017 12:27
Try/except decorator in Python
def try_except(func):
"""Try/Except decorator - takes as input a function, and outputs
a modified version of that function whose first argument is how
many times you want to re-run the function if any exception is
raised.
"""
def try_except_function(num_tries, *args, **kwargs):
"""Modified version of func - see docstring for try_except().
"""
for i in range(num_tries):
@pcdinh
pcdinh / gist:1743283
Created February 5, 2012 05:49 — forked from srid/gist:1502656
Asynchronous run command lazily yielding command output (Python gevent)
def run_seq(cmd):
"""Run `cmd` and yield its output lazily"""
p = subprocess.Popen(
cmd, shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
# make STDIN and STDOUT non-blocking
fcntl.fcntl(p.stdin, fcntl.F_SETFL, os.O_NONBLOCK)
@aadnk
aadnk / TinyProtocol.java
Last active December 25, 2022 22:46
A tiny method enabling packet interception. Also found here: http://bit.ly/1fvVWiX
package com.comphenix.tinyprotocol;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Map;
import java.util.logging.Level;
// These are not versioned, but they require CraftBukkit
import net.minecraft.util.io.netty.channel.Channel;
@SizableShrimp
SizableShrimp / README.md
Last active January 20, 2023 04:19
Overview of Forge 1.18.2 registry and tag changes

Overview of Forge 1.18.2 registry and tag changes

Forge version 1.18.2-40.0.18 introduced some changes to how custom registries and tags work to support Mojang's new universal tag system. The differences between tags in 1.18.1 and 1.18.2 were great enough to warrant breaking changes in Forge where necessary.

Enabling tags for custom registries

For simplicity, custom Forge registries are opt-in for universal tags. To enable tags for a registry, call RegistryBuilder#hasTags(). This tells Forge to run the necessary setup to allow tags for a custom registry. Tag-enabled forge registries will be registered to the root registry in Registry to promote as much compatibility with vanilla systems as possible.

@SizableShrimp
SizableShrimp / README.md
Last active January 20, 2023 04:19
How to remap your mod to include Forge's 1.19 renames

How to remap your mod to include Forge's 1.19 renames

Forge versions 41.0.64 and 41.0.94 for Minecraft 1.19 together bring a large overhaul to rendering along with general renames to many older fields, methods, and classes that were previously based on MCP names. Together, these changes have broken almost all mods written for any older versions of Forge 1.19 or lower.

However, the Forge team has created a tool to aid modders in automatically remapping their mods to be in line with the renames. This tool has been designed with the future in mind. This means you should be able to use it starting from any Minecraft/Forge version (on FG5) on the way to porting to any future Minecraft/Forge versions (1.19+ / 41.0.94+).

Note: This does not port your mod for you. However, it greatly helps in automating parts that would otherwise be tedious.

@SizableShrimp
SizableShrimp / README.md
Last active January 20, 2023 04:20
How to use the Game Test Framework on Forge

Game Test Framework on Forge

The Game Test Framework is a powerful tool provided by Mojang that is included with Minecraft in 1.17 and up. It allows you to declare game tests that can be run inside a Minecraft world and provide a success or fail state. Game tests are similar in concept to unit tests, but they allow you to interact with a running instance of Minecraft. This means you can test block interactions, entity interactions, item functionality, etc. Game tests use template structures to define the dimensions of the test and what blocks and entities will start in the test structure. This framework has useful applications for Continuous Integration (CI) and testing during development to ensure features are working as expected.

For a more in-depth explanation about the Game Test Framework itself and how Mojang uses it to test the base game, please see this video with contributions by Dinnerbone. This guide is tailored towards Forge modders by expla

@eknight7
eknight7 / BUILD
Last active February 8, 2023 06:24
Multi-Hand Tracking via Live Webcam on CPU on Desktop: Shows how to extract landmarks on desktop.
// Copyright 2019 The MediaPipe Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@madjar
madjar / scrapper.py
Last active March 5, 2023 15:02
A example of scrapper using asyncio and aiohttp
import asyncio
import aiohttp
import bs4
import tqdm
@asyncio.coroutine
def get(*args, **kwargs):
response = yield from aiohttp.request('GET', *args, **kwargs)
return (yield from response.read_and_close(decode=True))
@kellyvaughn
kellyvaughn / noodles.js
Created June 5, 2023 01:38
Accept LinkedIn Requests
const btns = document.querySelectorAll('button[aria-label*="Accept"]')
for(const btn of btns){
setTimeout(() => { btn.click() }, 300)
}