Skip to content

Instantly share code, notes, and snippets.

View miho's full-sized avatar

Michael Hoffer miho

View GitHub Profile
@miho
miho / ExampleCustomPGNode.java
Created October 28, 2012 20:40
Example custom render node for JavaFX 2.2
package org.dejay.javafx.example;
import javafx.animation.Transition;
import javafx.application.Application;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Region;
import javafx.scene.text.Font;
// @author Michael Hoffer <info@michaelhoffer.de>
// Requires TMCStepper library
#include <TMCStepper.h>
#include <EEPROM.h>
#include <avr/wdt.h>
#include <Wire.h>
#define CS_PIN1 8 // CS1 chip select
#define CS_PIN2 9 // CS1 chip select
#define CS_PIN3 10 // CS2 chip select
@miho
miho / UnmodifiableMapSample.java
Created July 16, 2012 11:52
Unmodifiable Map Sample
/**
*
* @author Michael Hoffer <info@michaelhoffer.de>
*/
public class UnmodifiableMapSample {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
using System.Runtime.InteropServices;
using System.Security;
namespace com.bfx.timerutil {
/// <summary> Tools to enable high-resolution timer (1ms). Default timer resolution is 16ms.</summary>
/// Note, that only the resolution of Thread.Sleep() is increased. Task.Delay() is not affected by this
/// increased resolution since the responsible timer is running at fixed 16m rate.
public static class TimerUtil {
@miho
miho / ArduinoCRC16.java
Last active August 25, 2020 12:13
Example on how to compute Arduino compliant CRC16 checksums in Java.
/**
* Example on how to compute Arduino compliant CRC16 checksums in Java.
*
* @author info@michaelhoffer.de
*/
public class Main {
public static void main(String[] args) {
byte[] data = new byte[]{1,2,3};
int crc = crc16(data);
@miho
miho / DraggableNode01.java
Created October 2, 2012 17:03
Draggable Node 01 (make JavaFX nodes draggable)
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
@miho
miho / Adafruit_DHT_Particle.cpp
Last active March 26, 2019 22:53
Particle Electron DHT22 based Thermometer: Publishes on thingspeak and goes to standby if not publishing (long batter life)
/* DHT library v0.0.2 works for Particle Electon v1.0.1
*
* MIT license
* written by Adafruit Industries
* modified for Spark Core by RussGrue
* */
#include "Adafruit_DHT_Particle.h"
DHT::DHT(uint8_t pin, uint8_t type, uint8_t count) {
package eu.mihosoft.vrl.user;
import eu.mihosoft.jcsg.ext.mesh.MeshTools;
import eu.mihosoft.jcsg.CSG;
@ComponentInfo(name="MeshOptimizer", category="Custom")
public class MeshOptimizer implements java.io.Serializable {
private static final long serialVersionUID=1L;
public CSG optimize(
@ParamInfo(name="mesh to optimize", style="default", options="") CSG mesh,
package eu.mihosoft.vrl.user;
import eu.mihosoft.jcsg.Cylinder;
import eu.mihosoft.jcsg.CSG;
import eu.mihosoft.vvecmath.Transform;
import eu.mihosoft.vvecmath.Vector3d as Vec3d;
import eu.mihosoft.vvecmath.Vectors3d as Vecs;
import eu.mihosoft.jcsg.ext.path.*
@ComponentInfo(name="Bacteria Creator 01", category="Custom")
public class BacteriaCreator01 implements java.io.Serializable {
@miho
miho / FunctionPlotter.groovy
Last active November 1, 2018 10:22
Function Plotter Template for VRL-Studio
package eu.mihosoft.vrl.user;
/**
* Function Plotter
*/
@ComponentInfo(name="FunctionPlotter", category="ODE")
public class FunctionPlotter implements java.io.Serializable {
private static final long serialVersionUID=1L;
public Trajectory run(