Skip to content

Instantly share code, notes, and snippets.

View Jerakin's full-sized avatar
🔥
Makin'

Jerakin

🔥
Makin'
View GitHub Profile
# https://blender.stackexchange.com/a/203990
bl_info = {
"name": "Lock View Rotation",
"blender": (3, 6, 4),
"category": "View",
}
import bpy
def draw_lock_rotation(self, context):
@Jerakin
Jerakin / example.py
Created April 18, 2023 09:31
QRunnable Example
import time
from Qt import QtWidgets, QtCore
import runnable
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs)
@Jerakin
Jerakin / unregister_tool.py
Last active December 2, 2021 19:34
Ugly patched version of Blenders unregister tool function that I can't get to work
class ToolNotRegisteredError(Exception):
"""Adding special exception to be able to only catch this special exception"""
pass
def unregister_tool(tool_cls):
space_type = tool_cls.bl_space_type
context_mode = tool_cls.bl_context_mode
from bl_ui.space_toolsystem_common import (
ToolSelectPanelHelper,
@Jerakin
Jerakin / blender.py
Created November 30, 2021 23:00
Small blender boiler plate script
import bpy
class BoilerPlateData(bpy.types.PropertyGroup):
counter: bpy.props.IntProperty(name="Count", default=1, min=0)
class BoilerPlate_OT_Operator(bpy.types.Operator):
bl_idname = "boilerplate.operator"
bl_label = ""
@Jerakin
Jerakin / primer.md
Created August 1, 2021 23:31
A primer of Moxfield on Moxfield

The Primer on

===accordion ===panel: Adding Cards

When adding a card by name you can search (and wait for the result) and then press the down arrow to select the card and then enter to add it.

@Jerakin
Jerakin / discord-embed.html
Last active June 22, 2021 15:04
Discord Embed
<html lang="en">
<head>
<meta content="Nuts for Tokens - Commander (Toski, Bearer of Secrets)" property="og:title">
<meta content="Toski is ready and able to lure in the enemy so your army can get through. Watch out for his hammer!" property="og:description">
<meta content='https://assets.moxfield.net/cards/card-Yoej2-art_crop.jpg' property='og:image'>
<meta name="theme-color" content="#E85485">
<link type="application/json+oembed" href="https://gist.githubusercontent.com/Jerakin/c7e93b35fd360ed9775c8a595ad1d7c8/raw/927c3f555b80e091c33806aaf55d055bdfc2b630/discord-embed.json" />
</head>
</html>
@Jerakin
Jerakin / p.lua
Created August 10, 2020 08:53
Quick profiling
local md5 = require "main.md5"
local by_index = {}
local by_id = {}
local function time_it(fnc)
local before = os.clock()
fnc()
print((os.clock() - before)*1000)
end
from PIL import Image
from pathlib import Path
import json
root = Path(__file__).parent
output = root / "assembled_tokens"
tokens = root / "images"
token_source = root / "token_source"
data_file_folder = root.parent.parent.parent / "assets" / "datafiles"
pokemon_folder = data_file_folder / "pokemon"
@Jerakin
Jerakin / check_package_license.py
Created January 2, 2020 15:52
a naive way to check for a license file within a python package
import pkg_resources
def get_pkg_license(pkgname):
pkgs = pkg_resources.require(pkgname)
pkg = pkgs[0]
try:
lines = pkg.get_metadata_lines('METADATA')
except:
lines = pkg.get_metadata_lines('PKG-INFO')
@Jerakin
Jerakin / Emulate_Scrolling_Middle_Button.ahk
Created October 9, 2019 14:53
Enables you to use any key with cursor movement to emulate a scrolling middle button. Written for Trackball mice.
;;
;; Emulate_Scrolling_Middle_Button.ahk
;; Author: Erik Elmore <erik@ironsavior.net>
;; Version: 1.1 (Aug 16, 2005)
;;
;; Enables you to use any key with cursor movement
;; to emulate a scrolling middle button. While
;; the TriggerKey is held down, you may move the
;; mouse cursor up and down to send scroll wheel
;; events. If the cursor does not move by the