Skip to content

Instantly share code, notes, and snippets.

View miho's full-sized avatar

Michael Hoffer miho

View GitHub Profile
@miho
miho / truncocta.scad
Created June 13, 2018 17:32 — forked from nichtich/truncocta.scad
Truncated octahedron as 3D-Model in OpenSCAD
/*
Truncated octahedron.
*/
module truncocta() {
// octahedron based on code by Willliam A Adams
octapoints = [
[+1, 0, 0], // + x axis
[-1, 0, 0], // - x axis
[0, +1, 0], // + y axis
@miho
miho / UnescapeJavaString
Created December 28, 2017 14:15 — forked from uklimaschewski/UnescapeJavaString
Unescapes a string that contains standard Java escape sequences: - \b \f \n \r \t \" \' : BS, FF, NL, CR, TAB, single and double quote - \X \XX \XXX : Octal character from 0 to 377 (that is in Hex: 0x00 to 0xFF) - \uXXXX : Hexadecimal based Unicode character
/**
* Unescapes a string that contains standard Java escape sequences.
* <ul>
* <li><strong>&#92;b &#92;f &#92;n &#92;r &#92;t &#92;" &#92;'</strong> :
* BS, FF, NL, CR, TAB, double and single quote.</li>
* <li><strong>&#92;X &#92;XX &#92;XXX</strong> : Octal character
* specification (0 - 377, 0x00 - 0xFF).</li>
* <li><strong>&#92;uXXXX</strong> : Hexadecimal based Unicode character.</li>
* </ul>
@miho
miho / virtualwall_irremote.pde
Created October 13, 2017 18:46 — forked from mschmitt/virtualwall_irremote.pde
A trivial Arduino sketch to mimic iRobot Virtual Wall for Roomba
/*
A trivial Arduino sketch to mimic iRobot Virtual Wall for Roomba
----------------------------------------------------------------
Based on information found at:
http://sites.google.com/site/irobotcreate2/createanirbeacon
Uses "A Multi-Protocol Infrared Remote Library for the Arduino":
http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html
@miho
miho / Send infrared commands from the Arduino to the iRobot Roomba
Created October 13, 2017 18:43 — forked from probonopd/Send infrared commands from the Arduino to the iRobot Roomba
Send infrared commands from the Arduino to the iRobot Roomba. Use a transistor to drive the IR LED from pin D3 for maximal range.
#include <IRremote.h>
/*
Send infrared commands from the Arduino to the iRobot Roomba
by probono
2013-03-17 Initial release
@miho
miho / Fib.txt
Created October 13, 2016 12:43 — forked from kabutz/Fib.txt
A simple exponential time shootout between C, Java and Swift
/*
Algorithm is exponential - very bad. It is just meant to exercise the CPU a bit and
to see what happens with different languages. Not representative of real code.
Interesting that Java beats C, thanks to HotSpot. I expected Swift to be as fast as C
at least. I also expected the compiled Swift to be faster than when run as a script.
A bit disappointed, but more time needed to see where the bottlenecks are. Plus I
need to run some real code for benchmarking.
Update: swiftc -O improved the speed quite a bit to be about the same speed as Java
@miho
miho / gist:c53634279d6380e2b682
Last active September 7, 2015 14:34 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

import eu.mihosoft.vrl.v3d.Cube as Cube
#print dyio
csg = Cube(20).toCSG()
print "Result = ",csg
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.chart.*;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
//viewDidload
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
// iOS 7
[self prefersStatusBarHidden];
[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
} else {
// iOS 6
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
}
package org.dejay.prism.opengl;
import com.sun.glass.ui.Screen;
import com.sun.javafx.geom.Rectangle;
import com.sun.javafx.geom.transform.BaseTransform;
import com.sun.javafx.logging.PlatformLogger;
import com.sun.prism.CompositeMode;
import com.sun.prism.RenderTarget;
import com.sun.prism.Texture;
import com.sun.prism.camera.PrismCameraImpl;