Skip to content

Instantly share code, notes, and snippets.

@zooid
zooid / example.py
Created August 17, 2022 20:13 — forked from niccokunzmann/example.py
You can use while and for loops without blocking the GUI. This is currently for Tkinter and PyQT. To install guiLoop copy the guiLoop.py file into the directory of your script.
## MIT License
##
## Copyright 2014 Nicco Kunzmann
##
## Permission is hereby granted, free of charge, to any person obtaining a copy of this
## software and associated documentation files (the "Software"), to deal in the Software
## without restriction, including without limitation the rights to use, copy, modify, merge,
## publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
## to whom the Software is furnished to do so, subject to the following conditions:
##
@zooid
zooid / ArrayList.vbs
Created August 17, 2022 20:06 — forked from simply-coded/ArrayList.vbs
Use lists in VBScript.
'create an arraylist
Set list = CreateObject("System.Collections.ArrayList")
'add values
list.add "mike"
list.add "jeremy"
list.add "kate"
list.add "alice"
'add a bunch of values easily via custom sub
@zooid
zooid / list_to_tree.py
Created August 17, 2022 20:05 — forked from piac/list_to_tree.py
Transforms DataTrees in Grasshopper to nestings of lists, and vice versa
def list_to_tree(input, none_and_holes=True, source=[0]):
"""Transforms nestings of lists or tuples to a Grasshopper DataTree"""
from Grasshopper import DataTree as Tree
from Grasshopper.Kernel.Data import GH_Path as Path
from System import Array
def proc(input,tree,track):
path = Path(Array[int](track))
if len(input) == 0 and none_and_holes: tree.EnsurePath(path); return
for i,item in enumerate(input):
if hasattr(item, '__iter__'): #if list or tuple
@zooid
zooid / hex_to_rgb.py
Created August 17, 2022 19:45 — forked from matthewkremer/hex_to_rgb.py
Python Hex Code to RGB Value
def hex_to_rgb(hex):
hex = hex.lstrip('#')
hlen = len(hex)
return tuple(int(hex[i:i+hlen/3], 16) for i in range(0, hlen, hlen/3))
@zooid
zooid / easing.py
Created August 17, 2022 18:27 — forked from th0ma5w/easing.py
Easing Equations in Python (orig by Robert Penner)
# ported from http://www.gizma.com/easing/
# by http://th0ma5w.github.io
#
# untested :P
import math
linearTween = lambda t, b, c, d : c*t/d + b
@zooid
zooid / _README.md
Created August 17, 2022 18:12 — forked from shaunlebron/_README.md
Direct3D9 Wrapper DLL

In response to a StackOverflow question:

This is code to build a Direct3D wrapper DLL, intercepting all calls to Direct3D interface functions so that you can draw your own objects to display over the game. Just plop the DLL into the same folder as the game's executable, and it should load it as if it were the real d3d9.dll file. It still forwards all calls to the real one in system32, just allows stuff to happen in between. original stackoverflow answer

@zooid
zooid / cython_tricks.md
Created August 17, 2022 18:06 — forked from ctokheim/cython_tricks.md
cython tricks

Cython

Cython has two major benefits:

  1. Making python code faster, particularly things that can't be done in scipy/numpy
  2. Wrapping/interfacing with C/C++ code

Cython gains most of it's benefit from statically typing arguments. However, statically typing is not required, in fact, regular python code is valid cython (but don't expect much of a speed up). By incrementally adding more type information, the code can speed up by several factors. This gist just provides a very basic usage of cython.

@zooid
zooid / compile_stdlib.py
Created August 17, 2022 17:59 — forked from madebyjazz/compile_stdlib.py
Compile all Python scripts into single StdLib.dll .NET assembly
# Script below is based on following post:
# IronPython: EXE compiled using pyc.py cannot import module "os" - Stack Overflow
# http://stackoverflow.com/questions/6195781/ironpython-exe-compiled-using-pyc-py-cannot-import-module-os
import sys
sys.path.append('d:/projects/SomeProject/Libs/IronPython')
sys.path.append('d:/projects/SomeProject/Libs/IronPython/Lib')
sys.path.append('d:/projects/SomeProject/Libs/IronPython/Tools/Scripts')
import clr
if ScoreLast > highscore_dict["easy"]["1"]["score"]:
highscore_dict["easy"]["10"]["user"] = highscore_dict["easy"]["9"]["user"]
highscore_dict["easy"]["10"]["score"] = highscore_dict["easy"]["9"]["score"]
highscore_dict["easy"]["9"]["user"] = highscore_dict["easy"]["8"]["user"]
highscore_dict["easy"]["9"]["score"] = highscore_dict["easy"]["8"]["score"]
highscore_dict["easy"]["8"]["user"] = highscore_dict["easy"]["7"]["user"]
highscore_dict["easy"]["8"]["score"] = highscore_dict["easy"]["7"]["score"]
highscore_dict["easy"]["7"]["user"] = highscore_dict["easy"]["6"]["user"]
highscore_dict["easy"]["7"]["score"] = highscore_dict["easy"]["6"]["score"]
highscore_dict["easy"]["6"]["user"] = highscore_dict["easy"]["5"]["user"]
@zooid
zooid / dotnetlayout.md
Created January 27, 2020 00:08 — forked from davidfowl/dotnetlayout.md
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/