This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) | |
# вставка в конце |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <CustomStepper.h> | |
CustomStepper stepper(2, 3, 4, 5); | |
int key_pin = 12; | |
int KEY_PRESSED = 0; | |
int is_rotate = false; | |
void setup() | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' |