Skip to content

Instantly share code, notes, and snippets.

@mnmly
mnmly / pack-drawings.js
Created August 12, 2022 07:02
pack-drawings.js #pdf #nodejs
const fs = require('fs')
const PDFLib = require('pdf-lib')
const filepath = './220812_竣工図/220812_AUO_竣工図整理.pdf'
const PDFDocument = PDFLib.PDFDocument
const productionDwgFilePaths = [
'../08_issued/SETUP/220713/220713_SDR-2_commented.pdf',
'../08_issued/SETUP/220714/220714_F4-3_commented.pdf',
'../08_issued/SETUP/220722/220722_AUO_元赤坂建具図_0721_commented.pdf',
]
@mnmly
mnmly / dump.js
Created July 28, 2022 09:08
notion's api
const { Client } = require("@notionhq/client")
const fs = require('fs')
const path = require( 'path' )
const parse = require('url').parse
const request = require( 'request' )
// Initializing a client
const download = (uri, filename, callback) => {
request.head(uri, (err, res, body) => {
request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
@mnmly
mnmly / keyframe-iterations.py
Last active March 24, 2022 06:22
make iterations into keyframes #blender #bpy
import re
import bpy
iteration_items = []
for item in bpy.data.objects:
if 'Block__Iteration' in item.name_full:
iteration_items.append(item)
prev_name = None
frame_index = -1
for j in range(50):
@mnmly
mnmly / proxy.pac
Last active October 20, 2021 16:09
function FindProxyForURL(url, host) {
PROXY = "PROXY 127.0.0.1:1234";
alert(url);
if (shExpMatch(host, "*.alp-official.jp") ) {
// if ( shExpMatch(url, "*/js/*") ) {
return PROXY;
// }
@mnmly
mnmly / index.py
Created December 28, 2020 20:37
ghtree` #python #gh
import ghpythonlib.treehelpers as th
x = th.tree_to_list(x)
layerTree = th.list_to_tree(layerTree, source=[0,0])
@mnmly
mnmly / convert-tile
Created November 25, 2020 19:16
convert-tile
#!/usr/bin/env bash
dir="$(dirname "$1")"
base=$(basename "$1" | cut -d. -f1)
out="$dir/$base-%d03.jpg"
convert "$1" -crop 2x2@ +repage +adjoin "$out"
@mnmly
mnmly / install-yak-for-mac.sh
Created September 9, 2019 09:15
Install Grasshopper Package Manager yak on mac
cd /Applications/Rhinoceros.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources
mkbundle --simple -o yak yak.exe
ln -s /Applications/Rhinoceros.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/yak /usr/local/bin/yak
var fs = require( 'fs' )
var struggle = fs.readFileSync( __dirname + '/struggle.txt', 'utf-8' )
console.log( mirror(struggle, 45, true ) );
console.log( '--------------------' );
console.log( mirror(struggle, 90, false ) );
function mirror( str, gap, keep ) {
var lines = str.split( '\n' )
@mnmly
mnmly / prefix.js
Created October 28, 2014 15:49
dumb prefix
var p = document.createElement('p');
var prefixes = ['webkit','Moz','ms','O'];
var len = prefixes.length;
var style = p.style;
p = null;
module.exports = prefix;
function prefix(prop) {
for (i = 0; i < len; i++) {
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(255);
ofEnableSmoothing();
layoutPoints();
}