Skip to content

Instantly share code, notes, and snippets.

View motoishmz's full-sized avatar

Motoi Shimizu motoishmz

View GitHub Profile
label key command
general.pause space space
general.forward left left
general.backward right right
general.cooking ctrl.space offon
general.F1 F1 F1
general.F2 F2 F2
general.F3 F3 F3
general.F4 F4 F4
general.F5 F5 F5
import os
import subprocess as sp
import json
import pandas as pd
def _find_all_files_with_ext(dir, ext):
suffix = os.extsep + ext.lower()
for root, dirs, files in os.walk(dir):
for file in files:
if file.lower().endswith(suffix):
{
"PresetList": [
{
"AudioCopyMask": [
"copy:aac",
"copy:ac3",
"copy:dtshd",
"copy:dts",
"copy:mp3",
"copy:truehd",
# -*- coding: utf8 -*-
USAGE = \
'''
USAGE:
rename
$ python rename.py rn {oldName} {newName}
copy & rename
$ python rename.py cp {oldName} {newName}
'''
@motoishmz
motoishmz / DAT_exitOF.py
Last active November 22, 2017 05:45
touchdesigner note - tiny scripts
import os
os.system("taskkill /im emptyExample.exe")
#include "ofMain.h"
class ofApp : public ofBaseApp {
static const std::string kEndpoint;
static const std::string kRequestLabel; // for testing
std::unordered_map<std::string, std::function<void(const ofHttpResponse &)>> handler;
std::vector<int> request_history;
@motoishmz
motoishmz / ffmpeg_conv_all.py
Created February 23, 2017 09:14
convert .mov with alac encoding audio to .wav using ffmpeg
import os
import glob
import commands
import time
files = glob.glob('*.mov')
for file in files:
if os.path.isfile(file) :
base, ext = os.path.splitext(file);
command = "/usr/local/bin/ffmpeg -y -i " + file + " " + base + ".wav"
#include "log.h"
#include "ofUtils.h"
namespace aoi {
namespace detail {
static std::stack<ofLogLevel> log_level_stack;
static std::mutex log_level_mutex;
}
#include <iostream>
#include <random>
#include <chrono>
#include <functional>
#include <string>
using namespace std;
std::mt19937 random_engine;
std::uniform_real_distribution<float> random_distribution;
@motoishmz
motoishmz / ofXml_to_std::wstring.h
Last active October 22, 2018 02:08
openframeworks example: convert std::string with an external file --> std::wstring
#include <codecvt>
#include "ofxTrueTypeFontUL2.h" // https://github.com/kentaroid/ofxTrueTypeFontUL2
std::wstring text;
ofxTrueTypeFontUL2 typeface;
void ofApp::setup() {
ofXml xml("multilingual_words.xml"); // have to be saved as UTF-8 with BOM
// do something with xml...
std::string text_from_xml = xml.getAttribute("my_chinese_word");