Skip to content

Instantly share code, notes, and snippets.

import time
from machine import Pin, SPI
import st7789py as st7789
from random import randrange, choice
def hsv_to_rgb(h, s, v):
if s == 0.0:
return v, v, v
i = int(h * 6.0) # XXX assume int() truncates!
def build_movie(self, source_dir: Path, output_path: Path, **kwargs):
# получаем исходные данные
# основной сиквенс
sequence_path = self.get_source_sequence(source_dir) # путь к сиквенсу с паддингом
fps = self.get_value('fps', **kwargs)
if not fps:
raise RuntimeError('FPS for build movie not set')
# вставка в начале
pre_frames = self.collect_sequence_from(source_dir / self.variables['build_pre_frames_dir'])
# вставка в конце
from timeit import timeit
def t1():
# складываем 10 строк через + из переменной
t = 'text'
for _ in range(1000):
s = t + t + t + t + t + t + t + t + t
def t2():
# склеиваем список строк через метод join
#include <CustomStepper.h>
CustomStepper stepper(2, 3, 4, 5);
int key_pin = 12;
int KEY_PRESSED = 0;
int is_rotate = false;
void setup()
{
def copyfileobj(fsrc, fdst, callback, length=16*1024):
if os.path.exists(fdst):
if raw_input('File exists, {} \nOvervrite old? [y/n]: '.format(fdst)) == 'y':
print 'Remove file'
else:
print 'Skip copy'
return
copied = 0
prcnt = 0
size = os.path.getsize(fsrc)
@classmethod
def create_avatar_job(cls, JOB, **kwargs):
fake_render = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'cmd', 'fake_render.py')
blocks = [
dict(
name='Block 1',
tasks=['Task 1', 'Task 2'],
capacity=1000,
), dict(
name='Block 2',
from pymel.core import *
from pw_ui import *
#w = qControl(melGlobals['gAEControlLayoutName'], QWidget)
#b.setParent(None)
def addButton():
select('persp')
def addCustomButton():
b = QPushButton('Open Camera Rig')
"""
To use, make sure that externalDropCallback.py is in your MAYA_PLUG_IN_PATH
then do the following:
import maya
maya.cmds.loadPlugin("externalDropCallback.py")
Drag and drop events should appear in the script editor output.
"""
import pymel.core.uitypes as pmui
model_panel = pmui.ModelEditor(pm.getPanel(withFocus=True))
print pmui.ModelEditor.getRendererName(model_panel)
# Although, that snippet seems to be temperamental. It sometimes throws an error complaining that the model editor was not found, especially when executed from the shelf.
# Another way would be a bit wordy, but it works everytime:
import pymel.core as pm
# on remove server
echo "GatewayPorts yes" >> /etc/ssh/sshd_config
systemctl restart sshd
# on local
ssh -R 9000:localhost:9000 [email protected]
# alias
alias tnl='f(){ ssh -R "$1:localhost:$1" [email protected]; unset -f f; }; f'