Skip to content

Instantly share code, notes, and snippets.

@nrtkbb
nrtkbb / media_backup.py
Created August 13, 2023 06:24
SDカードから写真と動画をコピーするコマンド。LUMIXの拡張子に合わせてある。
import os
import sys
import shutil
from pathlib import Path
from datetime import datetime
from typing import Optional
LOCAL_PIC_DIR = Path('path to local')
NAS_PIC_DIR = Path('path to nas')
LOCAL_MOV_DIR = Path('path to local')
@nrtkbb
nrtkbb / app.py
Last active May 14, 2023 11:22
pomodoro_slack_app.py
from flask import Flask
from flask import request
from flask import jsonify
from celery import Celery
app = Flask(__name__)
app.config['CELERY_BROKER_URL'] = 'redis://localhost:6379/0'
app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost:6379/0'
SLACK_BOT_TOKEN = 'token'
@nrtkbb
nrtkbb / how_to_use.py
Created June 17, 2021 10:06
MObject や MDagPath などを dict のキーに入れるためのラッパークラス
from maya.api.OpenMaya import MGlobal
from mhash import MHash
selection_list = MGlobal.getSelectionListByName('persp')
# MObject は直接 dict のキーにできないけど
mobject = selection_list.getDependNode(0)
# MHashのインスタンスなら dict のキーにできる
mhash1 = MHash(mobject)
#include <M5StickC.h>
#include <Wire.h>
#include "DHT12.h"
DHT12 dht12;
int PIN = 32; // GROVEの黄色い線にパルスを送る
int PWMCH = 0;
void setup() {
print('hello')
from itertools import izip
from datetime import datetime
from maya import cmds
def slow_version(uvs):
a = ['meshName.uvst[0].uvsp[*]']
a_append = a.append
for u, v in izip(uvs[0], uvs[1]):
a_append(u)
a_append(v)
@nrtkbb
nrtkbb / maya2018install.sh
Last active June 19, 2023 08:25 — forked from borgfriend/maya2017install.sh
Maya 2018 Installation on Ubuntu 18.04
#!/bin/bash
#Make sure we’re running with root permissions.
if [ `whoami` != root ]; then
echo Please run this script using sudo
echo Just type “sudo !!”
exit
fi
#Check for 64-bit arch
if [uname -m != x86_64]; then
@nrtkbb
nrtkbb / hasMaskFeather.js
Created July 24, 2018 02:05
レイヤーマスク属性の「ぼかし」に値が入ってたらMayaでおかしくなるのでアウトと判定する。参考: https://qiita.com/mizu16/items/85a1bc001db2581528a2
var _layerList = [],
main = function() {
var document = activeDocument;
var layerList = document.layers;
getLayer(layerList);
var hasFeather = [];
for(var i = 0, num = _layerList.length; i < num; i++){
var layer = _layerList[i];
@nrtkbb
nrtkbb / nodeType_lsType_benchmark.py
Last active May 11, 2018 08:38
cmds.nodeType vs cmds.ls(type=)
node_list = cmds.ls()
print(node_list)
# Result: 9044
start = datetime.datetime.now()
for i in xrange(100):
shading_engine = cmds.ls(type='shadingEngine')
if not shading_engine:
@nrtkbb
nrtkbb / detect_marker.py
Created April 30, 2018 15:33 — forked from ksasao/detect_marker.py
ZOZOSUITのマーカーのIDを読み取るコードです。公開されている画像を元に独自に解析しているので、公式ではこのように処理しているかどうかは不明です。
import numpy as np
import random
import math
import cv2
from PIL import Image
def detect_markers(im):
markers = []
# 輪郭線抽出のための二値化
im_gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)