Skip to content

Instantly share code, notes, and snippets.

View peterix's full-sized avatar
⛱️
Take out the parasols! Take out the plastic chairs!

Petr Mrázek peterix

⛱️
Take out the parasols! Take out the plastic chairs!
View GitHub Profile
@peterix
peterix / mcfuckery.asm
Created June 27, 2014 20:42
Horrible Things Intel Does To Minecraft Players...
; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
.text:103CD670
; Attributes: bp-based frame
.text:103CD670
; int __cdecl MinecraftFuckery()
MinecraftFuckery proc near ; DATA XREF: .text:10129B8Ao
.text:103CD670
ProcName = dword ptr -4
.text:103CD670
push ebp
@peterix
peterix / kv.cpp
Created July 4, 2014 21:37
A key value store. With locking. Can't go any simpler than that.
template <typename K, typename V>
class RWStorage
{
public:
void add(K key, V value)
{
QWriteLocker l(&lock);
cache[key] = value;
}
V get(K key) const
@peterix
peterix / thumbnails.cpp
Created July 5, 2014 08:04
A thumbnail thing :D
class ThumbnailRunnable: public QRunnable
{
public:
ThumbnailRunnable (QString path, SharedIconCache cache)
{
m_path = path;
m_cache = cache;
}
void run()
{
@peterix
peterix / DefaultVariable.cpp
Last active August 29, 2015 14:04
A thing that can be default until set. And become default after reset.
template <typename T, typename D>
class DefaultVariable
{
public:
operator =(const T & value)
{
currentValue = value;
is_default = currentValue == defaultValue;
}
operator const T &() const
@peterix
peterix / versions.json
Created August 14, 2014 18:43
Liteloader fix for 1.5.2
"versions":{
"1.5.2":{
"artefacts":{
"com.mumfrey:liteloader":{
"53639d52340479ccf206a04f5e16606f":{
"tweakClass":"com.mumfrey.liteloader.launch.LiteLoaderTweaker",
"libraries":[
{
"name":"net.minecraft:launchwrapper:1.5"
},
@peterix
peterix / mods.json
Last active August 29, 2015 14:06
mod metadata storege in instances
{
"formatVersion": 1,
"installed": [
{
"qm_uid": "appeng.appliedenergistics2",
"qm_updateUrl": "http://ae2.ae-mod.info/builds/quickmod.qm",
"version": "1.1.21",
"name": "Applied Energistics 2",
"installedFiles": [
{
@peterix
peterix / clarity.cpp
Created September 11, 2014 13:23
Making code readable, exposing problems.
/* Before */
const QMap<QuickModRef, QPair<QuickModVersionRef, bool>> quickmods =
m_instance->getFullVersion()->quickmods;
QList<QuickModRef> mods;
for (auto it = quickmods.cbegin(); it != quickmods.cend(); ++it)
{
const QuickModVersionRef version = it.value().first;
QuickModPtr mod = version.isValid() ? version.findMod()
: MMC->quickmodslist()->mods(it.key()).first();
QuickModVersionPtr ptr = version.findVersion();
@peterix
peterix / thing.json
Created September 12, 2014 11:21
Maybe?
{
"depends": [
"codechicken.ForgeMultipart:[1.0.0.228,)",
"net.minecraft:1.6.4"
],
...
}
{
"fileId": "org.lwjgl.override",
"name": "MY LWJGL",
"version": "1.2.3",
"+libraries": [
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
@peterix
peterix / FTB-1.7.10.json
Created November 17, 2014 19:11
FTB-1.7.10.json
{
"id": "1.7.10",
"time": "2014-05-14T19:29:23+02:00",
"releaseTime": "2014-05-14T19:29:23+02:00",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}",
"minimumLauncherVersion": 13,
"assets": "1.7.10",
"libraries": [
{