Skip to content

Instantly share code, notes, and snippets.

substitutions:
devicename: ld2450
upper_devicename: "Hi-Link LD2450"
esphome:
name: wd-presense
friendly_name: wd_presense
includes:
- ld2450_uart.h
@Onefabis
Onefabis / QMK_color_widget
Last active August 16, 2022 13:54
The color widget that indicates current active layer in QMK keyboard via HID raw data
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
import pywinusb.hid as hid
from functools import partial
import base64
import os
import re
import win32gui
@Onefabis
Onefabis / qmk_color_widget
Last active August 16, 2022 00:04
qmk_color_widget
import time
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
import pywinusb.hid as hid
from functools import partial
import base64
import os
@Onefabis
Onefabis / currentLayer.py
Last active May 31, 2022 15:59
layout switcher for Qmk keyboard
'''
1. Open src.c in lang shift lib and add this function right next to the 'lang_activate' function
########################################
void lang_toggle(int externalLang) {
if (lang_current == lang_should_be && timer_read() - lang_timer >= 200) {
if (externalLang == 0){
layer_off(2);
} else if (externalLang == 1){
layer_on(2);
@Onefabis
Onefabis / lineIt
Last active December 19, 2021 00:39
align selected vertices in line #maya #align #script #vertices #mesh
import maya.api.OpenMaya as om2
import maya.cmds as mc
import math
import maya.mel as mel
'''
select two main vertices
and then select child vertices
that you need to align
in line between the main ones
@Onefabis
Onefabis / AnimLayerBetweens
Last active October 9, 2020 14:46
Rebake in-betweens for new poses in new animation layers
import maya.api.OpenMaya as om2
import math
import maya.cmds as mc
import maya.mel as mel
def getDG( nType, getShape = False, upstream = True, pluglevel = True, sel=[] ):
kPlugLevel = pluglevel
direction = om2.MItDependencyGraph.kUpstream if upstream else om2.MItDependencyGraph.kDownstream
nodes = []
if len( sel ) == 0:
@Onefabis
Onefabis / containerAnim
Last active May 4, 2020 23:13
Transform multiple controllers at once
'''
Save the file to Maya script folder and then just
run this three-line code in script editor to call the UI
import maya.cmds as mc
import containerAnim
containerAnim.containerAnim().UI()
'''
import maya.cmds as mc
@Onefabis
Onefabis / ConnectionsInspector
Last active May 10, 2022 13:49
Look for any node connections for selected objects in Maya
'''
Select any object and run the script, it will select any node, specified in the list of the "getDG" nType array
Some api node type examples:
Camera = camera
Parent Constraint = parentConstraint
Point Constraint = pointConstraint
Orient Constraint = orientConstraint
Aim Constraint = aimConstraint
Scale Constraint = scaleConstraint
Skin Cluster = skinCluster
@Onefabis
Onefabis / placeLoc
Created December 9, 2019 20:15
place locators in space of selected object
import maya.cmds as mc
locResult = mc.promptDialog( title='Insert Locators', message='Locator count:', button=['OK', 'Cancel'], defaultButton='OK', cancelButton='Cancel', dismissString='Cancel')
if locResult == 'OK':
locCount = mc.promptDialog( q=1, text=1)
if not locCount or not int(locCount) :
locCount = 1
sel = mc.ls( sl=1 )
for s in sel:
pos = mc.xform( s, q=1, t=1, ws=1 )
for l in xrange( int( locCount ) ):
@Onefabis
Onefabis / colorAttributes
Created October 3, 2019 16:21
Plugin for colorizer script in order to attribute color in the channel box
import ast
import sys
import maya.api.OpenMaya as om2
import maya.cmds as mc
import colorsys
# Plug-in information:
kPluginNodeName = 'colorAttributes'
kPluginNodeClassify = 'utility/general'
kPluginNodeId = om2.MTypeId( 0x86025 )