Skip to content

Instantly share code, notes, and snippets.

@schnello
schnello / 3dprintflow.txt
Created April 16, 2019 11:53
nodered flow for octoprint
[{"id":"4bedb5dd.1b0e8c","type":"change","z":"9d5bc26c.e42c8","name":"Set Progress 0","rules":[{"t":"set","p":"payload.progress.completion","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":300,"wires":[["e7dc5b91.a12e18"]]},{"id":"cea131b0.44184","type":"ui_template","z":"9d5bc26c.e42c8","group":"e2bbaa5d.0c6bf8","name":"Video Frame","order":1,"width":"10","height":"10","format":"<img width=\"16\" height=\"16\" src=\"{{flow.payload.webcam.on}}\" />","storeOutMessages":false,"fwdInMessages":true,"templateScope":"local","x":290,"y":580,"wires":[[]]},{"id":"8f572379.1bf63","type":"http request","z":"9d5bc26c.e42c8","name":"","method":"use","ret":"txt","url":"","tls":"","x":550,"y":60,"wires":[["27be8cd7.507f94"]]},{"id":"7bfde874.9bb6d8","type":"ui_gauge","z":"9d5bc26c.e42c8","name":"","group":"146f3617.73b19a","order":4,"width":"0","height":"0","gtype":"gage","title":"Heatbed","label":"","format":"{{msg.payload.temperature.bed.actual}}°C","min":0,"max":"110",
@LotteMakesStuff
LotteMakesStuff / TrafficLightAttribute.cs
Last active February 2, 2024 15:58
TrafficLight control/layout/property drawer: Adds a new editor control that draws lil Traffic Lights in the inspector. its really useful for visualizing state. For example, checkboxes can be hard to read at a glace, but a Red or Green status light is easy! Recommend you use the attached package, as it has all the icon image files.
// Non Editor code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class TrafficLightAttribute : PropertyAttribute
{
public bool DrawLabel = true;
public string CustomLabel;
public bool AlsoDrawDefault;
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active July 27, 2024 14:45
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rsodre
rsodre / transformToFit.h
Created March 23, 2017 14:27
Transform matrix to fit any rect into any other rect. For OpenFrameworks (or anything else, really)
#pragma once
#include "ofMain.h"
void transformToFit( ofRectangle src, ofRectangle dst, bool upscale=true ) {
// Scale
float scaleX = ( dst.width / src.width );
float scaleY = ( dst.height / src.height );
float sc = ( scaleX < scaleY ? scaleX : scaleY );
if ( ! upscale )
sc = ofClamp( sc, 0.0f, 1.0f );
// Position (scaled)
@genekogan
genekogan / scrapeImages.py
Created February 22, 2017 11:49
scraping full size images from Google Images
from bs4 import BeautifulSoup
import requests
import re
import urllib2
import os
import argparse
import sys
import json
# adapted from http://stackoverflow.com/questions/20716842/python-download-images-from-google-image-search
@spite
spite / gist:90e3dbf8e117660f6788a5748ae06cad
Last active December 30, 2016 09:20
Go to https://lines.chromeexperiments.com/drag/, start the experience and run this code in the console
document.getElementById( 'loading' ).style.display = 'none';
var speed = .001; // changes the rate of rotation
var distance = 4; // changes the distance the point travels
function _update() {
bAmDrawing = true;
lastMouseX = 0; lastMouseY = 0;
var a = speed * performance.now();
var x = distance * Math.cos( a );
var y = distance * Math.sin( a );
stage.mousemove( { data: { global : { x: x, y: y } } } )
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditorInternal;
#endif
@TJHeuvel
TJHeuvel / MeshVisualizeWindow.cs
Last active May 9, 2024 14:58
Visualizes the mesh vertices and triangles
using UnityEngine;
using UnityEditor;
using System.Collections;
using System;
public class MeshVisualizeWindow : EditorWindow
{
[MenuItem("Window/Mesh visualizer")]
public static void OpenWindow()
{
@zz85
zz85 / mesh_simplify.html
Last active November 7, 2023 02:10
Fast Quadric Mesh Simplification JS port
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webgl - modifier - Fast Quadric Mesh Simplification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
font-family: Monospace;
background-color: #f0f0f0;
# "Colorizing B/W Movies with Neural Nets",
# Network/Code Created by Ryan Dahl, hacked by samim.io to work with movies
# BACKGROUND: http://tinyclouds.org/colorize/
# DEMO: https://www.youtube.com/watch?v=_MJU8VK2PI4
# USAGE:
# 1. Download TensorFlow model from: http://tinyclouds.org/colorize/
# 2. Use FFMPEG or such to extract frames from video.
# 3. Make sure your images are 224x224 pixels dimension. You can use imagemagicks "mogrify", here some useful commands:
# mogrify -resize 224x224 *.jpg
# mogrify -gravity center -background black -extent 224x224 *.jpg